diff options
Diffstat (limited to 'source/blender')
8 files changed, 68 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 350b046e54d..ef33cd7d137 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -2454,8 +2454,16 @@ void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene) BKE_sound_ensure_scene(scene); Sequence *seq; SEQ_BEGIN (scene->ed, seq) { - if (seq->sound != NULL && seq->scene_sound == NULL) { - seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq); + if (seq->scene_sound == NULL) { + if (seq->sound != NULL) { + seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq); + } + else if (seq->type == SEQ_TYPE_SCENE) { + if (seq->scene != NULL) { + BKE_sound_ensure_scene(seq->scene); + seq->scene_sound = BKE_sound_scene_add_scene_sound_defaults(scene, seq); + } + } } if (seq->scene_sound) { BKE_sound_set_scene_sound_volume( diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index eeef658c064..f7070df778f 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -605,6 +605,7 @@ void *BKE_sound_add_scene_sound( if (sequence->sound == NULL) { return NULL; } + sound_verify_evaluated_id(&sequence->sound->id); const double fps = FPS; void *handle = AUD_Sequence_add(scene->sound_scene, sequence->sound->playback_handle, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.h b/source/blender/depsgraph/intern/builder/deg_builder_map.h index dd124e07a00..0767837a587 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_map.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_map.h @@ -40,10 +40,11 @@ class BuilderMap { TAG_SCENE_COMPOSITOR = (1 << 4), TAG_SCENE_SEQUENCER = (1 << 5), + TAG_SCENE_AUDIO = (1 << 5), /* All ID components has been built. */ TAG_COMPLETE = (TAG_ANIMATION | TAG_PARAMETERS | TAG_TRANSFORM | TAG_GEOMETRY | - TAG_SCENE_COMPOSITOR | TAG_SCENE_SEQUENCER), + TAG_SCENE_COMPOSITOR | TAG_SCENE_SEQUENCER | TAG_SCENE_AUDIO), }; BuilderMap(); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 9bdc815518d..64e5455dcbe 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -1582,7 +1582,8 @@ void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene) if (scene->ed == NULL) { return; } - Scene *scene_cow = get_cow_datablock(scene_); + build_scene_audio(scene); + Scene *scene_cow = get_cow_datablock(scene); add_operation_node(&scene->id, NodeType::SEQUENCER, OperationCode::SEQUENCES_EVAL, @@ -1593,6 +1594,14 @@ void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene) if (seq->sound != NULL) { build_sound(seq->sound); } + if (seq->scene != NULL) { + build_scene_parameters(seq->scene); + } + if (seq->type == SEQ_TYPE_SCENE && seq->flag & SEQ_SCENE_STRIPS) { + if (seq->scene != NULL) { + build_scene_sequencer(seq->scene); + } + } /* TODO(sergey): Movie clip, scene, camera, mask. */ } SEQ_END; @@ -1600,6 +1609,9 @@ void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene) void DepsgraphNodeBuilder::build_scene_audio(Scene *scene) { + if (built_map_.checkIsBuiltAndTag(scene, BuilderMap::TAG_SCENE_AUDIO)) { + return; + } add_operation_node(&scene->id, NodeType::AUDIO, OperationCode::SOUND_EVAL); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index a1f8c59f936..a0f10e560fa 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -2331,6 +2331,8 @@ void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene) if (scene->ed == NULL) { return; } + build_scene_audio(scene); + ComponentKey scene_audio_key(&scene->id, NodeType::AUDIO); /* Make sure dependencies from sequences data goes to the sequencer evaluation. */ ComponentKey sequencer_key(&scene->id, NodeType::SEQUENCER); Sequence *seq; @@ -2342,11 +2344,22 @@ void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene) add_relation(sound_key, sequencer_key, "Sound -> Sequencer"); has_audio_strips = true; } - /* TODO(sergey): Movie clip, scene, camera, mask. */ + if (seq->scene != NULL) { + build_scene_parameters(seq->scene); + /* This is to support 3D audio. */ + has_audio_strips = true; + } + if (seq->type == SEQ_TYPE_SCENE && seq->flag & SEQ_SCENE_STRIPS) { + if (seq->scene != NULL) { + build_scene_sequencer(seq->scene); + ComponentKey sequence_scene_audio_key(&seq->scene->id, NodeType::AUDIO); + add_relation(sequence_scene_audio_key, scene_audio_key, "Sequence Audio -> Scene Audio"); + } + } + /* TODO(sergey): Movie clip, 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"); } } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 192c0984dbb..525874c5939 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -65,6 +65,7 @@ #endif #include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" /* own include */ #include "sequencer_intern.h" @@ -314,6 +315,7 @@ static void sequencer_add_apply_replace_sel(bContext *C, wmOperator *op, Sequenc /* add scene operator */ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, true); @@ -352,6 +354,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) BKE_sequence_invalidate_cache_composite(scene, seq); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); + DEG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index d7a07a3e868..1b07a070505 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -65,6 +65,7 @@ #include "UI_interface.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" /* own include */ #include "sequencer_intern.h" @@ -2320,6 +2321,7 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot) /* delete operator */ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq; @@ -2373,6 +2375,7 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) } DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); + DEG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 9c5bc692712..4d7bc45308a 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -76,6 +76,7 @@ const EnumPropertyItem rna_enum_sequence_modifier_type_items[] = { # include "WM_api.h" # include "DEG_depsgraph.h" +# include "DEG_depsgraph_build.h" # include "IMB_imbuf.h" @@ -155,6 +156,25 @@ static void rna_Sequence_invalidate_composite_update(Main *UNUSED(bmain), } } +static void rna_Sequence_use_sequence(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + /* General update callback. */ + rna_Sequence_invalidate_raw_update(bmain, scene, ptr); + /* Chaning recursion changes set of IDs which needs to be remapped by the copy-on-write. + * the only way for this currently is to tag the ID for ID_RECALC_COPY_ON_WRITE. */ + Editing *ed = BKE_sequencer_editing_get(scene, false); + if (ed) { + Sequence *seq = (Sequence *)ptr->data; + if (seq->scene != NULL) { + DEG_id_tag_update(&seq->scene->id, ID_RECALC_COPY_ON_WRITE); + } + } + /* The sequencer scene is to be updated as well, including new relations from the nested + * sequencer. */ + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); + DEG_relations_tag_update(bmain); +} + static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { @@ -2203,7 +2223,7 @@ static void rna_def_scene(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SCENE_STRIPS); RNA_def_property_ui_text( prop, "Use Sequence", "Use scenes sequence strips directly, instead of rendering"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_use_sequence"); prop = RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_SCENE_NO_GPENCIL); |