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:
Diffstat (limited to 'source/blender/blenkernel/intern/world.c')
-rw-r--r--source/blender/blenkernel/intern/world.c74
1 files changed, 40 insertions, 34 deletions
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 3492a35b242..e3b58e03d93 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -35,10 +35,10 @@
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
-#include "BKE_animsys.h"
#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"
@@ -60,7 +60,7 @@ static void world_free_data(ID *id)
/* is no lib link block, but world extension */
if (wrld->nodetree) {
- ntreeFreeNestedTree(wrld->nodetree);
+ ntreeFreeEmbeddedTree(wrld->nodetree);
MEM_freeN(wrld->nodetree);
wrld->nodetree = NULL;
}
@@ -79,17 +79,6 @@ static void world_init_data(ID *id)
MEMCPY_STRUCT_AFTER(wrld, DNA_struct_default_get(World), id);
}
-World *BKE_world_add(Main *bmain, const char *name)
-{
- World *wrld;
-
- wrld = BKE_libblock_alloc(bmain, ID_WO, name, 0);
-
- world_init_data(&wrld->id);
-
- return wrld;
-}
-
/**
* Only copy internal data of World ID from source
* to already allocated/initialized destination.
@@ -123,6 +112,44 @@ 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,
+ .main_listbase_index = INDEX_ID_WO,
+ .struct_size = sizeof(World),
+ .name = "World",
+ .name_plural = "worlds",
+ .translation_context = BLT_I18NCONTEXT_ID_WORLD,
+ .flags = 0,
+
+ .init_data = world_init_data,
+ .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)
+{
+ World *wrld;
+
+ wrld = BKE_libblock_alloc(bmain, ID_WO, name, 0);
+
+ world_init_data(&wrld->id);
+
+ return wrld;
+}
+
World *BKE_world_copy(Main *bmain, const World *wrld)
{
World *wrld_copy;
@@ -160,27 +187,6 @@ World *BKE_world_localize(World *wrld)
return wrldn;
}
-static void world_make_local(Main *bmain, ID *id, const int flags)
-{
- BKE_lib_id_make_local_generic(bmain, id, flags);
-}
-
-IDTypeInfo IDType_ID_WO = {
- .id_code = ID_WO,
- .id_filter = FILTER_ID_WO,
- .main_listbase_index = INDEX_ID_WO,
- .struct_size = sizeof(World),
- .name = "World",
- .name_plural = "worlds",
- .translation_context = BLT_I18NCONTEXT_ID_WORLD,
- .flags = 0,
-
- .init_data = world_init_data,
- .copy_data = world_copy_data,
- .free_data = world_free_data,
- .make_local = world_make_local,
-};
-
void BKE_world_eval(struct Depsgraph *depsgraph, World *world)
{
DEG_debug_print_eval(depsgraph, __func__, world->id.name, world);