Commit: ae7db53744845897154c9d2b54390850d3615093
Author: Bastien Montagne
Date:   Tue Jul 30 13:04:00 2019 +0200
Branches: master
https://developer.blender.org/rBae7db53744845897154c9d2b54390850d3615093

Fix T66629: Library override - fails when armature and mesh are in separate 
collections.

Some ugly very low-level collection code was using the generic
LIB_TAG_DOIT tag... should never happen, that one is for rather
high-level code to use, core process shall use own tags.

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

M       source/blender/blenkernel/intern/collection.c
M       source/blender/blenloader/intern/readfile.c
M       source/blender/makesdna/DNA_collection_types.h

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

diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index 965f6e4bc51..25f2797915a 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -1100,7 +1100,7 @@ void BKE_collection_parent_relations_rebuild(Collection 
*collection)
 static void collection_parents_rebuild_recursive(Collection *collection)
 {
   BKE_collection_parent_relations_rebuild(collection);
-  collection->id.tag &= ~LIB_TAG_DOIT;
+  collection->tag &= ~COLLECTION_TAG_RELATION_REBUILD;
 
   for (CollectionChild *child = collection->children.first; child != NULL; 
child = child->next) {
     collection_parents_rebuild_recursive(child->collection);
@@ -1109,8 +1109,6 @@ static void 
collection_parents_rebuild_recursive(Collection *collection)
 
 /**
  * Rebuild parent relationships from child ones, for all collections in given 
\a bmain.
- *
- * \note Uses LIB_TAG_DOIT internally...
  */
 void BKE_main_collections_parent_relations_rebuild(Main *bmain)
 {
@@ -1119,7 +1117,7 @@ void BKE_main_collections_parent_relations_rebuild(Main 
*bmain)
        collection = collection->id.next) {
     BLI_freelistN(&collection->parents);
 
-    collection->id.tag |= LIB_TAG_DOIT;
+    collection->tag |= COLLECTION_TAG_RELATION_REBUILD;
   }
 
   /* Scene's master collections will be 'root' parent of most of our 
collections, so start with
@@ -1132,7 +1130,7 @@ void BKE_main_collections_parent_relations_rebuild(Main 
*bmain)
    * lib_link_collection_data() seems to assume that, so do the same here. */
   for (Collection *collection = bmain->collections.first; collection != NULL;
        collection = collection->id.next) {
-    if (collection->id.tag & LIB_TAG_DOIT) {
+    if (collection->tag & COLLECTION_TAG_RELATION_REBUILD) {
       /* Note: we do not have easy access to 'which collections is root' info 
in that case, which
        * means test for cycles in collection relationships may fail here. I 
don't think that is an
        * issue in practice here, but worth keeping in mind... */
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index acca42b6562..88d878ac019 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6220,6 +6220,7 @@ static void direct_link_collection(FileData *fd, 
Collection *collection)
   collection->preview = direct_link_preview_image(fd, collection->preview);
 
   collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE;
+  collection->tag = 0;
   BLI_listbase_clear(&collection->object_cache);
   BLI_listbase_clear(&collection->parents);
 
diff --git a/source/blender/makesdna/DNA_collection_types.h 
b/source/blender/makesdna/DNA_collection_types.h
index c7f3ef4156d..af543864536 100644
--- a/source/blender/makesdna/DNA_collection_types.h
+++ b/source/blender/makesdna/DNA_collection_types.h
@@ -57,7 +57,9 @@ typedef struct Collection {
   float instance_offset[3];
 
   short flag;
-  char _pad[6];
+  /* Runtime-only, always cleared on file load. */
+  short tag;
+  char _pad[4];
 
   /* Runtime. Cache of objects in this collection and all its
    * children. This is created on demand when e.g. some physics
@@ -84,4 +86,12 @@ enum {
   COLLECTION_IS_MASTER = (1 << 5),           /* Is master collection embedded 
in the scene. */
 };
 
+/* Collection->tag */
+enum {
+  /* That code (BKE_main_collections_parent_relations_rebuild and the like)
+   * is called from very low-level places, like e.g ID remapping...
+   * Using a generic tag like LIB_TAG_DOIT for this is just impossible, we 
need our very own. */
+  COLLECTION_TAG_RELATION_REBUILD = (1 << 0),
+};
+
 #endif /* __DNA_COLLECTION_TYPES_H__ */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to