UI: align gizmo scale handles to both Y and Z axes

This resolves a minor inconsistency displaying the scale gizmo handles
since they're cubes it's noticeable when they're not axes aligned.
This commit is contained in:
Campbell Barton
2022-06-05 23:39:21 +10:00
parent 648350e456
commit 72ea37ae5f

View File

@@ -1751,7 +1751,17 @@ static void gizmo_refresh_from_matrix(wmGizmoGroup *gzgroup,
gizmo_line_range(ggd->twtype, axis_type, &start_co[2], &len);
WM_gizmo_set_matrix_rotation_from_z_axis(axis, twmat[aidx_norm]);
const float *z_axis = twmat[aidx_norm];
if (axis_type == MAN_AXES_SCALE) {
/* Scale handles are cubes that don't look right when not aligned with other axes.
* This is noticeable when the axis is rotated to something besides the global-axis. */
const int aidx_norm_y = (aidx_norm + 2) % 3;
const float *y_axis = twmat[aidx_norm_y];
WM_gizmo_set_matrix_rotation_from_yz_axis(axis, y_axis, z_axis);
}
else {
WM_gizmo_set_matrix_rotation_from_z_axis(axis, z_axis);
}
RNA_float_set(axis->ptr, "length", len);
if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) {