Refactor: Move speaker foreach_id to new IDTypeInfo structure.
This commit is contained in:
parent
3a896bb373
commit
58cc5c8573
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue