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.
This commit is contained in:
parent
ae034d27d2
commit
f5cc348610
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue