Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface.c
| Show First 20 Lines • Show All 6,218 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| wmDragAsset *asset_drag = MEM_mallocN(sizeof(*asset_drag), "wmDragAsset"); | wmDragAsset *asset_drag = MEM_mallocN(sizeof(*asset_drag), "wmDragAsset"); | ||||
| BLI_strncpy(asset_drag->name, ED_asset_handle_get_name(asset), sizeof(asset_drag->name)); | BLI_strncpy(asset_drag->name, ED_asset_handle_get_name(asset), sizeof(asset_drag->name)); | ||||
| asset_drag->path = path; | asset_drag->path = path; | ||||
| asset_drag->id_type = ED_asset_handle_get_id_type(asset); | asset_drag->id_type = ED_asset_handle_get_id_type(asset); | ||||
| asset_drag->import_type = import_type; | asset_drag->import_type = import_type; | ||||
| /* FIXME: This is temporary evil solution to get scene/viewlayer/etc in the copy callback of the | |||||
| * #wmDropBox. | |||||
| * TODO: Handle link/append in operator called at the end of the drop process, and NOT in its | |||||
| * copy callback. | |||||
| * */ | |||||
| asset_drag->evil_C = but->block->evil_C; | |||||
| 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,039 Lines • Show Last 20 Lines | |||||