diff options
Diffstat (limited to 'source/blender/blenkernel/intern/lightprobe.c')
-rw-r--r-- | source/blender/blenkernel/intern/lightprobe.c | 66 |
1 files changed, 27 insertions, 39 deletions
diff --git a/source/blender/blenkernel/intern/lightprobe.c b/source/blender/blenkernel/intern/lightprobe.c index 22f12831aa0..f73df66b43d 100644 --- a/source/blender/blenkernel/intern/lightprobe.c +++ b/source/blender/blenkernel/intern/lightprobe.c @@ -23,6 +23,7 @@ #include <string.h> +#include "DNA_collection_types.h" #include "DNA_defaults.h" #include "DNA_lightprobe_types.h" #include "DNA_object_types.h" @@ -31,6 +32,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 +46,31 @@ static void lightprobe_init_data(ID *id) MEMCPY_STRUCT_AFTER(probe, DNA_struct_default_get(LightProbe), id); } +static void lightprobe_foreach_id(ID *id, LibraryForeachIDData *data) +{ + LightProbe *probe = (LightProbe *)id; + + BKE_LIB_FOREACHID_PROCESS(data, probe->image, IDWALK_CB_USER); + BKE_LIB_FOREACHID_PROCESS(data, probe->visibility_grp, IDWALK_CB_NOP); +} + +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, + .foreach_id = lightprobe_foreach_id, +}; + void BKE_lightprobe_type_set(LightProbe *probe, const short lightprobe_type) { probe->type = lightprobe_type; @@ -79,48 +106,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, -}; |