Fix T70778: Library Override dissabled after re-instancing same collection in differe...
authorBastien Montagne <b.mont29@gmail.com>
Fri, 8 Nov 2019 16:47:48 +0000 (17:47 +0100)
committerBastien Montagne <b.mont29@gmail.com>
Fri, 8 Nov 2019 16:47:48 +0000 (17:47 +0100)
Very stupid mistake in own new generic ID lib_link function, that would try
to link ID pointers for all data-blocks, not only those actually needing it.

source/blender/blenloader/intern/readfile.c

index 452e75081d6b20f016a56911778e85c008338b65..167917f7b6ac6bc164e37ac9541c8dddbfb949c9 100644 (file)
@@ -2618,10 +2618,13 @@ static void lib_link_id(FileData *fd, Main *main)
     ID *id;
 
     for (id = lb->first; id; id = id->next) {
-      if (id->override_library) {
-        id->override_library->reference = newlibadr_us(
-            fd, id->lib, id->override_library->reference);
-        id->override_library->storage = newlibadr_us(fd, id->lib, id->override_library->storage);
+      if (id->tag & LIB_TAG_NEED_LINK) {
+        if (id->override_library) {
+          id->override_library->reference = newlibadr_us(
+              fd, id->lib, id->override_library->reference);
+          id->override_library->storage = newlibadr_us(fd, id->lib, id->override_library->storage);
+        }
+        /* DO NOT clear LIB_TAG_NEED_LINK here, it is used again by per-ID-type linkers. */
       }
     }
   }