diff options
author | Bastien Montagne <bastien@blender.org> | 2020-05-13 20:30:04 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-05-13 20:30:04 +0300 |
commit | 58cc5c857347f1ba8eb271e543f898605d50d56d (patch) | |
tree | b4472e6d80a0ad979bf33ee2dd3a1d014bebde6e /source/blender/blenkernel | |
parent | 3a896bb3732ef245ee5789da15b36cfbbafbaeec (diff) |
Refactor: Move speaker foreach_id to new IDTypeInfo structure.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/lib_query.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/speaker.c | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c index 8100c42f261..df4f4009aeb 100644 --- a/source/blender/blenkernel/intern/lib_query.c +++ b/source/blender/blenkernel/intern/lib_query.c @@ -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; } diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index 980cc2a59fd..1f778f5fcd6 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -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) |