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:
authorBrecht Van Lommel <brecht@blender.org>2020-03-06 13:51:17 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-03-06 14:19:11 +0300
commite96b1035364122178d5fcec7cf4d4bab7c8cb051 (patch)
tree2aaf2403e276bac6285f5b5788105775e62cb634 /source/blender/blenkernel/intern/world.c
parent297261eb906c56c7decf4401e6a3e06cec1691e8 (diff)
Cleanup: move camera, lights, world to IDTypeInfo
Diffstat (limited to 'source/blender/blenkernel/intern/world.c')
-rw-r--r--source/blender/blenkernel/intern/world.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index f8ba4e3085e..398e53d6cda 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -37,11 +37,14 @@
#include "BKE_animsys.h"
#include "BKE_icons.h"
+#include "BKE_idtype.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_world.h"
+#include "BLT_translation.h"
+
#include "DRW_engine.h"
#include "DEG_depsgraph.h"
@@ -49,11 +52,12 @@
#include "GPU_material.h"
/** Free (or release) any data used by this world (does not free the world itself). */
-void BKE_world_free(World *wrld)
+static void world_free_data(ID *id)
{
- BKE_animdata_free((ID *)wrld, false);
+ World *wrld = (World *)id;
+ BKE_animdata_free(id, false);
- DRW_drawdata_free((ID *)wrld);
+ DRW_drawdata_free(id);
/* is no lib link block, but world extension */
if (wrld->nodetree) {
@@ -68,8 +72,9 @@ void BKE_world_free(World *wrld)
BKE_previewimg_free(&wrld->preview);
}
-void BKE_world_init(World *wrld)
+static void world_init_data(ID *id)
{
+ World *wrld = (World *)id;
BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(wrld, id));
MEMCPY_STRUCT_AFTER(wrld, DNA_struct_default_get(World), id);
@@ -81,7 +86,7 @@ World *BKE_world_add(Main *bmain, const char *name)
wrld = BKE_libblock_alloc(bmain, ID_WO, name, 0);
- BKE_world_init(wrld);
+ world_init_data(&wrld->id);
return wrld;
}
@@ -96,8 +101,10 @@ World *BKE_world_add(Main *bmain, const char *name)
*
* \param flag: Copying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more).
*/
-void BKE_world_copy_data(Main *bmain, World *wrld_dst, const World *wrld_src, const int flag)
+static void world_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
{
+ World *wrld_dst = (World *)id_dst;
+ const World *wrld_src = (const World *)id_src;
/* We always need allocation of our private ID data. */
const int flag_private_id_data = flag & ~LIB_ID_CREATE_NO_ALLOCATE;
@@ -154,11 +161,27 @@ World *BKE_world_localize(World *wrld)
return wrldn;
}
-void BKE_world_make_local(Main *bmain, World *wrld, const int flags)
+static void world_make_local(Main *bmain, ID *id, const int flags)
{
- BKE_lib_id_make_local_generic(bmain, &wrld->id, 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);