Fix: VSE timeline strip outline readability
With selected strips, it is not clear where one of them begins and another ends since their outlines are right next to each other. This changes strip look so that: - All strips have consistent dark 1pt outline at the outer edge. - Selected strips have 2pt highlight inside said outer edge. - Selected strips also have a 1pt wide 33% opacity darker line inside the selection highlight (and inside possible handles). To improve readability in case strip content happens to be similar to selection/active color. Images in PR. Pull Request: https://projects.blender.org/blender/blender/pulls/123431
This commit is contained in:
committed by
Aras Pranckevicius
parent
a9fe638972
commit
b76a95b8b4
@@ -49,7 +49,7 @@ StripsDrawBatch::StripsDrawBatch(float pixelx, float pixely) : strips_(GPU_SEQ_S
|
||||
context_.pixelsize = U.pixelsize;
|
||||
|
||||
uchar col[4];
|
||||
UI_GetThemeColor3ubv(TH_BACK, col);
|
||||
UI_GetThemeColorShade3ubv(TH_BACK, -40, col);
|
||||
col[3] = 255;
|
||||
context_.col_back = color_pack(col);
|
||||
|
||||
|
||||
@@ -1247,15 +1247,10 @@ static void visible_strips_ordered_get(TimelineDrawContext *timeline_ctx,
|
||||
Vector<Sequence *> strips = sequencer_visible_strips_get(timeline_ctx->C);
|
||||
r_unselected.clear();
|
||||
r_selected.clear();
|
||||
const bool act_seq_is_selected = act_seq != nullptr && (act_seq->flag & SELECT) != 0;
|
||||
|
||||
if (act_seq_is_selected) {
|
||||
strips.remove_if([&](Sequence *seq) { return seq == act_seq; });
|
||||
}
|
||||
|
||||
for (Sequence *seq : strips) {
|
||||
/* Selected active will be added last. */
|
||||
if (act_seq_is_selected && seq == act_seq) {
|
||||
/* Active will be added last. */
|
||||
if (seq == act_seq) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1267,10 +1262,15 @@ static void visible_strips_ordered_get(TimelineDrawContext *timeline_ctx,
|
||||
r_selected.append(strip_ctx);
|
||||
}
|
||||
}
|
||||
/* Add selected active, if any. */
|
||||
if (act_seq_is_selected) {
|
||||
/* Add active, if any. */
|
||||
if (act_seq) {
|
||||
StripDrawContext strip_ctx = strip_draw_context_get(timeline_ctx, act_seq);
|
||||
r_selected.append(strip_ctx);
|
||||
if ((act_seq->flag & SELECT) == 0) {
|
||||
r_unselected.append(strip_ctx);
|
||||
}
|
||||
else {
|
||||
r_selected.append(strip_ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,13 +46,11 @@ void main()
|
||||
|
||||
/* Transform strip rectangle into pixel coordinates, so that
|
||||
* rounded corners have proper aspect ratio and can be expressed in pixels.
|
||||
* Make sure strip right side does not include the last pixel.
|
||||
* Also snap to pixel grid coordinates, so that outline/border is clear
|
||||
* non-fractional pixel sizes. */
|
||||
vec2 view_to_pixel = vec2(context_data.inv_pixelx, context_data.inv_pixely);
|
||||
vec2 pos1 = round(vec2(strip.left_handle, strip.bottom) * view_to_pixel);
|
||||
vec2 pos2 = round(vec2(strip.right_handle, strip.top) * view_to_pixel);
|
||||
pos2.x -= 1.0;
|
||||
/* Make sure strip is at least 1px wide. */
|
||||
pos2.x = max(pos2.x, pos1.x + 1.0);
|
||||
vec2 size = (pos2 - pos1) * 0.5;
|
||||
@@ -177,13 +175,6 @@ void main()
|
||||
}
|
||||
}
|
||||
|
||||
/* Inset 1px line with background color. */
|
||||
if (border && selected) {
|
||||
/* Inset line should be inside regular border or inside the handles. */
|
||||
float d = max(sdf_inner - 2.0 * context_data.pixelsize, sdf);
|
||||
col = add_outline(d, 2.0, 3.0, col, unpackUnorm4x8(context_data.col_back));
|
||||
}
|
||||
|
||||
/* Outside of strip rounded rectangle? */
|
||||
if (sdf > 0.0) {
|
||||
col = vec4(0.0);
|
||||
@@ -191,7 +182,18 @@ void main()
|
||||
|
||||
/* Outline / border. */
|
||||
if (border) {
|
||||
col = add_outline(sdf, 0.0, outline_width, col, col_outline);
|
||||
|
||||
if (selected) {
|
||||
/* Selection highlight + darker inset line. */
|
||||
col = add_outline(sdf, 1.0, 3.0, col, col_outline);
|
||||
/* Inset line should be inside regular border or inside the handles. */
|
||||
float d = max(sdf_inner - 3.0 * context_data.pixelsize, sdf);
|
||||
col = add_outline(d, 3.0, 4.0, col, vec4(0, 0, 0, 0.33));
|
||||
}
|
||||
|
||||
/* Outer 1px outline for all strips. */
|
||||
col = add_outline(
|
||||
sdf, 0.0, 1.0, col, selected ? unpackUnorm4x8(context_data.col_back) : col_outline);
|
||||
}
|
||||
|
||||
fragColor = col;
|
||||
|
||||
Reference in New Issue
Block a user