diff options
author | Bastien Montagne <bastien@blender.org> | 2021-09-29 16:32:53 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-09-29 18:10:42 +0300 |
commit | df9120b365380cc1d64006e0d37a650eaaff9776 (patch) | |
tree | a503aa77796a9ce9eb57495484c0dd8e15a3112a /source/blender/editors/interface/interface.c | |
parent | 6aac892fad9e6447cf7cfdaee5c2e9c61e2e99fe (diff) |
Fix T89864: Adding an asset referencing other objects adds it to scene but only adds data-blocks of referenced objects.
Link/append code needs proper access to scene/view3d data to handle
collections/objects instantiation.
Note that this is a temporary hack more than a proper fix, which would require
a deeper redesign of drag&drop code.
Also note that this will not handle 'properly' (i.e. as user would
expect it) cases like implicitely appended parent objects, in that only
the explicitely appended object will be dropped to the nes location, the
others will remain at their original coordinates.
Differential Revision: https://developer.blender.org/D12696
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r-- | source/blender/editors/interface/interface.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index beee622673c..a98af00572d 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -6224,6 +6224,13 @@ void UI_but_drag_set_asset(uiBut *but, asset_drag->id_type = ED_asset_handle_get_id_type(asset); 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; 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) { |