[Bf-blender-cvs] [ecd86c05879] master: UI: Fix grid scale text not having shadows in the 3d view infos

Alessio Monti di Sopra noreply at git.blender.org
Fri Oct 11 17:29:46 CEST 2019


Commit: ecd86c05879dc0802d7fb463d64b96559e43a4df
Author: Alessio Monti di Sopra
Date:   Fri Oct 11 12:27:34 2019 -0300
Branches: master
https://developer.blender.org/rBecd86c05879dc0802d7fb463d64b96559e43a4df

UI: Fix grid scale text not having shadows in the 3d view infos

This commit adds a shadow to the grid scale info text in the 3d View,
to make it more visible like the rest of that section.

{F7798605}

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

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

M	source/blender/editors/space_view3d/view3d_draw.c

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

diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index aafd36a5bb8..3ee9755cb06 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1422,18 +1422,24 @@ static void draw_grid_unit_name(
 {
   if (!rv3d->is_persp && RV3D_VIEW_IS_AXIS(rv3d->view)) {
     const char *grid_unit = NULL;
+    int font_id = BLF_default();
     ED_view3d_grid_view_scale(scene, v3d, rv3d, &grid_unit);
 
     if (grid_unit) {
       char numstr[32] = "";
-      UI_FontThemeColor(BLF_default(), TH_TEXT_HI);
+      UI_FontThemeColor(font_id, TH_TEXT_HI);
       if (v3d->grid != 1.0f) {
         BLI_snprintf(numstr, sizeof(numstr), "%s x %.4g", grid_unit, v3d->grid);
       }
 
       *yoffset -= U.widget_unit;
+      BLF_enable(font_id, BLF_SHADOW);
+      BLF_shadow(font_id, 5, (const float[4]){0.0f, 0.0f, 0.0f, 1.0f});
+      BLF_shadow_offset(font_id, 1, -1);
       BLF_draw_default_ascii(
           xoffset, *yoffset, 0.0f, numstr[0] ? numstr : grid_unit, sizeof(numstr));
+
+      BLF_disable(font_id, BLF_SHADOW);
     }
   }
 }



More information about the Bf-blender-cvs mailing list