Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-05-01 16:57:16 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-05-03 16:50:40 +0300
commit6990ef151c199761da1eb1777ff384835bb7ba20 (patch)
tree2219af160a5f96ae1e4153a0365838efe78e0e91 /source/blender/blenkernel/intern
parentd02da8de23b1d5f64695d3e7e91384d5e2f24e4c (diff)
Sound: Move evaluation to dependency graph
The sound handles are still in the original datablocks, so it's easier to test since there should be no functional changes.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/scene.c51
-rw-r--r--source/blender/blenkernel/intern/sound.c15
2 files changed, 41 insertions, 25 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index e9772a14829..14e011fca3b 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1511,31 +1511,6 @@ static void scene_update_sound(Depsgraph *depsgraph, Main *bmain)
{
Scene *scene = DEG_get_input_scene(depsgraph);
BKE_sound_ensure_scene(scene);
- /* Ensure audio for sound datablocks is loaded. */
- for (bSound *sound = bmain->sounds.first; sound != NULL; sound = sound->id.next) {
- bSound *sound_eval = (bSound *)DEG_get_evaluated_id(depsgraph, &sound->id);
- if (sound_eval->playback_handle == NULL) {
- BKE_sound_load(bmain, sound_eval);
- }
- }
- /* Make sure sequencer audio is up to date. */
- if (scene->ed != NULL) {
- Sequence *seq;
- bool something_loaded = false;
- SEQ_BEGIN (scene->ed, seq) {
- if (seq->sound != NULL && seq->scene_sound == NULL) {
- printf("Loading sequencer sound\n");
- seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq);
- something_loaded = true;
- }
- }
- SEQ_END;
- if (something_loaded) {
- BKE_sequencer_update_muting(scene->ed);
- BKE_sequencer_update_sound_bounds_all(scene);
- }
- }
- /* Update scene sound. */
BKE_sound_update_scene(bmain, scene);
}
@@ -2417,3 +2392,29 @@ void BKE_scene_cursor_quat_to_rot(View3DCursor *cursor, const float quat[4], boo
}
/** \} */
+
+/* Evaluation. */
+
+void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene)
+{
+ DEG_debug_print_eval(depsgraph, __func__, scene->id.name, scene);
+ /* TODO(sergey): For now we keep sound handlers in an original IDs, but it
+ * should really be moved to an evaluated one. */
+ if (!DEG_is_active(depsgraph)) {
+ return;
+ }
+ Scene *scene_orig = (Scene *)DEG_get_original_id(&scene->id);
+ if (scene_orig->ed == NULL) {
+ return;
+ }
+ BKE_sound_ensure_scene(scene_orig);
+ Sequence *seq;
+ SEQ_BEGIN (scene_orig->ed, seq) {
+ if (seq->sound != NULL && seq->scene_sound == NULL) {
+ seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene_orig, seq);
+ }
+ }
+ SEQ_END;
+ BKE_sequencer_update_muting(scene_orig->ed);
+ BKE_sequencer_update_sound_bounds_all(scene_orig);
+}
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 3b46677828d..18093173f7c 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -55,6 +55,9 @@
#include "BKE_sequencer.h"
#include "BKE_scene.h"
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
+
#ifdef WITH_AUDASPACE
/* evil globals ;-) */
static int sound_cfra;
@@ -1183,3 +1186,15 @@ void BKE_sound_ensure_loaded(Main *bmain, bSound *sound)
}
BKE_sound_load(bmain, sound);
}
+
+void BKE_sound_evaluate(Depsgraph *depsgraph, Main *bmain, bSound *sound)
+{
+ DEG_debug_print_eval(depsgraph, __func__, sound->id.name, sound);
+ /* TODO(sergey): For now we keep sound handlers in an original IDs, but it
+ * should really be moved to an evaluated one. */
+ if (!DEG_is_active(depsgraph)) {
+ return;
+ }
+ bSound *sound_orig = (bSound *)DEG_get_original_id(&sound->id);
+ BKE_sound_ensure_loaded(bmain, sound_orig);
+}