[Bf-blender-cvs] [658b254e3eb] master: Cleanup: Keep IDTypeInfo separated from ID type specific API.

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


Commit: 658b254e3eb50141e72ba2ab241a8fa39d73045d
Author: Bastien Montagne
Date:   Wed May 13 19:11:19 2020 +0200
Branches: master
https://developer.blender.org/rB658b254e3eb50141e72ba2ab241a8fa39d73045d

Cleanup: Keep IDTypeInfo separated from ID type specific API.

Also do not define IDTypeInfo callback when default generic code is
enough...

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

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

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

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);



More information about the Bf-blender-cvs mailing list