[Bf-blender-cvs] [df0058061d5] blender2.8: UI: Soft drop shadow on 3D Viewport info text.

Pablo Vazquez noreply at git.blender.org
Sat Nov 3 03:47:35 CET 2018


Commit: df0058061d599ce45dad3589299349ca6f5813b9
Author: Pablo Vazquez
Date:   Sat Nov 3 03:47:25 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBdf0058061d599ce45dad3589299349ca6f5813b9

UI: Soft drop shadow on 3D Viewport info text.

Soft shadow similar to the title of pie menus to increase readability.
For the full white background issue an extra box container might be needed.

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

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 d107cfaf169..93354914390 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1081,6 +1081,8 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, const rcti *rect)
 {
 	RegionView3D *rv3d = ar->regiondata;
 	const char *name = view3d_get_name(v3d, rv3d);
+	const int font_id = BLF_default();
+
 	/* increase size for unicode languages (Chinese in utf-8...) */
 #ifdef WITH_INTERNATIONAL
 	char tmpstr[96];
@@ -1088,6 +1090,10 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, const rcti *rect)
 	char tmpstr[32];
 #endif
 
+	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);
+
 	if (v3d->localvd) {
 		BLI_snprintf(tmpstr, sizeof(tmpstr), IFACE_("%s (Local)"), name);
 		name = tmpstr;
@@ -1099,6 +1105,8 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, const rcti *rect)
 #else
 	BLF_draw_default_ascii(U.widget_unit + rect->xmin,  rect->ymax - U.widget_unit, 0.0f, name, sizeof(tmpstr));
 #endif
+
+	BLF_disable(font_id, BLF_SHADOW);
 }
 
 /**
@@ -1206,7 +1214,13 @@ static void draw_selected_name(Scene *scene, Object *ob, rcti *rect)
 		s += sprintf(s, " <%s>", markern);
 	}
 
+	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(rect->xmin + UI_UNIT_X, rect->ymax - (2 * U.widget_unit), 0.0f, info, sizeof(info));
+
+	BLF_disable(font_id, BLF_SHADOW);
 }
 
 /* ******************** view loop ***************** */



More information about the Bf-blender-cvs mailing list