[Bf-blender-cvs] [f5cc3486107] master: VSE: Draw strips transparent during transform overlap

Pablo Vazquez noreply at git.blender.org
Tue Jul 27 20:15:01 CEST 2021


Commit: f5cc34861076ec832b2bac6628a5f43be5b042a2
Author: Pablo Vazquez
Date:   Tue Jul 27 20:14:22 2021 +0200
Branches: master
https://developer.blender.org/rBf5cc34861076ec832b2bac6628a5f43be5b042a2

VSE: Draw strips transparent during transform overlap

While transforming a strip, draw the background semi-transparent
if it overlaps with another strip. It's convenient to see what's
underneath, especially with the upcoming Overwrite feature.

Thanks to @iss for the help and review.

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

M	source/blender/editors/space_sequencer/sequencer_draw.c

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

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index cdbe5bc63ce..9b63d5c4b8b 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -100,6 +100,7 @@
 #define SEQ_HANDLE_SIZE 8.0f
 #define SEQ_SCROLLER_TEXT_OFFSET 8
 #define MUTE_ALPHA 120
+#define OVERLAP_ALPHA 180
 
 /* NOTE: Don't use SEQ_ALL_BEGIN/SEQ_ALL_END while drawing!
  * it messes up transform. */
@@ -802,11 +803,17 @@ static void draw_color_strip_band(Sequence *seq, uint pos, float text_margin_y,
   uchar col[4];
   SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
 
+  GPU_blend(GPU_BLEND_ALPHA);
   rgb_float_to_uchar(col, colvars->col);
+
+  /* Draw muted strips semi-transparent. */
   if (seq->flag & SEQ_MUTE) {
-    GPU_blend(GPU_BLEND_ALPHA);
     col[3] = MUTE_ALPHA;
   }
+  /* Draw background semi-transparent when overlapping strips. */
+  else if (seq->flag & SEQ_OVERLAP) {
+    col[3] = OVERLAP_ALPHA;
+  }
   else {
     col[3] = 255;
   }
@@ -824,9 +831,7 @@ static void draw_color_strip_band(Sequence *seq, uint pos, float text_margin_y,
   immVertex2f(pos, seq->enddisp, text_margin_y);
   immEnd();
 
-  if (seq->flag & SEQ_MUTE) {
-    GPU_blend(GPU_BLEND_NONE);
-  }
+  GPU_blend(GPU_BLEND_NONE);
 }
 
 static void draw_seq_background(Scene *scene,
@@ -839,6 +844,7 @@ static void draw_seq_background(Scene *scene,
                                 bool is_single_image)
 {
   uchar col[4];
+  GPU_blend(GPU_BLEND_ALPHA);
 
   /* Get the correct color per strip type, transitions use their inputs ones. */
   if (ELEM(seq->type, SEQ_TYPE_CROSS, SEQ_TYPE_GAMCROSS, SEQ_TYPE_WIPE)) {
@@ -855,14 +861,18 @@ static void draw_seq_background(Scene *scene,
     color3ubv_from_seq(scene, seq, col);
   }
 
+  /* Draw muted strips semi-transparent. */
   if (seq->flag & SEQ_MUTE) {
-    GPU_blend(GPU_BLEND_ALPHA);
-
     col[3] = MUTE_ALPHA;
   }
+  /* Draw background semi-transparent when overlapping strips. */
+  else if (seq->flag & SEQ_OVERLAP) {
+    col[3] = OVERLAP_ALPHA;
+  }
   else {
     col[3] = 255;
   }
+
   immUniformColor4ubv(col);
 
   /* Draw the main strip body. */
@@ -922,9 +932,7 @@ static void draw_seq_background(Scene *scene,
     immEnd();
   }
 
-  if (seq->flag & SEQ_MUTE) {
-    GPU_blend(GPU_BLEND_NONE);
-  }
+  GPU_blend(GPU_BLEND_NONE);
 }
 
 static void draw_seq_locked(float x1, float y1, float x2, float y2)



More information about the Bf-blender-cvs mailing list