[Bf-blender-cvs] [9996688b716] master: Refactor: Move library foreach_id to new IDTypeInfo structure.

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


Commit: 9996688b71678a0ea9e98027d6cc3ed4c308959d
Author: Bastien Montagne
Date:   Tue May 12 18:20:49 2020 +0200
Branches: master
https://developer.blender.org/rB9996688b71678a0ea9e98027d6cc3ed4c308959d

Refactor: Move library foreach_id to new IDTypeInfo structure.

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

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

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

diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index 754a1831edd..c2df1d4e7ac 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -676,8 +676,7 @@ static void library_foreach_ID_link(Main *bmain,
 
     switch ((ID_Type)GS(id->name)) {
       case ID_LI: {
-        Library *lib = (Library *)id;
-        CALLBACK_INVOKE(lib->parent, IDWALK_CB_NEVER_SELF);
+        BLI_assert(0);
         break;
       }
       case ID_SCE: {
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index e3ed21aa536..64ffea22363 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -38,6 +38,7 @@
 
 #include "BKE_idtype.h"
 #include "BKE_lib_id.h"
+#include "BKE_lib_query.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_packedFile.h"
@@ -53,6 +54,12 @@ static void library_free_data(ID *id)
   }
 }
 
+static void library_foreach_id(ID *id, LibraryForeachIDData *data)
+{
+  Library *lib = (Library *)id;
+  BKE_LIB_FOREACHID_PROCESS(data, lib->parent, IDWALK_CB_NEVER_SELF);
+}
+
 IDTypeInfo IDType_ID_LI = {
     .id_code = ID_LI,
     .id_filter = 0,
@@ -67,6 +74,7 @@ IDTypeInfo IDType_ID_LI = {
     .copy_data = NULL,
     .free_data = library_free_data,
     .make_local = NULL,
+    .foreach_id = library_foreach_id,
 };
 
 void BKE_library_filepath_set(Main *bmain, Library *lib, const char *filepath)



More information about the Bf-blender-cvs mailing list