[Bf-blender-cvs] [68f1b2c6719] master: Fix T93757: Do not force-instantiate indrectly linked objects in linking case.

Bastien Montagne noreply at git.blender.org
Tue Dec 21 10:09:26 CET 2021


Commit: 68f1b2c6719ad1bbe52ec4896cecf3b94ad74146
Author: Bastien Montagne
Date:   Tue Dec 21 10:05:39 2021 +0100
Branches: master
https://developer.blender.org/rB68f1b2c6719ad1bbe52ec4896cecf3b94ad74146

Fix T93757: Do not force-instantiate indrectly linked objects in linking case.

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

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 14ed99487d9..23e9e6bfbbb 100644
--- a/source/blender/blenkernel/intern/blendfile_link_append.c
+++ b/source/blender/blenkernel/intern/blendfile_link_append.c
@@ -743,6 +743,8 @@ static void loose_data_instantiate_object_process(LooseDataInstantiateContext *i
    * if you want it do it at the editor level. */
   const bool object_set_active = false;
 
+  const bool is_linking = (lapp_context->params->flag & FILE_LINK) != 0;
+
   /* NOTE: For objects we only view_layer-instantiate duplicated objects that are not yet used
    * anywhere. */
   LinkNode *itemlink;
@@ -753,6 +755,17 @@ static void loose_data_instantiate_object_process(LooseDataInstantiateContext *i
       continue;
     }
 
+    /* In linking case, never instantiate stray objects that are not directly linked.
+     *
+     * While this is not ideal (in theory no object should remain un-owned), in case of indirectly
+     * linked objects, the other solution would be to add them to a local collection, which would
+     * make them directly linked. Think for now keeping them indirectly linked is more important.
+     * Ref. T93757.
+     */
+    if (is_linking && (item->tag & LINK_APPEND_TAG_INDIRECT) != 0) {
+      continue;
+    }
+
     Object *ob = (Object *)id;
 
     if (object_in_any_collection(bmain, ob)) {



More information about the Bf-blender-cvs mailing list