Commit: be8f10a4e2172eb686863998d1a8df904463ab21
Author: Julian Eisel
Date:   Mon Jan 17 16:32:00 2022 +0100
Branches: master
https://developer.blender.org/rBbe8f10a4e2172eb686863998d1a8df904463ab21

T94828: Appending collection with instancing links nested collections

See T94828 for details.

Differential Revision: https://developer.blender.org/D13803

Reviewed by: Bastien Montagne

===================================================================

M       source/blender/blenkernel/intern/blendfile_link_append.c

===================================================================

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;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to