diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-05 16:09:33 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-05 16:21:50 +0300 |
commit | 648350e456490f8d6258e7de9bf94d3a6a34dbb2 (patch) | |
tree | ebadc06ad8d97cfd98659084fa3277430b875f12 /source/blender/editors/transform/transform_mode_rotate.c | |
parent | d450a791c37e4df0b37aab4feb8925fef206c4c8 (diff) |
UI: show gizmo while transforming
When interacting with translate/rotate/scale gizmo, show the gizmo while
it's in use. There are some exceptions to this, as showing all scale
gizmos while scaling causes the gizmos to become large & distracting so
in this case only the gizmo being dragged is shown.
Resolves T63743.
Diffstat (limited to 'source/blender/editors/transform/transform_mode_rotate.c')
-rw-r--r-- | source/blender/editors/transform/transform_mode_rotate.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform_mode_rotate.c b/source/blender/editors/transform/transform_mode_rotate.c index 4b86adc4f46..94caaa288e5 100644 --- a/source/blender/editors/transform/transform_mode_rotate.c +++ b/source/blender/editors/transform/transform_mode_rotate.c @@ -322,10 +322,30 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2])) ED_area_status_text(t->area, str); } +static void applyRotationMatrix(TransInfo *t, float mat_xform[4][4]) +{ + float axis_final[3]; + const float angle_final = t->values_final[0]; + if ((t->con.mode & CON_APPLY) && t->con.applyRot) { + t->con.applyRot(t, NULL, NULL, axis_final, NULL); + } + else { + negate_v3_v3(axis_final, t->spacemtx[t->orient_axis]); + } + + float mat3[3][3]; + float mat4[4][4]; + axis_angle_normalized_to_mat3(mat3, axis_final, angle_final); + copy_m4_m3(mat4, mat3); + transform_pivot_set_m4(mat4, t->center_global); + mul_m4_m4m4(mat_xform, mat4, mat_xform); +} + void initRotation(TransInfo *t) { t->mode = TFM_ROTATION; t->transform = applyRotation; + t->transform_matrix = applyRotationMatrix; t->tsnap.applySnap = ApplySnapRotation; t->tsnap.distance = RotationBetween; |