Fix T67181: Only the first added movie strip will have audio below

Find free slot first for sound strips then for movie strips.
This patch also fixes issue where all strips were added to channel 2 by default.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8339
This commit is contained in:
Richard Antalik 2020-08-02 20:54:37 +02:00
parent 189eb2550d
commit 0264f53e30
Notes: blender-bot 2023-02-14 01:43:44 +01:00
Referenced by issue #67181, Sequencer: Only the first dragged and dropped movie strip will have audio below - the following will not.
2 changed files with 7 additions and 7 deletions

View File

@ -5592,6 +5592,9 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
}
}
if (seq_load->flag & SEQ_LOAD_MOVIE_SOUND) {
seq_load->channel++;
}
seq = BKE_sequence_alloc(seqbasep, seq_load->start_frame, seq_load->channel, SEQ_TYPE_MOVIE);
/* multiview settings */
@ -5648,11 +5651,8 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
if (seq_load->flag & SEQ_LOAD_MOVIE_SOUND) {
int start_frame_back = seq_load->start_frame;
seq_load->channel--;
seq_load->seq_sound = BKE_sequencer_add_sound_strip(C, seqbasep, seq_load);
seq_load->start_frame = start_frame_back;
seq_load->channel++;
}
/* can be NULL */

View File

@ -151,7 +151,7 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type)
int proximity = INT_MAX;
if (!ed || !ed->seqbasep) {
return 2;
return 1;
}
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
@ -165,7 +165,7 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type)
if (tgt) {
return tgt->machine + 1;
}
return 2;
return 1;
}
static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, int flag, int type)
@ -581,10 +581,10 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
seq = seq_load_fn(C, ed->seqbasep, &seq_load);
if (seq) {
sequencer_add_apply_overlap(C, op, seq);
if (seq_load.seq_sound) {
sequencer_add_apply_overlap(C, op, seq_load.seq_sound);
}
sequencer_add_apply_overlap(C, op, seq);
}
}
RNA_END;
@ -594,10 +594,10 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
seq = seq_load_fn(C, ed->seqbasep, &seq_load);
if (seq) {
sequencer_add_apply_overlap(C, op, seq);
if (seq_load.seq_sound) {
sequencer_add_apply_overlap(C, op, seq_load.seq_sound);
}
sequencer_add_apply_overlap(C, op, seq);
}
}