diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-06-04 17:52:48 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-06-05 15:23:54 +0300 |
commit | bbaa1bffe9dbc35d2791b83d0014ccb4ffb6087a (patch) | |
tree | d0ded24e2fb254943831cacca7c28b7752e57eae /source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | |
parent | 863b7b3668fe67a082439181eaf49c3e94a87536 (diff) |
Sound: Port to a copy-on-write concept
This change makes it so sound handles are created for evaluated scene,
sequencer and speakers. This allows to have properly evaluated animation
on them.
For the viewport playback sound uses regular dependency graph.
For the final render sound uses dependency graph created for render pipeline,
which now also contains sequencer and sound datablocks.
All the direct sound update calls are replaced with corresponding dependency
graph recalc tag.
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_nodes.cc')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 93e5dd14ae0..9bdc815518d 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -58,6 +58,7 @@ extern "C" { #include "DNA_lightprobe_types.h" #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" +#include "DNA_sequence_types.h" #include "DNA_sound_types.h" #include "DNA_speaker_types.h" #include "DNA_texture_types.h" @@ -89,6 +90,8 @@ 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" #include "BKE_tracking.h" @@ -1564,12 +1567,42 @@ 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); } +void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene) +{ + if (scene->ed == NULL) { + return; + } + 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) { + if (seq->sound != NULL) { + build_sound(seq->sound); + } + /* TODO(sergey): Movie clip, scene, camera, mask. */ + } + SEQ_END; +} + +void DepsgraphNodeBuilder::build_scene_audio(Scene *scene) +{ + add_operation_node(&scene->id, NodeType::AUDIO, OperationCode::SOUND_EVAL); +} + /* **** ID traversal callbacks functions **** */ void DepsgraphNodeBuilder::modifier_walk(void *user_data, |