[Bf-blender-cvs] [d4a5691d0fd] master: Sound: Use dependency graph instead of bmain

Sergey Sharybin noreply at git.blender.org
Fri Jun 7 12:00:35 CEST 2019


Commit: d4a5691d0fd5be0517968a95ebbe84778fb82b3a
Author: Sergey Sharybin
Date:   Fri Jun 7 10:58:51 2019 +0200
Branches: master
https://developer.blender.org/rBd4a5691d0fd5be0517968a95ebbe84778fb82b3a

Sound: Use dependency graph instead of bmain

Allows to move scene sound update to dependency graph evaluation.

===================================================================

M	source/blender/blenkernel/BKE_sound.h
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenkernel/intern/sound.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index 8d17380592e..07795e8438c 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -152,7 +152,7 @@ void BKE_sound_free_waveform(struct bSound *sound);
 
 void BKE_sound_read_waveform(struct bSound *sound, short *stop);
 
-void BKE_sound_update_scene(struct Main *bmain, struct Scene *scene);
+void BKE_sound_update_scene(struct Depsgraph *depsgraph, struct Scene *scene);
 
 void *BKE_sound_get_factory(void *sound);
 
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))



More information about the Bf-blender-cvs mailing list