[Bf-blender-cvs] [452c78757f4] master: UI: Improve contrast on playhead

Pablo Vazquez noreply at git.blender.org
Sun Oct 17 19:10:34 CEST 2021


Commit: 452c78757f44fe456dd10ee16bc509ab5455526b
Author: Pablo Vazquez
Date:   Sun Oct 17 19:06:45 2021 +0200
Branches: master
https://developer.blender.org/rB452c78757f44fe456dd10ee16bc509ab5455526b

UI: Improve contrast on playhead

Add an outine around the playhead, matching the color of the background (slightly darkened)
to improve the readability of the current frame line when placed against curves or strips
with a similar color.

{F10944336, size=full}

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

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

M	source/blender/editors/animation/time_scrub_ui.c

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

diff --git a/source/blender/editors/animation/time_scrub_ui.c b/source/blender/editors/animation/time_scrub_ui.c
index b0eb014c5d9..94366a5e852 100644
--- a/source/blender/editors/animation/time_scrub_ui.c
+++ b/source/blender/editors/animation/time_scrub_ui.c
@@ -101,6 +101,7 @@ static void draw_current_frame(const Scene *scene,
   float text_width = UI_fontstyle_string_width(fstyle, frame_str);
   float box_width = MAX2(text_width + 8 * UI_DPI_FAC, 24 * UI_DPI_FAC);
   float box_padding = 3 * UI_DPI_FAC;
+  const int line_outline = max_ii(1, round_fl_to_int(1 * UI_DPI_FAC));
 
   float bg_color[4];
   UI_GetThemeColorShade4fv(TH_CFRAME, -5, bg_color);
@@ -109,7 +110,19 @@ static void draw_current_frame(const Scene *scene,
   const float subframe_x = UI_view2d_view_to_region_x(v2d, BKE_scene_ctime_get(scene));
   GPUVertFormat *format = immVertexFormat();
   uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+
+  GPU_blend(GPU_BLEND_ALPHA);
   immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+
+  /* Outline. */
+  immUniformThemeColorShadeAlpha(TH_BACK, -25, -100);
+  immRectf(pos,
+           subframe_x - (line_outline + U.pixelsize),
+           scrub_region_rect->ymax - box_padding,
+           subframe_x + (line_outline + U.pixelsize),
+           0.0f);
+
+  /* Line. */
   immUniformThemeColor(TH_CFRAME);
   immRectf(pos,
            subframe_x - U.pixelsize,
@@ -117,6 +130,7 @@ static void draw_current_frame(const Scene *scene,
            subframe_x + U.pixelsize,
            0.0f);
   immUnbindProgram();
+  GPU_blend(GPU_BLEND_NONE);
 
   UI_draw_roundbox_corner_set(UI_CNR_ALL);



More information about the Bf-blender-cvs mailing list