Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-11-26 19:47:42 +0300
committerBastien Montagne <bastien@blender.org>2021-11-26 19:49:18 +0300
commit2efc2221cc0d8b48fd8ff40dca5c33f70016d023 (patch)
tree280475b95deede166a0c142c096f328633c3efef /source/blender/blenkernel/intern/blendfile_link_append.c
parent0789f61373de962dce1874b8577a4e54c21e587a (diff)
Fix T93402: Linking Collections instantiate extra sub-collections.
Linking is more relax than appending when it comes to instantiating indirectly linked collections/objects.
Diffstat (limited to 'source/blender/blenkernel/intern/blendfile_link_append.c')
-rw-r--r--source/blender/blenkernel/intern/blendfile_link_append.c7
1 files changed, 6 insertions, 1 deletions
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)) {