[Bf-blender-cvs] [e2b87aabb6b] master: Cleanup collection handling in lib_query code.

Bastien Montagne noreply at git.blender.org
Wed May 20 18:43:53 CEST 2020


Commit: e2b87aabb6b62e99e5a62bca948cf86e427eac13
Author: Bastien Montagne
Date:   Wed May 20 18:35:11 2020 +0200
Branches: master
https://developer.blender.org/rBe2b87aabb6b62e99e5a62bca948cf86e427eac13

Cleanup collection handling in lib_query code.

Now we do not need anymore that extra function...

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

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

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

diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index 723bdfb2388..66c04a75db6 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -352,30 +352,6 @@ static void library_foreach_layer_collection(LibraryForeachIDData *data, ListBas
   FOREACH_FINALIZE_VOID;
 }
 
-/* Used by both real Collection data-blocks, and the fake horror of master collection from Scene.
- */
-static void library_foreach_collection(LibraryForeachIDData *data, Collection *collection)
-{
-  LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
-    FOREACH_CALLBACK_INVOKE(data, cob->ob, IDWALK_CB_USER);
-  }
-  LISTBASE_FOREACH (CollectionChild *, child, &collection->children) {
-    FOREACH_CALLBACK_INVOKE(data, child->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_USER);
-  }
-  LISTBASE_FOREACH (CollectionParent *, parent, &collection->parents) {
-    /* XXX This is very weak. The whole idea of keeping pointers to private IDs is very bad
-     * anyway... */
-    const int cb_flag = ((parent->collection != NULL &&
-                          (parent->collection->id.flag & LIB_EMBEDDED_DATA) != 0) ?
-                             IDWALK_CB_EMBEDDED :
-                             IDWALK_CB_NOP);
-    FOREACH_CALLBACK_INVOKE(
-        data, parent->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK | cb_flag);
-  }
-
-  FOREACH_FINALIZE_VOID;
-}
-
 bool BKE_library_foreach_ID_embedded(LibraryForeachIDData *data, ID **id_pp)
 {
   /* Needed e.g. for callbacks handling relationships... This call shall be absolutely readonly. */
@@ -811,7 +787,23 @@ static void library_foreach_ID_link(Main *bmain,
 
       case ID_GR: {
         Collection *collection = (Collection *)id;
-        library_foreach_collection(&data, collection);
+
+        LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
+          FOREACH_CALLBACK_INVOKE(&data, cob->ob, IDWALK_CB_USER);
+        }
+        LISTBASE_FOREACH (CollectionChild *, child, &collection->children) {
+          FOREACH_CALLBACK_INVOKE(&data, child->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_USER);
+        }
+        LISTBASE_FOREACH (CollectionParent *, parent, &collection->parents) {
+          /* XXX This is very weak. The whole idea of keeping pointers to private IDs is very bad
+           * anyway... */
+          const int cb_flag = ((parent->collection != NULL &&
+                                (parent->collection->id.flag & LIB_EMBEDDED_DATA) != 0) ?
+                                   IDWALK_CB_EMBEDDED :
+                                   IDWALK_CB_NOP);
+          FOREACH_CALLBACK_INVOKE(
+              &data, parent->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK | cb_flag);
+        }
         break;
       }



More information about the Bf-blender-cvs mailing list