diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-03-06 13:51:17 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-03-06 14:19:11 +0300 |
commit | e96b1035364122178d5fcec7cf4d4bab7c8cb051 (patch) | |
tree | 2aaf2403e276bac6285f5b5788105775e62cb634 /source/blender/blenkernel/intern/lightprobe.c | |
parent | 297261eb906c56c7decf4401e6a3e06cec1691e8 (diff) |
Cleanup: move camera, lights, world to IDTypeInfo
Diffstat (limited to 'source/blender/blenkernel/intern/lightprobe.c')
-rw-r--r-- | source/blender/blenkernel/intern/lightprobe.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/lightprobe.c b/source/blender/blenkernel/intern/lightprobe.c index 55e7b90d8cf..f360edfbf54 100644 --- a/source/blender/blenkernel/intern/lightprobe.c +++ b/source/blender/blenkernel/intern/lightprobe.c @@ -30,12 +30,16 @@ #include "BLI_utildefines.h" #include "BKE_animsys.h" +#include "BKE_idtype.h" #include "BKE_lib_id.h" #include "BKE_lightprobe.h" #include "BKE_main.h" -void BKE_lightprobe_init(LightProbe *probe) +#include "BLT_translation.h" + +static void lightprobe_init_data(ID *id) { + LightProbe *probe = (LightProbe *)id; BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(probe, id)); MEMCPY_STRUCT_AFTER(probe, DNA_struct_default_get(LightProbe), id); @@ -71,7 +75,7 @@ void *BKE_lightprobe_add(Main *bmain, const char *name) probe = BKE_libblock_alloc(bmain, ID_LP, name, 0); - BKE_lightprobe_init(probe); + lightprobe_init_data(&probe->id); return probe; } @@ -86,10 +90,10 @@ void *BKE_lightprobe_add(Main *bmain, const char *name) * * \param flag: Copying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more). */ -void BKE_lightprobe_copy_data(Main *UNUSED(bmain), - LightProbe *UNUSED(probe_dst), - const LightProbe *UNUSED(probe_src), - const int UNUSED(flag)) +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. */ } @@ -101,12 +105,28 @@ LightProbe *BKE_lightprobe_copy(Main *bmain, const LightProbe *probe) return probe_copy; } -void BKE_lightprobe_make_local(Main *bmain, LightProbe *probe, const int flags) +static void lightprobe_make_local(Main *bmain, ID *id, const int flags) { - BKE_lib_id_make_local_generic(bmain, &probe->id, flags); + BKE_lib_id_make_local_generic(bmain, id, flags); } -void BKE_lightprobe_free(LightProbe *probe) +static void lightprobe_free_data(ID *id) { - BKE_animdata_free((ID *)probe, false); + BKE_animdata_free(id, false); } + +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 = lightprobe_free_data, + .make_local = lightprobe_make_local, +}; |