[Bf-blender-cvs] [41c0c79e312] blender-v2.93-release: VSE: Fix meta strip boundary can not be changed

Richard Antalik noreply at git.blender.org
Wed May 12 20:24:49 CEST 2021


Commit: 41c0c79e31284637fb603d31c5c3cfda22f54614
Author: Richard Antalik
Date:   Tue May 11 12:25:54 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB41c0c79e31284637fb603d31c5c3cfda22f54614

VSE: Fix meta strip boundary can not be changed

In e1f3996d740c, logic for changing metastrip start and end frame based
on contained strips was removed. This was done intentionally and
incorrect functionality wasn't noticed as drawing code reflected
seemingly correct state.

Original code was mostly correct, because meta strip doesn't store its
internal start and end points. This code was restored with minor
modifications so function `SEQ_time_update_sequence()` is fully self
contained as it is used not only by transform operator.

In addition, drawing glitches that happen when meta content is outside
of meta boundaries were fixed. These glitches were not caused by
e1f3996d740c.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11215

===================================================================

M	source/blender/editors/space_sequencer/sequencer_draw.c
M	source/blender/sequencer/intern/strip_time.c

===================================================================

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 370a1942d20..b55c8035fa3 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -885,10 +885,12 @@ static void draw_seq_background(Scene *scene,
     immUniformColor4ubv(col);
 
     if (seq->startstill) {
-      immRectf(pos, seq->startdisp, y1, (float)(seq->start), y2);
+      const float content_start = min_ff(seq->enddisp, seq->start);
+      immRectf(pos, seq->startdisp, y1, content_start, y2);
     }
     if (seq->endstill) {
-      immRectf(pos, (float)(seq->start + seq->len), y1, seq->enddisp, y2);
+      const float content_end = max_ff(seq->startdisp, seq->start + seq->len);
+      immRectf(pos, content_end, y1, seq->enddisp, y2);
     }
   }
 
@@ -1105,6 +1107,10 @@ static void draw_seq_strip(const bContext *C,
   x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp;
   y2 = seq->machine + SEQ_STRIP_OFSTOP;
 
+  /* Limit body to strip bounds. Meta strip can end up with content outside of strip range. */
+  x1 = min_ff(x1, seq->enddisp);
+  x2 = max_ff(x2, seq->startdisp);
+
   float text_margin_y;
   bool y_threshold;
   if ((sseq->flag & SEQ_SHOW_STRIP_NAME) || (sseq->flag & SEQ_SHOW_STRIP_SOURCE) ||
diff --git a/source/blender/sequencer/intern/strip_time.c b/source/blender/sequencer/intern/strip_time.c
index 21dc9aa2cdd..4a01b0e1938 100644
--- a/source/blender/sequencer/intern/strip_time.c
+++ b/source/blender/sequencer/intern/strip_time.c
@@ -39,6 +39,7 @@
 #include "SEQ_render.h"
 #include "SEQ_sequencer.h"
 #include "SEQ_time.h"
+#include "SEQ_transform.h"
 
 #include "strip_time.h"
 #include "utils.h"
@@ -161,6 +162,36 @@ void SEQ_time_update_sequence_bounds(Scene *scene, Sequence *seq)
   }
 }
 
+static void seq_time_update_meta_strip(Scene *scene, Sequence *seq_meta)
+{
+  if (BLI_listbase_is_empty(&seq_meta->seqbase)) {
+    return;
+  }
+
+  int min = MAXFRAME * 2;
+  int max = -MAXFRAME * 2;
+  LISTBASE_FOREACH (Sequence *, seq, &seq_meta->seqbase) {
+    min = min_ii(seq->startdisp, min);
+    max = max_ii(seq->enddisp, max);
+  }
+
+  seq_meta->start = min + seq_meta->anim_startofs;
+  seq_meta->len = max - min;
+  seq_meta->len -= seq_meta->anim_startofs;
+  seq_meta->len -= seq_meta->anim_endofs;
+
+  seq_update_sound_bounds_recursive(scene, seq_meta);
+}
+
+static void seq_time_update_meta_strip_range(Scene *scene, Sequence *seq_meta)
+{
+  seq_time_update_meta_strip(scene, seq_meta);
+
+  /*  Prevent metastrip to move in timeline. */
+  SEQ_transform_set_left_handle_frame(seq_meta, seq_meta->startdisp);
+  SEQ_transform_set_right_handle_frame(seq_meta, seq_meta->enddisp);
+}
+
 void SEQ_time_update_sequence(Scene *scene, Sequence *seq)
 {
   Sequence *seqm;
@@ -211,6 +242,16 @@ void SEQ_time_update_sequence(Scene *scene, Sequence *seq)
     }
   }
   else {
+    if (seq->type == SEQ_TYPE_META) {
+      seq_time_update_meta_strip(scene, 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_sequence_bounds(scene, seq);
   }
 }



More information about the Bf-blender-cvs mailing list