[Bf-blender-cvs] [2d468fc072f] master: UI: subtle outline for negative 3D view gizmo axes

Campbell Barton noreply at git.blender.org
Sun Mar 3 14:52:11 CET 2019


Commit: 2d468fc072fc0c70f3eaf0fd8d6788700b567734
Author: Campbell Barton
Date:   Mon Mar 4 00:48:34 2019 +1100
Branches: master
https://developer.blender.org/rB2d468fc072fc0c70f3eaf0fd8d6788700b567734

UI: subtle outline for negative 3D view gizmo axes

Without this they can blend in visually with the backdrop of the gizmo.

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

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

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

diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
index fa1b91b255d..f9b67a430e6 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
@@ -261,8 +261,11 @@ static void axis_geom_draw(
 	}
 #endif
 
+	/* When the cursor is over any of the gizmos (show circle backdrop). */
+	const bool is_active = (color[3] != 0.0f);
+
 	/* Circle defining active area. */
-	if (color[3] != 0.0f) {
+	if (is_active) {
 		immUniformColor4fv(color);
 		imm_draw_circle_fill_3d(pos_id, 0, 0, 1.0f, DIAL_RESOLUTION);
 	}
@@ -352,6 +355,18 @@ static void axis_geom_draw(
 
 				GPUBatch *sphere = GPU_batch_preset_sphere(0);
 				GPU_batch_program_set_builtin(sphere, GPU_SHADER_3D_UNIFORM_COLOR);
+
+				/* Black outlines for negative axis balls, otherwise they can be hard to see since
+				 * they use a faded color which can be similar to the circle backdrop in tone. */
+				if (is_active && !is_highlight && !is_pos && !select && !(axis_align == axis)) {
+					static const float axis_black_faded[4] = {0, 0, 0, 0.2f};
+					const float scale = 1.15f;
+					GPU_matrix_scale_1f(scale);
+					GPU_batch_uniform_4fv(sphere, "color", axis_black_faded);
+					GPU_batch_draw(sphere);
+					GPU_matrix_scale_1f(1.0 / scale);
+				}
+
 				GPU_batch_uniform_4fv(sphere, "color", is_pos_color ? color_current : color_current_fade);
 				GPU_batch_draw(sphere);
 				GPU_matrix_pop();



More information about the Bf-blender-cvs mailing list