From d4a5691d0fd5be0517968a95ebbe84778fb82b3a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 7 Jun 2019 10:58:51 +0200 Subject: Sound: Use dependency graph instead of bmain Allows to move scene sound update to dependency graph evaluation. --- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenkernel/intern/sound.c | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 9fcbf209cba..350b046e54d 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1527,7 +1527,7 @@ static void scene_update_sound(Depsgraph *depsgraph, Main *bmain) if (recalc & ID_RECALC_AUDIO_LISTENER) { BKE_sound_update_scene_listener(scene); } - BKE_sound_update_scene(bmain, scene); + BKE_sound_update_scene(depsgraph, scene); } /* TODO(sergey): This actually should become view_layer_graph or so. diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 13aedf60cd0..eeef658c064 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -57,6 +57,7 @@ #include "BKE_scene.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #ifdef WITH_AUDASPACE /* evil globals ;-) */ @@ -940,12 +941,6 @@ static void sound_update_base(Scene *scene, Base *base, void *new_set) sound_verify_evaluated_id(&scene->id); sound_verify_evaluated_id(&ob->id); - // TODO(sergey): Bring the test back, or make it a part of dependency graph update. - // if ((ob->id.tag & LIB_TAG_DOIT) == 0) { - // return; - // } - // ob->id.tag &= ~LIB_TAG_DOIT; - if ((ob->type != OB_SPEAKER) || !ob->adt) { return; } @@ -1005,7 +1000,7 @@ static void sound_update_base(Scene *scene, Base *base, void *new_set) } } -void BKE_sound_update_scene(Main *bmain, Scene *scene) +void BKE_sound_update_scene(Depsgraph *depsgraph, Scene *scene) { sound_verify_evaluated_id(&scene->id); @@ -1017,10 +1012,7 @@ void BKE_sound_update_scene(Main *bmain, Scene *scene) float quat[4]; /* cheap test to skip looping over all objects (no speakers is a common case) */ - if (!BLI_listbase_is_empty(&bmain->speakers)) { - // TODO(sergey): Bring the test back, or make it a part of dependency graph update. - // BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true); - + if (DEG_id_type_any_exists(depsgraph, ID_SPK)) { for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) { for (base = view_layer->object_bases.first; base; base = base->next) { @@ -1181,7 +1173,7 @@ void BKE_sound_set_cfra(int UNUSED(cfra)) void BKE_sound_update_sequencer(Main *UNUSED(main), bSound *UNUSED(sound)) { } -void BKE_sound_update_scene(Main *UNUSED(bmain), Scene *UNUSED(scene)) +void BKE_sound_update_scene(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene)) { } void BKE_sound_update_scene_sound(void *UNUSED(handle), bSound *UNUSED(sound)) -- cgit v1.2.3