Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2021-06-17 04:40:44 +0300
committerRichard Antalik <richardantalik@gmail.com>2021-06-17 04:42:04 +0300
commite7003bc9654b217e5938d64fb40094035735de9b (patch)
tree632657a701424d1c5f9bdfd835daffe7d0723796 /source/blender
parentc73be23e176272da78b38f733fd56af09ebd7acf (diff)
VSE: Reduce transform code complexity
Reduce complexity of sequencer transform code by removing recursivity. This is possible by treating meta strips (mostly) as any other strip and containing all transform code within SEQ_ functions. Unfortunately internally meta strips still require special treatment, but all complexity from code all over transform code seems to be possible to contain within one function. Functional change: Previously adjusting handle of single image strip moved animation. Now animation is not moved, which is behavior for all other strips. Reviewed By: sergey, mano-wii Differential Revision: https://developer.blender.org/D11493
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c6
-rw-r--r--source/blender/editors/transform/transform_convert_sequencer.c346
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h5
-rw-r--r--source/blender/sequencer/SEQ_time.h1
-rw-r--r--source/blender/sequencer/intern/strip_time.c4
-rw-r--r--source/blender/sequencer/intern/strip_transform.c10
7 files changed, 129 insertions, 245 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 5f831cbf535..b6929f12cc0 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -367,8 +367,6 @@ static void draw_seq_waveform_overlay(View2D *v2d,
static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
{
- /* Don't use SEQ_ALL_BEGIN/SEQ_ALL_END here,
- * because it changes seq->depth, which is needed for transform. */
Sequence *seq;
uchar col[4];
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 42e2a2e5549..4c8b44864f9 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -335,7 +335,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
/* Check meta-strips. */
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
- if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK) &&
+ if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK) &&
SEQ_transform_sequence_can_be_translated(seq)) {
if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) {
SEQ_transform_translate_sequence(
@@ -357,7 +357,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
/* Test for effects and overlap. */
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
- if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK)) {
+ if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
seq->flag &= ~SEQ_OVERLAP;
if (SEQ_transform_test_overlap(ed->seqbasep, seq)) {
SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene);
@@ -2187,7 +2187,7 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
seq = ed->seqbasep->first;
while (seq) {
- if ((seq != test) && (test->machine == seq->machine) && (test->depth == seq->depth) &&
+ if ((seq != test) && (test->machine == seq->machine) &&
((sel == -1) || (sel == (seq->flag & SELECT)))) {
dist = MAXFRAME * 2;
diff --git a/source/blender/editors/transform/transform_convert_sequencer.c b/source/blender/editors/transform/transform_convert_sequencer.c
index 6a09008e657..3df8da9b814 100644
--- a/source/blender/editors/transform/transform_convert_sequencer.c
+++ b/source/blender/editors/transform/transform_convert_sequencer.c
@@ -76,12 +76,9 @@ typedef struct TransSeq {
/* This function applies the rules for transforming a strip so duplicate
* checks don't need to be added in multiple places.
*
- * recursive, count and flag MUST be set.
- *
- * seq->depth must be set before running this function so we know if the strips
- * are root level or not
+ * count and flag MUST be set.
*/
-static void SeqTransInfo(TransInfo *t, Sequence *seq, int *r_recursive, int *r_count, int *r_flag)
+static void SeqTransInfo(TransInfo *t, Sequence *seq, int *r_count, int *r_flag)
{
/* for extend we need to do some tricks */
if (t->mode == TFM_TIME_EXTEND) {
@@ -93,13 +90,11 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *r_recursive, int *r_c
int left = SEQ_transform_get_left_handle_frame(seq);
int right = SEQ_transform_get_right_handle_frame(seq);
- if (seq->depth == 0 && ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK))) {
- *r_recursive = false;
+ if (((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK))) {
*r_count = 0;
*r_flag = 0;
}
else {
- *r_recursive = false;
*r_count = 1; /* unless its set to 0, extend will never set 2 handles at once */
*r_flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
@@ -131,61 +126,34 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *r_recursive, int *r_c
/* *** Normal Transform *** */
- if (seq->depth == 0) {
-
- /* Count */
+ /* Count */
- /* Non nested strips (resect selection and handles) */
- if ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK)) {
- *r_recursive = false;
- *r_count = 0;
- *r_flag = 0;
+ /* Non nested strips (resect selection and handles) */
+ if ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK)) {
+ *r_count = 0;
+ *r_flag = 0;
+ }
+ else {
+ if ((seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == (SEQ_LEFTSEL | SEQ_RIGHTSEL)) {
+ *r_flag = seq->flag;
+ *r_count = 2; /* we need 2 transdata's */
}
else {
- if ((seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == (SEQ_LEFTSEL | SEQ_RIGHTSEL)) {
- *r_flag = seq->flag;
- *r_count = 2; /* we need 2 transdata's */
- }
- else {
- *r_flag = seq->flag;
- *r_count = 1; /* selected or with a handle selected */
- }
-
- /* Recursive */
-
- if ((seq->type == SEQ_TYPE_META) && ((seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == 0)) {
- /* if any handles are selected, don't recurse */
- *r_recursive = true;
- }
- else {
- *r_recursive = false;
- }
+ *r_flag = seq->flag;
+ *r_count = 1; /* selected or with a handle selected */
}
}
- else {
- /* Nested, different rules apply */
-
- *r_flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
- *r_count = 1; /* ignore the selection for nested */
- *r_recursive = (seq->type == SEQ_TYPE_META);
- }
}
}
static int SeqTransCount(TransInfo *t, ListBase *seqbase, int depth)
{
Sequence *seq;
- int tot = 0, recursive, count, flag;
+ int tot = 0, count, flag;
for (seq = seqbase->first; seq; seq = seq->next) {
- seq->depth = depth;
-
- SeqTransInfo(t, seq, &recursive, &count, &flag); /* ignore the flag */
+ SeqTransInfo(t, seq, &count, &flag); /* ignore the flag */
tot += count;
-
- if (recursive) {
- tot += SeqTransCount(t, &seq->seqbase, depth + 1);
- }
}
return tot;
@@ -251,27 +219,16 @@ static TransData *SeqToTransData(
return td;
}
-static int SeqToTransData_Recursive(
+static int SeqToTransData_build(
TransInfo *t, ListBase *seqbase, TransData *td, TransData2D *td2d, TransDataSeq *tdsq)
{
Sequence *seq;
- int recursive, count, flag;
+ int count, flag;
int tot = 0;
for (seq = seqbase->first; seq; seq = seq->next) {
- SeqTransInfo(t, seq, &recursive, &count, &flag);
-
- /* add children first so recalculating metastrips does nested strips first */
- if (recursive) {
- int tot_children = SeqToTransData_Recursive(t, &seq->seqbase, td, td2d, tdsq);
-
- td = td + tot_children;
- td2d = td2d + tot_children;
- tdsq = tdsq + tot_children;
-
- tot += tot_children;
- }
+ SeqTransInfo(t, seq, &count, &flag);
/* use 'flag' which is derived from seq->flag but modified for special cases */
if (flag & SELECT) {
@@ -297,13 +254,13 @@ static int SeqToTransData_Recursive(
static void SeqTransDataBounds(TransInfo *t, ListBase *seqbase, TransSeq *ts)
{
Sequence *seq;
- int recursive, count, flag;
+ int count, flag;
int max = INT32_MIN, min = INT32_MAX;
for (seq = seqbase->first; seq; seq = seq->next) {
/* just to get the flag since there are corner cases where this isn't totally obvious */
- SeqTransInfo(t, seq, &recursive, &count, &flag);
+ SeqTransInfo(t, seq, &count, &flag);
/* use 'flag' which is derived from seq->flag but modified for special cases */
if (flag & SELECT) {
@@ -347,129 +304,108 @@ static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData *c
Sequence *seq;
if (!(t->state == TRANS_CANCEL)) {
+ int overlap = 0;
-#if 0 /* Default 2.4 behavior. */
-
- /* flush to 2d vector from internally used 3d vector */
- for (a = 0; a < t->total; a++, td++) {
- if ((seq != seq_prev) && (seq->depth == 0) && (seq->flag & SEQ_OVERLAP)) {
- seq = ((TransDataSeq *)td->extra)->seq;
- SEQ_transform_seqbase_shuffle(seqbasep, seq, t->scene);
+ for (a = 0, seq_prev = NULL; a < tc->data_len; a++, td++, seq_prev = seq) {
+ seq = ((TransDataSeq *)td->extra)->seq;
+ if ((seq != seq_prev) && (seq->flag & SEQ_OVERLAP)) {
+ overlap = 1;
+ break;
}
-
- seq_prev = seq;
}
-#else /* durian hack */
- {
- int overlap = 0;
+ if (overlap) {
+ const bool use_sync_markers = (((SpaceSeq *)t->area->spacedata.first)->flag &
+ SEQ_MARKER_TRANS) != 0;
+ ListBase *markers = &t->scene->markers;
+ bool has_effect_root = false, has_effect_any = false;
+ for (seq = seqbasep->first; seq; seq = seq->next) {
+ seq->tmp = NULL;
+ }
+
+ td = tc->data;
for (a = 0, seq_prev = NULL; a < tc->data_len; a++, td++, seq_prev = seq) {
seq = ((TransDataSeq *)td->extra)->seq;
- if ((seq != seq_prev) && (seq->depth == 0) && (seq->flag & SEQ_OVERLAP)) {
- overlap = 1;
- break;
+ if ((seq != seq_prev)) {
+ /* check effects strips, we cant change their time */
+ if ((seq->type & SEQ_TYPE_EFFECT) && seq->seq1) {
+ has_effect_any = true;
+ has_effect_root = true;
+ }
+ else {
+ /* Tag seq with a non zero value, used by
+ * SEQ_transform_seqbase_shuffle_time to identify the ones to shuffle */
+ seq->tmp = (void *)1;
+ }
}
}
- if (overlap) {
- const bool use_sync_markers = (((SpaceSeq *)t->area->spacedata.first)->flag &
- SEQ_MARKER_TRANS) != 0;
- ListBase *markers = &t->scene->markers;
-
- bool has_effect_root = false, has_effect_any = false;
- for (seq = seqbasep->first; seq; seq = seq->next) {
- seq->tmp = NULL;
- }
-
+ if (t->flag & T_ALT_TRANSFORM) {
+ int minframe = MAXFRAME;
td = tc->data;
for (a = 0, seq_prev = NULL; a < tc->data_len; a++, td++, seq_prev = seq) {
seq = ((TransDataSeq *)td->extra)->seq;
- if ((seq != seq_prev)) {
- /* check effects strips, we cant change their time */
- if ((seq->type & SEQ_TYPE_EFFECT) && seq->seq1) {
- has_effect_any = true;
- if (seq->depth == 0) {
- has_effect_root = true;
- }
- }
- else {
- /* Tag seq with a non zero value, used by
- * SEQ_transform_seqbase_shuffle_time to identify the ones to shuffle */
- if (seq->depth == 0) {
- seq->tmp = (void *)1;
- }
- }
+ if (seq != seq_prev) {
+ minframe = min_ii(minframe, seq->startdisp);
}
}
- if (t->flag & T_ALT_TRANSFORM) {
- int minframe = MAXFRAME;
- td = tc->data;
- for (a = 0, seq_prev = NULL; a < tc->data_len; a++, td++, seq_prev = seq) {
- seq = ((TransDataSeq *)td->extra)->seq;
- if ((seq != seq_prev) && (seq->depth == 0)) {
- minframe = min_ii(minframe, seq->startdisp);
- }
- }
-
- for (seq = seqbasep->first; seq; seq = seq->next) {
- if (!(seq->flag & SELECT)) {
- if (seq->startdisp >= minframe) {
- seq->machine += MAXSEQ * 2;
- }
+ for (seq = seqbasep->first; seq; seq = seq->next) {
+ if (!(seq->flag & SELECT)) {
+ if (seq->startdisp >= minframe) {
+ seq->machine += MAXSEQ * 2;
}
}
+ }
- SEQ_transform_seqbase_shuffle_time(seqbasep, t->scene, markers, use_sync_markers);
+ SEQ_transform_seqbase_shuffle_time(seqbasep, t->scene, markers, use_sync_markers);
- for (seq = seqbasep->first; seq; seq = seq->next) {
- if (seq->machine >= MAXSEQ * 2) {
- seq->machine -= MAXSEQ * 2;
- seq->tmp = (void *)1;
- }
- else {
- seq->tmp = NULL;
- }
+ for (seq = seqbasep->first; seq; seq = seq->next) {
+ if (seq->machine >= MAXSEQ * 2) {
+ seq->machine -= MAXSEQ * 2;
+ seq->tmp = (void *)1;
+ }
+ else {
+ seq->tmp = NULL;
}
-
- SEQ_transform_seqbase_shuffle_time(seqbasep, t->scene, markers, use_sync_markers);
- }
- else {
- SEQ_transform_seqbase_shuffle_time(seqbasep, t->scene, markers, use_sync_markers);
}
- if (has_effect_any) {
- /* update effects strips based on strips just moved in time */
- td = tc->data;
- for (a = 0, seq_prev = NULL; a < tc->data_len; a++, td++, seq_prev = seq) {
- seq = ((TransDataSeq *)td->extra)->seq;
- if ((seq != seq_prev)) {
- if ((seq->type & SEQ_TYPE_EFFECT) && seq->seq1) {
- SEQ_time_update_sequence(t->scene, seq);
- }
+ SEQ_transform_seqbase_shuffle_time(seqbasep, t->scene, markers, use_sync_markers);
+ }
+ else {
+ SEQ_transform_seqbase_shuffle_time(seqbasep, t->scene, markers, use_sync_markers);
+ }
+
+ if (has_effect_any) {
+ /* update effects strips based on strips just moved in time */
+ td = tc->data;
+ for (a = 0, seq_prev = NULL; a < tc->data_len; a++, td++, seq_prev = seq) {
+ seq = ((TransDataSeq *)td->extra)->seq;
+ if ((seq != seq_prev)) {
+ if ((seq->type & SEQ_TYPE_EFFECT) && seq->seq1) {
+ SEQ_time_update_sequence(t->scene, seq);
}
}
}
+ }
- if (has_effect_root) {
- /* now if any effects _still_ overlap, we need to move them up */
- td = tc->data;
- for (a = 0, seq_prev = NULL; a < tc->data_len; a++, td++, seq_prev = seq) {
- seq = ((TransDataSeq *)td->extra)->seq;
- if ((seq != seq_prev) && (seq->depth == 0)) {
- if ((seq->type & SEQ_TYPE_EFFECT) && seq->seq1) {
- if (SEQ_transform_test_overlap(seqbasep, seq)) {
- SEQ_transform_seqbase_shuffle(seqbasep, seq, t->scene);
- }
+ if (has_effect_root) {
+ /* now if any effects _still_ overlap, we need to move them up */
+ td = tc->data;
+ for (a = 0, seq_prev = NULL; a < tc->data_len; a++, td++, seq_prev = seq) {
+ seq = ((TransDataSeq *)td->extra)->seq;
+ if (seq != seq_prev) {
+ if ((seq->type & SEQ_TYPE_EFFECT) && seq->seq1) {
+ if (SEQ_transform_test_overlap(seqbasep, seq)) {
+ SEQ_transform_seqbase_shuffle(seqbasep, seq, t->scene);
}
}
}
- /* done with effects */
}
+ /* done with effects */
}
}
-#endif
for (seq = seqbasep->first; seq; seq = seq->next) {
/* We might want to build a list of effects that need to be updated during transform */
@@ -492,7 +428,7 @@ static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData *c
/* Canceled, need to update the strips display */
for (a = 0; a < tc->data_len; a++, td++) {
seq = ((TransDataSeq *)td->extra)->seq;
- if ((seq != seq_prev) && (seq->depth == 0)) {
+ if (seq != seq_prev) {
if (seq->flag & SEQ_OVERLAP) {
SEQ_transform_seqbase_shuffle(seqbasep, seq, t->scene);
}
@@ -574,7 +510,7 @@ void createTransSeqData(TransInfo *t)
ts->tdseq = tdsq = MEM_callocN(tc->data_len * sizeof(TransDataSeq), "TransSeq TransDataSeq");
/* loop 2: build transdata array */
- SeqToTransData_Recursive(t, ed->seqbasep, td, td2d, tdsq);
+ SeqToTransData_build(t, ed->seqbasep, td, td2d, tdsq);
SeqTransDataBounds(t, ed->seqbasep, ts);
if (t->flag & T_MODAL) {
@@ -607,15 +543,10 @@ void createTransSeqData(TransInfo *t)
BLI_INLINE void trans_update_seq(Scene *sce, Sequence *seq, int old_start, int sel_flag)
{
- if (seq->depth == 0) {
- /* Calculate this strip and all nested strips.
- * Children are ALWAYS transformed first so we don't need to do this in another loop.
- */
- SEQ_time_update_sequence(sce, seq);
- }
- else {
- SEQ_time_update_sequence_bounds(sce, seq);
- }
+ /* Calculate this strip and all nested strips.
+ * Children are ALWAYS transformed first so we don't need to do this in another loop.
+ */
+ SEQ_time_update_sequence(sce, seq);
if (sel_flag == SELECT) {
SEQ_offset_animdata(sce, seq, seq->start - old_start);
@@ -635,102 +566,49 @@ static void flushTransSeq(TransInfo *t)
TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
- /* prevent updating the same seq twice
- * if the transdata order is changed this will mess up
- * but so will TransDataSeq */
- Sequence *seq_prev = NULL;
- int old_start_prev = 0, sel_flag_prev = 0;
-
/* flush to 2d vector from internally used 3d vector */
for (a = 0, td = tc->data, td2d = tc->data_2d; a < tc->data_len; a++, td++, td2d++) {
- int old_start;
tdsq = (TransDataSeq *)td->extra;
seq = tdsq->seq;
- old_start = seq->start;
new_frame = round_fl_to_int(td2d->loc[0]);
switch (tdsq->sel_flag) {
case SELECT:
- if ((seq->depth != 0 || SEQ_transform_sequence_can_be_translated(seq))) {
- /* for meta's, their children move */
- seq->start = new_frame - tdsq->start_offset;
- }
- if (seq->depth == 0) {
- seq->machine = round_fl_to_int(td2d->loc[1]);
- CLAMP(seq->machine, 1, MAXSEQ);
+ if (SEQ_transform_sequence_can_be_translated(seq)) {
+ const int offset = new_frame - tdsq->start_offset - seq->start;
+ SEQ_transform_translate_sequence(t->scene, seq, offset);
}
+ seq->machine = round_fl_to_int(td2d->loc[1]);
+ CLAMP(seq->machine, 1, MAXSEQ);
break;
+
case SEQ_LEFTSEL: /* no vertical transform */
SEQ_transform_set_left_handle_frame(seq, new_frame);
SEQ_transform_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL);
-
- /* todo - move this into aftertrans update? - old seq tx needed it anyway */
SEQ_transform_fix_single_image_seq_offsets(seq);
+ SEQ_time_update_sequence(t->scene, seq);
break;
case SEQ_RIGHTSEL: /* no vertical transform */
SEQ_transform_set_right_handle_frame(seq, new_frame);
SEQ_transform_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL);
-
- /* todo - move this into aftertrans update? - old seq tx needed it anyway */
SEQ_transform_fix_single_image_seq_offsets(seq);
+ SEQ_time_update_sequence(t->scene, seq);
break;
}
-
- /* Update *previous* seq! Else, we would update a seq after its first transform,
- * and if it has more than one (like e.g. SEQ_LEFTSEL and SEQ_RIGHTSEL),
- * the others are not updated! See T38469.
- */
- if (seq != seq_prev) {
- if (seq_prev) {
- trans_update_seq(t->scene, seq_prev, old_start_prev, sel_flag_prev);
- }
-
- seq_prev = seq;
- old_start_prev = old_start;
- sel_flag_prev = tdsq->sel_flag;
- }
- else {
- /* We want to accumulate *all* sel_flags for this seq! */
- sel_flag_prev |= tdsq->sel_flag;
- }
}
- /* Don't forget to update the last seq! */
- if (seq_prev) {
- trans_update_seq(t->scene, seq_prev, old_start_prev, sel_flag_prev);
- }
-
- /* originally TFM_TIME_EXTEND, transform changes */
+ /* Update all effects. */
if (ELEM(t->mode, TFM_SEQ_SLIDE, TFM_TIME_TRANSLATE)) {
- /* Special annoying case here, need to calc meta-strips with TFM_TIME_EXTEND only */
-
- /* calc all meta's then effects T27953. */
- for (seq = seqbasep->first; seq; seq = seq->next) {
- if (seq->type == SEQ_TYPE_META && seq->flag & SELECT) {
- SEQ_time_update_sequence(t->scene, seq);
- }
- }
for (seq = seqbasep->first; seq; seq = seq->next) {
if (seq->seq1 || seq->seq2 || seq->seq3) {
SEQ_time_update_sequence(t->scene, seq);
}
}
-
- /* update effects inside meta's */
- for (a = 0, seq_prev = NULL, td = tc->data, td2d = tc->data_2d; a < tc->data_len;
- a++, td++, td2d++, seq_prev = seq) {
- tdsq = (TransDataSeq *)td->extra;
- seq = tdsq->seq;
- if ((seq != seq_prev) && (seq->depth != 0)) {
- if (seq->seq1 || seq->seq2 || seq->seq3) {
- SEQ_time_update_sequence(t->scene, seq);
- }
- }
- }
}
/* need to do the overlap check in a new loop otherwise adjacent strips
* will not be updated and we'll get false positives */
+ Sequence *seq_prev = NULL;
seq_prev = NULL;
for (a = 0, td = tc->data, td2d = tc->data_2d; a < tc->data_len; a++, td++, td2d++) {
@@ -738,12 +616,10 @@ static void flushTransSeq(TransInfo *t)
seq = tdsq->seq;
if (seq != seq_prev) {
- if (seq->depth == 0) {
- /* test overlap, displays red outline */
- seq->flag &= ~SEQ_OVERLAP;
- if (SEQ_transform_test_overlap(seqbasep, seq)) {
- seq->flag |= SEQ_OVERLAP;
- }
+ /* test overlap, displays red outline */
+ seq->flag &= ~SEQ_OVERLAP;
+ if (SEQ_transform_test_overlap(seqbasep, seq)) {
+ seq->flag |= SEQ_OVERLAP;
}
}
seq_prev = seq;
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index fe793875d67..59b153397c1 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -167,8 +167,9 @@ typedef struct Sequence {
* frames that use the last frame after data ends.
*/
int startstill, endstill;
- /** Machine: the strip channel, depth the depth in the sequence when dealing with metastrips. */
- int machine, depth;
+ /** Machine: the strip channel */
+ int machine;
+ int _pad3;
/** Starting and ending points of the strip in the sequence. */
int startdisp, enddisp;
float sat;
diff --git a/source/blender/sequencer/SEQ_time.h b/source/blender/sequencer/SEQ_time.h
index 67d3a2e5960..593a8fe7bf2 100644
--- a/source/blender/sequencer/SEQ_time.h
+++ b/source/blender/sequencer/SEQ_time.h
@@ -46,6 +46,7 @@ void SEQ_time_update_sequence(struct Scene *scene, struct Sequence *seq);
void SEQ_time_update_sequence_bounds(struct Scene *scene, struct Sequence *seq);
int SEQ_time_cmp_time_startdisp(const void *a, const void *b);
bool SEQ_time_strip_intersects_frame(const struct Sequence *seq, const int timeline_frame);
+void SEQ_time_update_meta_strip_range(struct Scene *scene, struct Sequence *seq_meta);
#ifdef __cplusplus
}
diff --git a/source/blender/sequencer/intern/strip_time.c b/source/blender/sequencer/intern/strip_time.c
index b8b6f62c7aa..65756006fa9 100644
--- a/source/blender/sequencer/intern/strip_time.c
+++ b/source/blender/sequencer/intern/strip_time.c
@@ -184,7 +184,7 @@ static void seq_time_update_meta_strip(Scene *scene, Sequence *seq_meta)
seq_update_sound_bounds_recursive(scene, seq_meta);
}
-static void seq_time_update_meta_strip_range(Scene *scene, Sequence *seq_meta)
+void SEQ_time_update_meta_strip_range(Scene *scene, Sequence *seq_meta)
{
seq_time_update_meta_strip(scene, seq_meta);
@@ -250,7 +250,7 @@ void SEQ_time_update_sequence(Scene *scene, Sequence *seq)
Editing *ed = SEQ_editing_get(scene, false);
MetaStack *ms = SEQ_meta_stack_active_get(ed);
if (ms != NULL) {
- seq_time_update_meta_strip_range(scene, ms->parseq);
+ SEQ_time_update_meta_strip_range(scene, ms->parseq);
}
SEQ_time_update_sequence_bounds(scene, seq);
diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c
index a02d8a1428e..b969f531e68 100644
--- a/source/blender/sequencer/intern/strip_transform.c
+++ b/source/blender/sequencer/intern/strip_transform.c
@@ -233,14 +233,22 @@ void SEQ_transform_translate_sequence(Scene *evil_scene, Sequence *seq, int delt
SEQ_offset_animdata(evil_scene, seq, delta);
seq->start += delta;
+ /* Meta strips requires special handling: their content is to be translated, and then frame range
+ * of the meta is to be updated for the updated content. */
if (seq->type == SEQ_TYPE_META) {
Sequence *seq_child;
for (seq_child = seq->seqbase.first; seq_child; seq_child = seq_child->next) {
SEQ_transform_translate_sequence(evil_scene, seq_child, delta);
}
+ /* Ensure that meta bounds are updated, but this function prevents resets seq->start and
+ * start/end point in timeline. */
+ SEQ_time_update_meta_strip_range(evil_scene, seq);
+ /* Move meta start/end points. */
+ SEQ_transform_set_left_handle_frame(seq, seq->startdisp + delta);
+ SEQ_transform_set_right_handle_frame(seq, seq->enddisp + delta);
}
- SEQ_time_update_sequence_bounds(evil_scene, seq);
+ SEQ_time_update_sequence(evil_scene, seq);
}
/* return 0 if there weren't enough space */