[Bf-blender-cvs] [c0e1bd815bd] master: Cleanup: Keep IDTypeInfo separated from ID type specific API.
Bastien Montagne
noreply at git.blender.org
Wed May 13 19:56:22 CEST 2020
Commit: c0e1bd815bd26d666da9f9b12646cde50a2f98c8
Author: Bastien Montagne
Date: Wed May 13 19:32:45 2020 +0200
Branches: master
https://developer.blender.org/rBc0e1bd815bd26d666da9f9b12646cde50a2f98c8
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/lightprobe.c
===================================================================
diff --git a/source/blender/blenkernel/intern/lightprobe.c b/source/blender/blenkernel/intern/lightprobe.c
index 22f12831aa0..2f24960b5a1 100644
--- a/source/blender/blenkernel/intern/lightprobe.c
+++ b/source/blender/blenkernel/intern/lightprobe.c
@@ -31,6 +31,7 @@
#include "BKE_idtype.h"
#include "BKE_lib_id.h"
+#include "BKE_lib_query.h"
#include "BKE_lightprobe.h"
#include "BKE_main.h"
@@ -44,6 +45,22 @@ static void lightprobe_init_data(ID *id)
MEMCPY_STRUCT_AFTER(probe, DNA_struct_default_get(LightProbe), id);
}
+IDTypeInfo IDType_ID_LP = {
+ .id_code = ID_LP,
+ .id_filter = FILTER_ID_LP,
+ .main_listbase_index = INDEX_ID_LP,
+ .struct_size = sizeof(LightProbe),
+ .name = "LightProbe",
+ .name_plural = "lightprobes",
+ .translation_context = BLT_I18NCONTEXT_ID_LIGHTPROBE,
+ .flags = 0,
+
+ .init_data = lightprobe_init_data,
+ .copy_data = NULL,
+ .free_data = NULL,
+ .make_local = NULL,
+};
+
void BKE_lightprobe_type_set(LightProbe *probe, const short lightprobe_type)
{
probe->type = lightprobe_type;
@@ -79,48 +96,9 @@ void *BKE_lightprobe_add(Main *bmain, const char *name)
return probe;
}
-/**
- * Only copy internal data of #LightProbe ID from source
- * to already allocated/initialized destination.
- * You probably never want to use that directly,
- * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
- *
- * WARNING! This function will not handle ID user count!
- *
- * \param flag: Copying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more).
- */
-static void lightprobe_copy_data(Main *UNUSED(bmain),
- ID *UNUSED(id_dst),
- const ID *UNUSED(id_src),
- const int UNUSED(flag))
-{
- /* Nothing to do here. */
-}
-
LightProbe *BKE_lightprobe_copy(Main *bmain, const LightProbe *probe)
{
LightProbe *probe_copy;
BKE_id_copy(bmain, &probe->id, (ID **)&probe_copy);
return probe_copy;
}
-
-static void lightprobe_make_local(Main *bmain, ID *id, const int flags)
-{
- BKE_lib_id_make_local_generic(bmain, id, flags);
-}
-
-IDTypeInfo IDType_ID_LP = {
- .id_code = ID_LP,
- .id_filter = FILTER_ID_LP,
- .main_listbase_index = INDEX_ID_LP,
- .struct_size = sizeof(LightProbe),
- .name = "LightProbe",
- .name_plural = "lightprobes",
- .translation_context = BLT_I18NCONTEXT_ID_LIGHTPROBE,
- .flags = 0,
-
- .init_data = lightprobe_init_data,
- .copy_data = lightprobe_copy_data,
- .free_data = NULL,
- .make_local = lightprobe_make_local,
-};
More information about the Bf-blender-cvs
mailing list