[Bf-blender-cvs] [3a896bb3732] master: Refactor: Move world foreach_id to new IDTypeInfo structure.

Bastien Montagne noreply at git.blender.org
Wed May 13 19:56:22 CEST 2020


Commit: 3a896bb3732ef245ee5789da15b36cfbbafbaeec
Author: Bastien Montagne
Date:   Wed May 13 19:22:46 2020 +0200
Branches: master
https://developer.blender.org/rB3a896bb3732ef245ee5789da15b36cfbbafbaeec

Refactor: Move world foreach_id to new IDTypeInfo structure.

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

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

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

diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index 578f59fb027..8100c42f261 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -934,16 +934,11 @@ static void library_foreach_ID_link(Main *bmain,
       }
 
       case ID_KE: {
-        BLI_assert(0);
         break;
       }
 
       case ID_WO: {
-        World *world = (World *)id;
-        if (world->nodetree) {
-          /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
-          BKE_library_foreach_ID_embedded(&data, (ID **)&world->nodetree);
-        }
+        BLI_assert(0);
         break;
       }
 
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 5be74f34338..e3b58e03d93 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -38,6 +38,7 @@
 #include "BKE_icons.h"
 #include "BKE_idtype.h"
 #include "BKE_lib_id.h"
+#include "BKE_lib_query.h"
 #include "BKE_main.h"
 #include "BKE_node.h"
 #include "BKE_world.h"
@@ -111,6 +112,16 @@ static void world_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
   }
 }
 
+static void world_foreach_id(ID *id, LibraryForeachIDData *data)
+{
+  World *world = (World *)id;
+
+  if (world->nodetree) {
+    /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
+    BKE_library_foreach_ID_embedded(data, (ID **)&world->nodetree);
+  }
+}
+
 IDTypeInfo IDType_ID_WO = {
     .id_code = ID_WO,
     .id_filter = FILTER_ID_WO,
@@ -125,6 +136,7 @@ IDTypeInfo IDType_ID_WO = {
     .copy_data = world_copy_data,
     .free_data = world_free_data,
     .make_local = NULL,
+    .foreach_id = world_foreach_id,
 };
 
 World *BKE_world_add(Main *bmain, const char *name)



More information about the Bf-blender-cvs mailing list