Refactor: Move lightprobe foreach_id to new IDTypeInfo structure.

This commit is contained in:
Bastien Montagne 2020-05-13 19:39:47 +02:00
parent c0e1bd815b
commit e4890fa564
2 changed files with 11 additions and 3 deletions

View File

@ -948,9 +948,7 @@ static void library_foreach_ID_link(Main *bmain,
}
case ID_LP: {
LightProbe *probe = (LightProbe *)id;
CALLBACK_INVOKE(probe->image, IDWALK_CB_USER);
CALLBACK_INVOKE(probe->visibility_grp, IDWALK_CB_NOP);
BLI_assert(0);
break;
}

View File

@ -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"
@ -45,6 +46,14 @@ 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,
@ -59,6 +68,7 @@ IDTypeInfo IDType_ID_LP = {
.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)