diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-19 03:38:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-19 03:40:59 +0300 |
commit | 90be7e90e0dd4ed3842d3c371dbeb2cbc6573aea (patch) | |
tree | 6ee8b37d75f09f4e42ddf9330c3fa05ad3f391a1 /source/blender/editors/space_view3d | |
parent | 5dc2ecdf05da4d24a7a57627caece6e22118c2d5 (diff) |
Gizmo: tweak navigation highlight display
Show occluded axis highlight on top when pointing away.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c | 26 |
1 files changed, 17 insertions, 9 deletions
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; |