Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface.c
| Show First 20 Lines • Show All 6,273 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** | /** | ||||
| * \param asset: May be passed from a temporary variable, drag data only stores a copy of this. | * \param asset: May be passed from a temporary variable, drag data only stores a copy of this. | ||||
| */ | */ | ||||
| void UI_but_drag_set_asset(uiBut *but, | void UI_but_drag_set_asset(uiBut *but, | ||||
| const AssetHandle *asset, | const AssetHandle *asset, | ||||
| const char *path, | const char *path, | ||||
| struct AssetMetaData *metadata, | |||||
| int import_type, | int import_type, | ||||
| int icon, | int icon, | ||||
| struct ImBuf *imb, | struct ImBuf *imb, | ||||
| float scale) | float scale) | ||||
| { | { | ||||
| wmDragAsset *asset_drag = WM_drag_create_asset_data(asset, path, import_type); | wmDragAsset *asset_drag = WM_drag_create_asset_data(asset, path, import_type); | ||||
| /* FIXME: This is temporary evil solution to get scene/viewlayer/etc in the copy callback of the | /* FIXME: This is temporary evil solution to get scene/viewlayer/etc in the copy callback of the | ||||
| * #wmDropBox. | * #wmDropBox. | ||||
| * TODO: Handle link/append in operator called at the end of the drop process, and NOT in its | * TODO: Handle link/append in operator called at the end of the drop process, and NOT in its | ||||
| * copy callback. | * copy callback. | ||||
| * */ | * */ | ||||
| asset_drag->evil_C = but->block->evil_C; | asset_drag->evil_C = but->block->evil_C; | ||||
| BLI_strncpy(asset_drag->name, ED_asset_handle_get_name(asset), sizeof(asset_drag->name)); | |||||
| asset_drag->metadata = metadata; | |||||
| asset_drag->path = path; | |||||
| asset_drag->id_type = ED_asset_handle_get_id_type(asset); | |||||
| asset_drag->import_type = import_type; | |||||
| but->dragtype = WM_DRAG_ASSET; | but->dragtype = WM_DRAG_ASSET; | ||||
| ui_def_but_icon(but, icon, 0); /* no flag UI_HAS_ICON, so icon doesn't draw in button */ | ui_def_but_icon(but, icon, 0); /* no flag UI_HAS_ICON, so icon doesn't draw in button */ | ||||
| if (but->dragflag & UI_BUT_DRAGPOIN_FREE) { | if (but->dragflag & UI_BUT_DRAGPOIN_FREE) { | ||||
| WM_drag_data_free(but->dragtype, but->dragpoin); | WM_drag_data_free(but->dragtype, but->dragpoin); | ||||
| } | } | ||||
| but->dragpoin = asset_drag; | but->dragpoin = asset_drag; | ||||
| but->dragflag |= UI_BUT_DRAGPOIN_FREE; | but->dragflag |= UI_BUT_DRAGPOIN_FREE; | ||||
| but->imb = imb; | but->imb = imb; | ||||
| ▲ Show 20 Lines • Show All 1,075 Lines • Show Last 20 Lines | |||||