diff options
author | Bastien Montagne <bastien@blender.org> | 2020-05-13 20:11:19 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-05-13 20:11:19 +0300 |
commit | 658b254e3eb50141e72ba2ab241a8fa39d73045d (patch) | |
tree | 78cedd3f8e0e439eee40a742a9447db465d16736 /source/blender/blenkernel/intern/world.c | |
parent | 73f38f8db0807e12413dcb133e4139f9ffbc0dad (diff) |
Cleanup: Keep IDTypeInfo separated from ID type specific API.
Also do not define IDTypeInfo callback when default generic code is
enough...
Diffstat (limited to 'source/blender/blenkernel/intern/world.c')
-rw-r--r-- | source/blender/blenkernel/intern/world.c | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 3be62750673..5be74f34338 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -78,17 +78,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. @@ -122,6 +111,33 @@ static void world_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int } } +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, +}; + +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; @@ -159,27 +175,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); |