[Bf-blender-cvs] [5fd64c014fa] master: Refactor: Move armature foreach_id to new IDTypeInfo structure.

Bastien Montagne noreply at git.blender.org
Tue May 12 19:02:51 CEST 2020


Commit: 5fd64c014fa02b98d650fd6934c0d07a74707c51
Author: Bastien Montagne
Date:   Tue May 12 18:35:33 2020 +0200
Branches: master
https://developer.blender.org/rB5fd64c014fa02b98d650fd6934c0d07a74707c51

Refactor: Move armature foreach_id to new IDTypeInfo structure.

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

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

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

diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index af98992cc01..06a97fc3826 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -61,6 +61,7 @@
 #include "BKE_idtype.h"
 #include "BKE_lattice.h"
 #include "BKE_lib_id.h"
+#include "BKE_lib_query.h"
 #include "BKE_main.h"
 #include "BKE_object.h"
 #include "BKE_scene.h"
@@ -150,6 +151,24 @@ static void armature_free_data(struct ID *id)
   }
 }
 
+static void armature_foreach_id_bone(Bone *bone, LibraryForeachIDData *data)
+{
+  IDP_foreach_property(
+      bone->prop, IDP_TYPE_FILTER_ID, BKE_lib_query_idpropertiesForeachIDLink_callback, data);
+
+  LISTBASE_FOREACH (Bone *, curbone, &bone->childbase) {
+    armature_foreach_id_bone(curbone, data);
+  }
+}
+
+static void armature_foreach_id(ID *id, LibraryForeachIDData *data)
+{
+  bArmature *arm = (bArmature *)id;
+  LISTBASE_FOREACH (Bone *, bone, &arm->bonebase) {
+    armature_foreach_id_bone(bone, data);
+  }
+}
+
 IDTypeInfo IDType_ID_AR = {
     .id_code = ID_AR,
     .id_filter = FILTER_ID_AR,
@@ -164,6 +183,7 @@ IDTypeInfo IDType_ID_AR = {
     .copy_data = armature_copy_data,
     .free_data = armature_free_data,
     .make_local = NULL,
+    .foreach_id = armature_foreach_id,
 };
 
 /* **************** Generic Functions, data level *************** */
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index c2df1d4e7ac..7f28941738c 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -337,18 +337,6 @@ static void library_foreach_paint(LibraryForeachIDData *data, Paint *paint)
   FOREACH_FINALIZE_VOID;
 }
 
-static void library_foreach_bone(LibraryForeachIDData *data, Bone *bone)
-{
-  IDP_foreach_property(
-      bone->prop, IDP_TYPE_FILTER_ID, BKE_lib_query_idpropertiesForeachIDLink_callback, data);
-
-  LISTBASE_FOREACH (Bone *, curbone, &bone->childbase) {
-    library_foreach_bone(data, curbone);
-  }
-
-  FOREACH_FINALIZE_VOID;
-}
-
 static void library_foreach_layer_collection(LibraryForeachIDData *data, ListBase *lb)
 {
   LISTBASE_FOREACH (LayerCollection *, lc, lb) {
@@ -902,11 +890,7 @@ static void library_foreach_ID_link(Main *bmain,
       }
 
       case ID_AR: {
-        bArmature *arm = (bArmature *)id;
-
-        LISTBASE_FOREACH (Bone *, bone, &arm->bonebase) {
-          library_foreach_bone(&data, bone);
-        }
+        BLI_assert(0);
         break;
       }



More information about the Bf-blender-cvs mailing list