Cleanup: Move VSE channels check into own util function

Differential Revision: https://developer.blender.org/D12661
This commit is contained in:
Dalai Felinto 2021-09-28 10:33:42 +02:00
parent a64782b133
commit e5ff9f3615
4 changed files with 15 additions and 2 deletions

View File

@ -997,7 +997,7 @@ static void link_recurs_seq(BlendDataReader *reader, ListBase *lb)
LISTBASE_FOREACH_MUTABLE (Sequence *, seq, lb) {
/* Sanity check. */
if ((seq->machine < 1) || (seq->machine > MAXSEQ)) {
if (!SEQ_valid_strip_channel(seq)) {
BLI_freelinkN(lb, seq);
BLO_read_data_reports(reader)->count.vse_strips_skipped++;
}

View File

@ -89,6 +89,7 @@ void SEQ_sequence_base_dupli_recursive(const struct Scene *scene_src,
const struct ListBase *seqbase,
int dupe_flag,
const int flag);
bool SEQ_valid_strip_channel(struct Sequence *seq);
/* Read and Write functions for .blend file data */
void SEQ_blend_write(struct BlendWriter *writer, struct ListBase *seqbase);

View File

@ -636,6 +636,18 @@ void SEQ_sequence_base_dupli_recursive(const Scene *scene_src,
seq_new_fix_links_recursive(seq);
}
}
bool SEQ_valid_strip_channel(Sequence *seq)
{
if (seq->machine < 1) {
return false;
}
if (seq->machine > MAXSEQ) {
return false;
}
return true;
}
/* r_prefix + [" + escaped_name + "] + \0 */
#define SEQ_RNAPATH_MAXSTR ((30 + 2 + (SEQ_NAME_MAXSTR * 2) + 2) + 1)

View File

@ -278,7 +278,7 @@ bool SEQ_transform_seqbase_shuffle_ex(ListBase *seqbasep,
SEQ_time_update_sequence(evil_scene, test);
}
if ((test->machine < 1) || (test->machine > MAXSEQ)) {
if (!SEQ_valid_strip_channel(test)) {
/* Blender 2.4x would remove the strip.
* nicer to move it to the end */