[Bf-blender-cvs] [90be7e90e0d] blender2.8: Gizmo: tweak navigation highlight display

Campbell Barton noreply at git.blender.org
Mon Nov 19 01:41:18 CET 2018


Commit: 90be7e90e0dd4ed3842d3c371dbeb2cbc6573aea
Author: Campbell Barton
Date:   Mon Nov 19 11:38:48 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB90be7e90e0dd4ed3842d3c371dbeb2cbc6573aea

Gizmo: tweak navigation highlight display

Show occluded axis highlight on top when pointing away.

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

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 356f671345a..1358204a3a4 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
@@ -209,7 +209,7 @@ static void axis_geom_draw(
 		float depth;
 		char index;
 		char axis;
-		char is_pos;
+		bool is_pos;
 	} axis_order[6] = {
 		{-gz->matrix_offset[0][2], 0, 0, false},
 		{+gz->matrix_offset[0][2], 1, 0, true},
@@ -218,6 +218,22 @@ static void axis_geom_draw(
 		{-gz->matrix_offset[2][2], 4, 2, false},
 		{+gz->matrix_offset[2][2], 5, 2, true},
 	};
+
+	int axis_align = -1;
+	for (int axis = 0; axis < 3; axis++) {
+		if (len_squared_v2(gz->matrix_offset[axis]) < 1e-6f) {
+			axis_align = axis;
+			break;
+		}
+	}
+
+	/* Show backwards pointing highlight on-top (else we can't see it at all). */
+	if ((select == false) && (gz->highlight_part > 0) && (axis_align != -1)) {
+		if (axis_order[gz->highlight_part - 1].is_pos == false) {
+			axis_order[gz->highlight_part - 1].depth = FLT_MAX;
+		}
+	}
+
 	qsort(&axis_order, ARRAY_SIZE(axis_order), sizeof(axis_order[0]), BLI_sortutil_cmp_float);
 
 	static const float axis_highlight[4] = {1, 1, 1, 1};
@@ -256,14 +272,6 @@ static void axis_geom_draw(
 
 	bool draw_center_done = false;
 
-	int axis_align = -1;
-	for (int axis = 0; axis < 3; axis++) {
-		if (len_squared_v2(gz->matrix_offset[axis]) < 1e-6f) {
-			axis_align = axis;
-			break;
-		}
-	}
-
 	for (int axis_index = 0; axis_index < ARRAY_SIZE(axis_order); axis_index++) {
 		const int index = axis_order[axis_index].index;
 		const int axis = axis_order[axis_index].axis;



More information about the Bf-blender-cvs mailing list