[Bf-blender-cvs] [25e774422c0] blender-v2.83-release: Cleanup: ID management: Light ID type.

Bastien Montagne noreply at git.blender.org
Mon Apr 20 11:20:12 CEST 2020


Commit: 25e774422c00fe708475671f4a4a89a0c696d105
Author: Bastien Montagne
Date:   Mon Apr 20 11:18:20 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB25e774422c00fe708475671f4a4a89a0c696d105

Cleanup: ID management: Light ID type.

Keep IDType code at head of each ID file, instead of mixing it with more
specific API. Also do not define callbacks when defautl generic handling
is fine.

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

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

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

diff --git a/source/blender/blenkernel/intern/light.c b/source/blender/blenkernel/intern/light.c
index 3ecd1c81b27..3d0503b2e70 100644
--- a/source/blender/blenkernel/intern/light.c
+++ b/source/blender/blenkernel/intern/light.c
@@ -58,17 +58,6 @@ static void light_init_data(ID *id)
   BKE_curvemapping_initialize(la->curfalloff);
 }
 
-Light *BKE_light_add(Main *bmain, const char *name)
-{
-  Light *la;
-
-  la = BKE_libblock_alloc(bmain, ID_LA, name, 0);
-
-  light_init_data(&la->id);
-
-  return la;
-}
-
 /**
  * Only copy internal data of Light ID from source
  * to already allocated/initialized destination.
@@ -100,6 +89,51 @@ static void light_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
   }
 }
 
+static void light_free_data(ID *id)
+{
+  Light *la = (Light *)id;
+
+  BKE_curvemapping_free(la->curfalloff);
+
+  /* is no lib link block, but light extension */
+  if (la->nodetree) {
+    ntreeFreeNestedTree(la->nodetree);
+    MEM_freeN(la->nodetree);
+    la->nodetree = NULL;
+  }
+
+  BKE_previewimg_free(&la->preview);
+  BKE_icon_id_delete(&la->id);
+  la->id.icon_id = 0;
+}
+
+IDTypeInfo IDType_ID_LA = {
+    .id_code = ID_LA,
+    .id_filter = FILTER_ID_LA,
+    .main_listbase_index = INDEX_ID_LA,
+    .struct_size = sizeof(Light),
+    .name = "Light",
+    .name_plural = "lights",
+    .translation_context = BLT_I18NCONTEXT_ID_LIGHT,
+    .flags = 0,
+
+    .init_data = light_init_data,
+    .copy_data = light_copy_data,
+    .free_data = light_free_data,
+    .make_local = NULL,
+};
+
+Light *BKE_light_add(Main *bmain, const char *name)
+{
+  Light *la;
+
+  la = BKE_libblock_alloc(bmain, ID_LA, name, 0);
+
+  light_init_data(&la->id);
+
+  return la;
+}
+
 Light *BKE_light_copy(Main *bmain, const Light *la)
 {
   Light *la_copy;
@@ -133,42 +167,3 @@ Light *BKE_light_localize(Light *la)
 
   return lan;
 }
-
-static void light_make_local(Main *bmain, ID *id, const int flags)
-{
-  BKE_lib_id_make_local_generic(bmain, id, flags);
-}
-
-static void light_free_data(ID *id)
-{
-  Light *la = (Light *)id;
-
-  BKE_curvemapping_free(la->curfalloff);
-
-  /* is no lib link block, but light extension */
-  if (la->nodetree) {
-    ntreeFreeNestedTree(la->nodetree);
-    MEM_freeN(la->nodetree);
-    la->nodetree = NULL;
-  }
-
-  BKE_previewimg_free(&la->preview);
-  BKE_icon_id_delete(&la->id);
-  la->id.icon_id = 0;
-}
-
-IDTypeInfo IDType_ID_LA = {
-    .id_code = ID_LA,
-    .id_filter = FILTER_ID_LA,
-    .main_listbase_index = INDEX_ID_LA,
-    .struct_size = sizeof(Light),
-    .name = "Light",
-    .name_plural = "lights",
-    .translation_context = BLT_I18NCONTEXT_ID_LIGHT,
-    .flags = 0,
-
-    .init_data = light_init_data,
-    .copy_data = light_copy_data,
-    .free_data = light_free_data,
-    .make_local = light_make_local,
-};



More information about the Bf-blender-cvs mailing list