Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2020-05-13 20:22:46 +0300
committerBastien Montagne <bastien@blender.org>2020-05-13 20:22:46 +0300
commit3a896bb3732ef245ee5789da15b36cfbbafbaeec (patch)
tree08afa7ce1ae2114b749660c3c2bdb0a3b2f56a43
parent658b254e3eb50141e72ba2ab241a8fa39d73045d (diff)
Refactor: Move world foreach_id to new IDTypeInfo structure.
-rw-r--r--source/blender/blenkernel/intern/lib_query.c7
-rw-r--r--source/blender/blenkernel/intern/world.c12
2 files changed, 13 insertions, 6 deletions
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)