VSE: Copy channels when making meta strip

Copy channel name and flags from parent channels.
Only channels used by strips will be copied.

Pull Request: https://projects.blender.org/blender/blender/pulls/123073
This commit is contained in:
Richard Antalik
2024-06-26 06:10:14 +02:00
committed by Richard Antalik
parent 3be5424896
commit 44bc433ed4

View File

@@ -1994,7 +1994,8 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
SEQ_prefetch_stop(scene);
int channel_max = 1, meta_start_frame = MAXFRAME, meta_end_frame = MINFRAME;
int channel_max = 1, channel_min = INT_MAX, meta_start_frame = MAXFRAME,
meta_end_frame = MINFRAME;
Sequence *seqm = SEQ_sequence_alloc(active_seqbase, 1, 1, SEQ_TYPE_META);
/* Remove all selected from main list, and put in meta.
@@ -2005,11 +2006,21 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
BLI_addtail(&seqm->seqbase, seq);
SEQ_relations_invalidate_cache_preprocessed(scene, seq);
channel_max = max_ii(seq->machine, channel_max);
channel_min = min_ii(seq->machine, channel_min);
meta_start_frame = min_ii(SEQ_time_left_handle_frame_get(scene, seq), meta_start_frame);
meta_end_frame = max_ii(SEQ_time_right_handle_frame_get(scene, seq), meta_end_frame);
}
}
ListBase *channels_cur = SEQ_channels_displayed_get(ed);
ListBase *channels_meta = &seqm->channels;
for (int i = channel_min; i <= channel_max; i++) {
SeqTimelineChannel *channel_cur = SEQ_channel_get_by_index(channels_cur, i);
SeqTimelineChannel *channel_meta = SEQ_channel_get_by_index(channels_meta, i);
BLI_strncpy(channel_meta->name, channel_cur->name, sizeof(channel_meta->name));
channel_meta->flag = channel_cur->flag;
}
seqm->machine = active_seq ? active_seq->machine : channel_max;
BLI_strncpy(seqm->name + 2, "MetaStrip", sizeof(seqm->name) - 2);
SEQ_sequence_base_unique_name_recursive(scene, &ed->seqbase, seqm);