diff options
author | Julian Eisel <julian@blender.org> | 2022-01-17 18:32:00 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-01-17 18:32:50 +0300 |
commit | be8f10a4e2172eb686863998d1a8df904463ab21 (patch) | |
tree | 6d59981d0bc056d0260a63069bac5e3baeb608db /source | |
parent | e3fd0b1d177cb1a17e6ec729b7d695465f67ead8 (diff) |
T94828: Appending collection with instancing links nested collections
See T94828 for details.
Differential Revision: https://developer.blender.org/D13803
Reviewed by: Bastien Montagne
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/blendfile_link_append.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/blendfile_link_append.c b/source/blender/blenkernel/intern/blendfile_link_append.c index 169a410bccc..9b3f4c2fae8 100644 --- a/source/blender/blenkernel/intern/blendfile_link_append.c +++ b/source/blender/blenkernel/intern/blendfile_link_append.c @@ -681,21 +681,25 @@ static void loose_data_instantiate_collection_process( Collection *collection = (Collection *)id; bool do_add_collection = (id->tag & LIB_TAG_DOIT) != 0; + if (!do_add_collection) { + continue; + } /* When instantiated into view-layer, do not add collections if one of their parents is also - * instantiated. In case of empty-instantiation though, instantiation of all user-selected - * collections is the desired behavior. */ - if (!do_add_collection || - (!do_instantiate_as_empty && - loose_data_instantiate_collection_parents_check_recursive(collection))) { + * instantiated. */ + if (!do_instantiate_as_empty && + loose_data_instantiate_collection_parents_check_recursive(collection)) { + continue; + } + /* When instantiated as empty, do not add indirectly linked (i.e. non-user-selected) + * collections. */ + if (do_instantiate_as_empty && (item->tag & LINK_APPEND_TAG_INDIRECT) != 0) { continue; } loose_data_instantiate_ensure_active_collection(instantiate_context); Collection *active_collection = instantiate_context->active_collection; - /* In case user requested instantiation of collections as empties, do so for the one they - * explicitly selected (originally directly linked IDs) only. */ - if (do_instantiate_as_empty && (item->tag & LINK_APPEND_TAG_INDIRECT) == 0) { + if (do_instantiate_as_empty) { /* BKE_object_add(...) messes with the selection. */ Object *ob = BKE_object_add_only_object(bmain, OB_EMPTY, collection->id.name + 2); ob->type = OB_EMPTY; |