Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-06-05 16:39:21 +0300
committerCampbell Barton <campbell@blender.org>2022-06-05 16:43:07 +0300
commit72ea37ae5fca88aee03bf9354dd9329121bbe01f (patch)
tree70a4fd8711120956592c02954a911edd5f58e10a
parent648350e456490f8d6258e7de9bf94d3a6a34dbb2 (diff)
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.
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index 4499be66d5a..fa2e80b51db 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -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) {