[Bf-blender-cvs] [3ccdee75328] master: UI: View2D: Align vertical indicators to view

Pablo Vazquez noreply at git.blender.org
Fri Oct 15 02:54:14 CEST 2021


Commit: 3ccdee75328bf8c5f0846f27d66407fcef0ee3e9
Author: Pablo Vazquez
Date:   Fri Oct 15 02:51:17 2021 +0200
Branches: master
https://developer.blender.org/rB3ccdee75328bf8c5f0846f27d66407fcef0ee3e9

UI: View2D: Align vertical indicators to view

In editors with vertical scale indicators, such as Graph Editor,
Drivers, or VSE, display the values aligned to the view.

Also add a shadow (similar to the 3D View info) to improve readability when the text is on top of curves, strips, or other content.

{F10987240, size=full}

Reviewed By: Severin

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

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

M	release/datafiles/locale
M	release/scripts/addons
M	release/scripts/addons_contrib
M	source/blender/editors/interface/view2d_draw.c
M	source/tools

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 4833954c0ac..75e46177f36 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 4833954c0ac85cc407e1d5a153aa11b1d1823ec0
+Subproject commit 75e46177f36a49ad36b917e641ee1586ddef7092
diff --git a/release/scripts/addons b/release/scripts/addons
index 67f1fbca148..f10ca8c1561 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 67f1fbca1482d9d9362a4001332e785c3fd5d230
+Subproject commit f10ca8c156169b24e70027a43f718f99571d280f
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 5a82baad9f9..42da56aa737 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 5a82baad9f986722104280e8354a4427d8e9eab1
+Subproject commit 42da56aa73726710107031787af5eea186797984
diff --git a/source/blender/editors/interface/view2d_draw.c b/source/blender/editors/interface/view2d_draw.c
index fd4dba30c1c..a4b37e571d7 100644
--- a/source/blender/editors/interface/view2d_draw.c
+++ b/source/blender/editors/interface/view2d_draw.c
@@ -394,29 +394,33 @@ static void draw_vertical_scale_indicators(const ARegion *region,
   const int font_id = BLF_default();
   UI_FontThemeColor(font_id, colorid);
 
-  BLF_enable(font_id, BLF_ROTATION);
-  BLF_rotation(font_id, M_PI_2);
-
   BLF_batch_draw_begin();
 
-  const float xpos = rect->xmax - 2.0f * UI_DPI_FAC;
+  BLF_enable(font_id, BLF_SHADOW);
+  const float shadow_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
+  BLF_shadow(font_id, 5, shadow_color);
+  BLF_shadow_offset(font_id, 1, -1);
+
+  const float x_offset = 8.0f;
+  const float xpos = (rect->xmin + x_offset) * UI_DPI_FAC;
   const float ymin = rect->ymin;
   const float ymax = rect->ymax;
+  const float y_offset = (BLF_height_max(font_id) / 2.0f) - U.pixelsize;
 
   for (uint i = 0; i < steps; i++) {
     const float ypos_view = start + i * distance;
     const float ypos_region = UI_view2d_view_to_region_y(v2d, ypos_view + display_offset);
     char text[32];
     to_string(to_string_data, ypos_view, distance, sizeof(text), text);
-    const float text_width = BLF_width(font_id, text, strlen(text));
 
-    if (ypos_region - text_width / 2.0f >= ymin && ypos_region + text_width / 2.0f <= ymax) {
-      BLF_draw_default(xpos, ypos_region - text_width / 2.0f, 0.0f, text, sizeof(text));
+    if (ypos_region - y_offset >= ymin && ypos_region + y_offset <= ymax) {
+      BLF_draw_default(xpos, ypos_region - y_offset, 0.0f, text, sizeof(text));
     }
   }
 
+  BLF_disable(font_id, BLF_SHADOW);
+
   BLF_batch_draw_end();
-  BLF_disable(font_id, BLF_ROTATION);
 
   GPU_matrix_pop_projection();
 }
diff --git a/source/tools b/source/tools
index 01f51a0e551..5061594ee62 160000
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit 01f51a0e551ab730f0934dc6488613690ac4bf8f
+Subproject commit 5061594ee62b8eabf705443a5483c7a1dfaa8789



More information about the Bf-blender-cvs mailing list