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:
authorPablo Vazquez <pablo@blender.org>2021-07-27 21:14:22 +0300
committerPablo Vazquez <pablo@blender.org>2021-07-27 21:14:22 +0300
commitf5cc34861076ec832b2bac6628a5f43be5b042a2 (patch)
tree571e9f8319805619ece03a67b26a6e1462920ab3 /source/blender/editors/space_sequencer
parentae034d27d2461eed6a409f7df105103e7ae43a23 (diff)
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.
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c26
1 files changed, 17 insertions, 9 deletions
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)