[Bf-blender-cvs] [4e92be6d720] master: LibOverride: Verious minor cleanups and fixes to code tagging IDs in an override hierarchy.

Bastien Montagne noreply at git.blender.org
Tue Feb 9 16:52:58 CET 2021


Commit: 4e92be6d720162c1463d8bcc41a9474e9a10f1ff
Author: Bastien Montagne
Date:   Tue Feb 9 16:31:09 2021 +0100
Branches: master
https://developer.blender.org/rB4e92be6d720162c1463d8bcc41a9474e9a10f1ff

LibOverride: Verious minor cleanups and fixes to code tagging IDs in an override hierarchy.

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

M	source/blender/blenkernel/intern/lib_override.c

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

diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 576fac8a641..f3f524cf9ad 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -369,9 +369,10 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain)
 }
 
 /* Tag all IDs in dependency relationships within an override hierarchy/group.
+ *
+ * Requires existing `Main.relations`.
  *
  * Note: this is typically called to complete `lib_override_linked_group_tag()`.
- * Note: BMain's relations mapping won't be valid anymore after that call.
  */
 static bool lib_override_hierarchy_dependencies_recursive_tag(Main *bmain,
                                                               ID *id,
@@ -463,6 +464,8 @@ static int lib_override_linked_group_tag_cb(LibraryIDLinkCallbackData *cb_data)
 }
 
 /* This will tag at least all 'boundary' linked IDs for a potential override group.
+ *
+ * Requires existing `Main.relations`.
  *
  * Note that you will then need to call #lib_override_hierarchy_dependencies_recursive_tag to
  * complete tagging of all dependencies within the override group.
@@ -470,13 +473,11 @@ static int lib_override_linked_group_tag_cb(LibraryIDLinkCallbackData *cb_data)
  * We currently only consider Collections and Objects (that are not used as bone shapes) as valid
  * boundary IDs to define an override group.
  */
-static void lib_override_linked_group_tag(
-    Main *bmain, ID *id, const uint tag, const uint missing_tag, const bool create_bmain_relations)
+static void lib_override_linked_group_tag(Main *bmain,
+                                          ID *id,
+                                          const uint tag,
+                                          const uint missing_tag)
 {
-  if (create_bmain_relations) {
-    BKE_main_relations_create(bmain, 0);
-  }
-
   if ((id->tag & LIB_TAG_MISSING)) {
     id->tag |= missing_tag;
   }
@@ -502,10 +503,6 @@ static void lib_override_linked_group_tag(
       }
     }
   }
-
-  if (create_bmain_relations) {
-    BKE_main_relations_free(bmain);
-  }
 }
 
 static int lib_override_local_group_tag_cb(LibraryIDLinkCallbackData *cb_data)
@@ -564,14 +561,7 @@ static int lib_override_local_group_tag_cb(LibraryIDLinkCallbackData *cb_data)
   return IDWALK_RET_NOP;
 }
 
-/* This will tag at least all 'boundary' linked IDs for a potential override group.
- *
- * Note that you will then need to call #lib_override_hierarchy_dependencies_recursive_tag to
- * complete tagging of all dependencies within the override group.
- *
- * We currently only consider Collections and Objects (that are not used as bone shapes) as valid
- * boundary IDs to define an override group.
- */
+/* This will tag all override IDs of an override group defined by the given `id_root`. */
 static void lib_override_local_group_tag(Main *bmain,
                                          ID *id,
                                          const uint tag,
@@ -589,7 +579,7 @@ static bool lib_override_library_create_do(Main *bmain, ID *id_root)
 {
   BKE_main_relations_create(bmain, 0);
 
-  lib_override_linked_group_tag(bmain, id_root, LIB_TAG_DOIT, LIB_TAG_MISSING, false);
+  lib_override_linked_group_tag(bmain, id_root, LIB_TAG_DOIT, LIB_TAG_MISSING);
   lib_override_hierarchy_dependencies_recursive_tag(bmain, id_root, LIB_TAG_DOIT, LIB_TAG_MISSING);
 
   BKE_main_relations_free(bmain);
@@ -791,7 +781,7 @@ bool BKE_lib_override_library_resync(Main *bmain, Scene *scene, ViewLayer *view_
 
   lib_override_local_group_tag(bmain, id_root, LIB_TAG_DOIT, LIB_TAG_MISSING);
 
-  lib_override_linked_group_tag(bmain, id_root_reference, LIB_TAG_DOIT, LIB_TAG_MISSING, false);
+  lib_override_linked_group_tag(bmain, id_root_reference, LIB_TAG_DOIT, LIB_TAG_MISSING);
 
   lib_override_hierarchy_dependencies_recursive_tag(
       bmain, id_root_reference, LIB_TAG_DOIT, LIB_TAG_MISSING);



More information about the Bf-blender-cvs mailing list