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:
-rw-r--r--source/blender/blenkernel/BKE_scene.h8
-rw-r--r--source/blender/blenkernel/BKE_sound.h6
-rw-r--r--source/blender/blenkernel/intern/scene.c51
-rw-r--r--source/blender/blenkernel/intern/sound.c15
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc15
5 files changed, 67 insertions, 28 deletions
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 75ff5eace3c..7aecfdb1a4d 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -240,6 +240,14 @@ void BKE_scene_cursor_quat_to_rot(struct View3DCursor *cursor,
const float quat[4],
bool use_compat);
+/* Evaluation. */
+
+/* Evaluate parts of sequences which needs to be done as a part of a dependency graph evaluation.
+ * This does NOT include actual rendering of the strips, but rather makes them up-to-date for
+ * animation playback and makes them ready for the sequencer's rendering pipeline to render them.
+ */
+void BKE_scene_eval_sequencer_sequences(struct Depsgraph *depsgraph, struct Scene *scene);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index b35a0fd16f5..d95be9fde97 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -154,4 +154,10 @@ float BKE_sound_get_length(struct bSound *sound);
char **BKE_sound_get_device_names(void);
+/* Evaluation. */
+
+struct Depsgraph;
+
+void BKE_sound_evaluate(struct Depsgraph *depsgraph, struct Main *bmain, struct bSound *sound);
+
#endif /* __BKE_SOUND_H__ */
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);
+}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index a9cafd933d9..9371cf5c682 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -90,6 +90,7 @@ extern "C" {
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_rigidbody.h"
+#include "BKE_scene.h"
#include "BKE_sequencer.h"
#include "BKE_shader_fx.h"
#include "BKE_sound.h"
@@ -1562,8 +1563,12 @@ void DepsgraphNodeBuilder::build_sound(bSound *sound)
if (built_map_.checkIsBuiltAndTag(sound)) {
return;
}
- /* Placeholder so we can add relations and tag ID node for update. */
- add_operation_node(&sound->id, NodeType::AUDIO, OperationCode::SOUND_EVAL);
+ add_id_node(&sound->id);
+ bSound *sound_cow = get_cow_datablock(sound);
+ add_operation_node(&sound->id,
+ NodeType::AUDIO,
+ OperationCode::SOUND_EVAL,
+ function_bind(BKE_sound_evaluate, _1, bmain_, sound_cow));
build_animdata(&sound->id);
build_parameters(&sound->id);
}
@@ -1573,7 +1578,11 @@ void DepsgraphNodeBuilder::build_sequencer(Scene *scene)
if (scene->ed == NULL) {
return;
}
- add_operation_node(&scene->id, NodeType::SEQUENCER, OperationCode::SEQUENCES_EVAL);
+ Scene *scene_cow = get_cow_datablock(scene_);
+ add_operation_node(&scene->id,
+ NodeType::SEQUENCER,
+ OperationCode::SEQUENCES_EVAL,
+ function_bind(BKE_scene_eval_sequencer_sequences, _1, scene_cow));
/* Make sure data for sequences is in the graph. */
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {