Commit: 93d2940603121acc47ea9860dac98e4e63c8f1d3
Author: Bastien Montagne
Date:   Thu Sep 9 11:46:28 2021 +0200
Branches: master
https://developer.blender.org/rB93d2940603121acc47ea9860dac98e4e63c8f1d3

Link/Append: Fix unreported obdata being instantiated even when already used by 
linked/appended data.

Do not instantiate obdata when it is not actually loose.

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

M       source/blender/blenloader/intern/readfile.c

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

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 9704e8bb413..15653264211 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4561,6 +4561,17 @@ static void add_loose_object_data_to_scene(Main *mainvar,
     active_collection = lc->collection;
   }
 
+  /* Do not re-instantiate obdata IDs that are already instantiated by an 
object. */
+  LISTBASE_FOREACH (Object *, ob, &mainvar->objects) {
+    if ((ob->id.tag & LIB_TAG_PRE_EXISTING) == 0 && ob->data != NULL) {
+      ID *obdata = ob->data;
+      BLI_assert(ID_REAL_USERS(obdata) > 0);
+      if ((obdata->tag & LIB_TAG_PRE_EXISTING) == 0) {
+        obdata->tag &= ~LIB_TAG_DOIT;
+      }
+    }
+  }
+
   /* Loop over all ID types, instancing object-data for ID types that have 
support for it. */
   ListBase *lbarray[INDEX_ID_MAX];
   int i = set_listbasepointers(mainvar, lbarray);

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

Reply via email to