Depsgraph: Add scene audio component

The idea is to make that responsible for dealing with
things like audio update on frame jump and such.
This commit is contained in:
2019-05-01 12:46:47 +02:00
parent e8f10d6475
commit 3369b82891
8 changed files with 28 additions and 0 deletions

View File

@@ -1585,6 +1585,11 @@ void DepsgraphNodeBuilder::build_sequencer(Scene *scene)
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,

View File

@@ -209,6 +209,7 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder {
void build_speaker(Speaker *speaker);
void build_sound(bSound *sound);
void build_sequencer(Scene *scene);
void build_scene_audio(Scene *scene);
/* Per-ID information about what was already in the dependency graph.
* Allows to re-use certain values, to speed up following evaluation. */

View File

@@ -154,6 +154,7 @@ void DepsgraphNodeBuilder::build_view_layer(Scene *scene,
}
/* Sequencer. */
if (linked_state == DEG_ID_LINKED_DIRECTLY) {
build_scene_audio(scene);
build_sequencer(scene);
}
/* Collections. */

View File

@@ -2307,15 +2307,25 @@ void DepsgraphRelationBuilder::build_sequencer(Scene *scene)
/* Make sure dependnecies from sequences data goes to the sequencer evaluation. */
ComponentKey sequencer_key(&scene->id, NodeType::SEQUENCER);
Sequence *seq;
bool has_audio_strips = false;
SEQ_BEGIN (scene->ed, seq) {
if (seq->sound != NULL) {
build_sound(seq->sound);
ComponentKey sound_key(&seq->sound->id, NodeType::AUDIO);
add_relation(sound_key, sequencer_key, "Sound -> Sequencer");
has_audio_strips = true;
}
/* TODO(sergey): Movie clip, scene, camera, mask. */
}
SEQ_END;
if (has_audio_strips) {
ComponentKey scene_audio_key(&scene->id, NodeType::AUDIO);
add_relation(sequencer_key, scene_audio_key, "Sequencer -> Audio");
}
}
void DepsgraphRelationBuilder::build_scene_audio(Scene * /*scene*/)
{
}
void DepsgraphRelationBuilder::build_copy_on_write_relations()

View File

@@ -270,6 +270,7 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder {
void build_speaker(Speaker *speaker);
void build_sound(bSound *sound);
void build_sequencer(Scene *scene);
void build_scene_audio(Scene *scene);
void build_nested_datablock(ID *owner, ID *id);
void build_nested_nodetree(ID *owner, bNodeTree *ntree);

View File

@@ -132,6 +132,7 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene,
}
/* Sequencer. */
if (linked_state == DEG_ID_LINKED_DIRECTLY) {
build_scene_audio(scene);
build_sequencer(scene);
}
/* Build all set scenes. */

View File

@@ -218,6 +218,9 @@ void depsgraph_tag_to_component_opcode(const ID *id,
case ID_RECALC_SEQUENCER:
*component_type = NodeType::SEQUENCER;
break;
case ID_RECALC_AUDIO_JUMP:
*component_type = NodeType::AUDIO;
break;
case ID_RECALC_ALL:
case ID_RECALC_PSYS_ALL:
BLI_assert(!"Should not happen");
@@ -620,6 +623,8 @@ const char *DEG_update_tag_as_string(IDRecalcFlag flag)
return "EDITORS";
case ID_RECALC_SEQUENCER:
return "SEQUENCER";
case ID_RECALC_AUDIO_JUMP:
return "AUDIO_JUMP";
case ID_RECALC_ALL:
return "ALL";
}

View File

@@ -608,6 +608,10 @@ typedef enum IDRecalcFlag {
* Use this tag with a scene ID which owns the sequences. */
ID_RECALC_SEQUENCER = (1 << 14),
/* Frame changed in a way that caused audio jump.
* Use this on a scene ID. */
ID_RECALC_AUDIO_JUMP = (1 << 15),
/***************************************************************************
* Pseudonyms, to have more semantic meaning in the actual code without
* using too much low-level and implementation specific tags. */