Fixed copy-paste of sound strips in sequencer.

Copy operator used to remove scene_sound from strips, but Paste operator didn't
restore which lead to total silence of newly added strips.
This commit is contained in:
Sergey Sharybin
2012-02-13 17:29:10 +00:00
parent 32c4ade29c
commit 840ffba82c

View File

@@ -2555,12 +2555,12 @@ void SEQUENCER_OT_rendersize(wmOperatorType *ot)
/* properties */
}
static void seq_del_sound(Scene *scene, Sequence *seq)
static void seq_copy_del_sound(Scene *scene, Sequence *seq)
{
if(seq->type == SEQ_META) {
Sequence *iseq;
for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
seq_del_sound(scene, iseq);
seq_copy_del_sound(scene, iseq);
}
}
else if(seq->scene_sound) {
@@ -2611,7 +2611,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
/* Need to remove anything that references the current scene */
for(seq= seqbase_clipboard.first; seq; seq= seq->next) {
seq_del_sound(scene, seq);
seq_copy_del_sound(scene, seq);
}
return OPERATOR_FINISHED;
@@ -2634,6 +2634,19 @@ void SEQUENCER_OT_copy(wmOperatorType *ot)
/* properties */
}
static void seq_paste_add_sound(Scene *scene, Sequence *seq)
{
if(seq->type == SEQ_META) {
Sequence *iseq;
for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
seq_paste_add_sound(scene, iseq);
}
}
else if(seq->type == SEQ_SOUND) {
seq->scene_sound = sound_add_scene_sound_defaults(scene, seq);
}
}
static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
@@ -2660,9 +2673,13 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
BLI_movelisttolist(ed->seqbasep, &nseqbase);
/* make sure the pasted strips have unique names between them */
for(; iseq; iseq=iseq->next)
for(; iseq; iseq=iseq->next) {
seq_recursive_apply(iseq, apply_unique_name_cb, scene);
/* restore valid sound_scene for newly added strips */
seq_paste_add_sound(scene, iseq);
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;