Blender V5.0
interface_drag.cc File Reference
#include "AS_asset_representation.hh"
#include "ED_asset.hh"
#include "WM_api.hh"
#include "interface_intern.hh"

Go to the source code of this file.

Functions

void UI_but_drag_set_id (uiBut *but, ID *id)
void UI_but_drag_attach_image (uiBut *but, const ImBuf *imb, const float scale)
void UI_but_drag_set_asset (uiBut *but, const blender::asset_system::AssetRepresentation *asset, const AssetImportSettings &import_settings, BIFIconID icon, BIFIconID preview_icon)
void UI_but_drag_set_rna (uiBut *but, PointerRNA *ptr)
void UI_but_drag_set_path (uiBut *but, const char *path)
void UI_but_drag_set_name (uiBut *but, const char *name)
void UI_but_drag_set_image (uiBut *but, const char *path, int icon, const ImBuf *imb, float scale)
void ui_but_drag_free (uiBut *but)
bool ui_but_drag_is_draggable (const uiBut *but)
void ui_but_drag_start (bContext *C, uiBut *but)

Function Documentation

◆ UI_but_drag_attach_image()

void UI_but_drag_attach_image ( uiBut * but,
const ImBuf * imb,
float scale )

Set an image to display while dragging. This works for any drag type (WM_DRAG_XXX). Not to be confused with UI_but_drag_set_image(), which sets up dragging of an image.

Sets UI_BUT_DRAG_FULL_BUT so the full button can be dragged.

Definition at line 27 of file interface_drag.cc.

References uiBut::imb, uiBut::imb_scale, UI_BUT_DRAG_FULL_BUT, and UI_but_dragflag_enable().

Referenced by file_but_enable_drag(), and UI_but_drag_set_image().

◆ ui_but_drag_free()

void ui_but_drag_free ( uiBut * but)

◆ ui_but_drag_is_draggable()

bool ui_but_drag_is_draggable ( const uiBut * but)

◆ UI_but_drag_set_asset()

void UI_but_drag_set_asset ( uiBut * but,
const blender::asset_system::AssetRepresentation * asset,
const AssetImportSettings & import_settings,
int icon,
int preview_icon )

Sets UI_BUT_DRAG_FULL_BUT so the full button can be dragged.

Parameters
assetMay be passed from a temporary variable, drag data only stores a copy of this.
iconSmall icon that will be drawn while dragging.
preview_iconBigger preview size icon that will be drawn while dragging instead of icon.

Definition at line 34 of file interface_drag.cc.

References uiBut::drag_preview_icon_id, uiBut::dragflag, uiBut::dragpoin, uiBut::dragtype, UI_BUT_DRAGPOIN_FREE, ui_def_but_icon(), WM_DRAG_ASSET, WM_drag_create_asset_data(), and WM_drag_data_free().

Referenced by file_but_enable_drag().

◆ UI_but_drag_set_id()

◆ UI_but_drag_set_image()

void UI_but_drag_set_image ( uiBut * but,
const char * path,
int icon,
const ImBuf * imb,
float scale )

Sets UI_BUT_DRAG_FULL_BUT so the full button can be dragged.

Parameters
pathThe path to drag. The passed string may be destructed, button keeps a copy.

Definition at line 82 of file interface_drag.cc.

References UI_but_drag_attach_image(), UI_but_drag_set_path(), and ui_def_but_icon().

Referenced by file_but_enable_drag().

◆ UI_but_drag_set_name()

void UI_but_drag_set_name ( uiBut * but,
const char * name )

◆ UI_but_drag_set_path()

void UI_but_drag_set_path ( uiBut * but,
const char * path )

Enable dragging a path from this button.

Parameters
pathThe path to drag. The passed string may be destructed, button keeps a copy.

Definition at line 62 of file interface_drag.cc.

References uiBut::dragflag, uiBut::dragpoin, uiBut::dragtype, UI_BUT_DRAGPOIN_FREE, WM_drag_create_path_data(), WM_drag_data_free(), and WM_DRAG_PATH.

Referenced by file_but_enable_drag(), and UI_but_drag_set_image().

◆ UI_but_drag_set_rna()

void UI_but_drag_set_rna ( uiBut * but,
PointerRNA * ptr )

◆ ui_but_drag_start()