From 2efc2221cc0d8b48fd8ff40dca5c33f70016d023 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 26 Nov 2021 17:47:42 +0100 Subject: Fix T93402: Linking Collections instantiate extra sub-collections. Linking is more relax than appending when it comes to instantiating indirectly linked collections/objects. --- source/blender/blenkernel/intern/blendfile_link_append.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to '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 c2bf3b4a5f9..a0daa56f53a 100644 --- a/source/blender/blenkernel/intern/blendfile_link_append.c +++ b/source/blender/blenkernel/intern/blendfile_link_append.c @@ -579,6 +579,8 @@ static void loose_data_instantiate_collection_process( ViewLayer *view_layer = lapp_context->params->context.view_layer; const View3D *v3d = lapp_context->params->context.v3d; + const bool do_append = (lapp_context->params->flag & FILE_LINK) == 0; + /* NOTE: For collections we only view_layer-instantiate duplicated collections that have * non-instantiated objects in them. */ LinkNode *itemlink; @@ -601,7 +603,10 @@ static void loose_data_instantiate_collection_process( Collection *collection = (Collection *)id; /* We always add collections directly selected by the user. */ bool do_add_collection = (item->tag & LINK_APPEND_TAG_INDIRECT) == 0; - if (!do_add_collection) { + /* In linking case, we do not enforce instantiating non-directly linked collections/objects. + * This avoids cluttering the ViewLayers, user can instantiate themselves specific collections + * or objects easily from the Outliner if needed. */ + if (!do_add_collection && do_append) { LISTBASE_FOREACH (CollectionObject *, coll_ob, &collection->gobject) { Object *ob = coll_ob->ob; if (!object_in_any_scene(bmain, ob)) { -- cgit v1.2.3