Fix #126568: add dropped asset collection to active collection #126648
@ -2065,7 +2065,7 @@ static int collection_drop_exec(bContext *C, wmOperator *op)
|
||||
ob->transflag |= OB_DUPLICOLLECTION;
|
||||
id_us_plus(&add_info->collection->id);
|
||||
}
|
||||
else {
|
||||
else if (ID_IS_EDITABLE(&add_info->collection->id)) {
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
float delta_mat[4][4];
|
||||
unit_m4(delta_mat);
|
||||
|
@ -842,6 +842,7 @@ static void view3d_collection_drop_copy_external_asset(bContext *C, wmDrag *drag
|
||||
{
|
||||
BLI_assert(drag->type == WM_DRAG_ASSET);
|
||||
|
||||
Main *bmain = CTX_data_main(C);
|
||||
wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
@ -851,6 +852,11 @@ static void view3d_collection_drop_copy_external_asset(bContext *C, wmDrag *drag
|
||||
ID *id = WM_drag_asset_id_import(C, asset_drag, FILE_AUTOSELECT);
|
||||
Collection *collection = (Collection *)id;
|
||||
|
||||
BKE_view_layer_synced_ensure(scene, view_layer);
|
||||
Collection *old_active_collection = BKE_view_layer_active_collection_get(view_layer)->collection;
|
||||
BKE_collection_child_add(bmain, old_active_collection, collection);
|
||||
DEG_id_tag_update(&old_active_collection->id, ID_RECALC_SYNC_TO_EVAL);
|
||||
|
||||
/* TODO(sergey): Only update relations for the current scene. */
|
||||
DEG_relations_tag_update(CTX_data_main(C));
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
|
||||
|
Loading…
Reference in New Issue
Block a user