Refactor: Move speaker foreach_id to new IDTypeInfo structure.

This commit is contained in:
Bastien Montagne 2020-05-13 19:30:04 +02:00
parent 3a896bb373
commit 58cc5c8573
2 changed files with 10 additions and 2 deletions

View File

@ -943,8 +943,7 @@ static void library_foreach_ID_link(Main *bmain,
}
case ID_SPK: {
Speaker *speaker = (Speaker *)id;
CALLBACK_INVOKE(speaker->sound, IDWALK_CB_USER);
BLI_assert(0);
break;
}

View File

@ -30,6 +30,7 @@
#include "BKE_idtype.h"
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_speaker.h"
@ -42,6 +43,13 @@ static void speaker_init_data(ID *id)
MEMCPY_STRUCT_AFTER(speaker, DNA_struct_default_get(Speaker), id);
}
static void speaker_foreach_id(ID *id, LibraryForeachIDData *data)
{
Speaker *speaker = (Speaker *)id;
BKE_LIB_FOREACHID_PROCESS(data, speaker->sound, IDWALK_CB_USER);
}
IDTypeInfo IDType_ID_SPK = {
.id_code = ID_SPK,
.id_filter = FILTER_ID_SPK,
@ -56,6 +64,7 @@ IDTypeInfo IDType_ID_SPK = {
.copy_data = NULL,
.free_data = NULL,
.make_local = NULL,
.foreach_id = speaker_foreach_id,
};
void *BKE_speaker_add(Main *bmain, const char *name)