diff options
Diffstat (limited to 'source/blender/editors/transform/transform_mode_rotate.c')
-rw-r--r-- | source/blender/editors/transform/transform_mode_rotate.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/editors/transform/transform_mode_rotate.c b/source/blender/editors/transform/transform_mode_rotate.c index 4b86adc4f46..a7207b36578 100644 --- a/source/blender/editors/transform/transform_mode_rotate.c +++ b/source/blender/editors/transform/transform_mode_rotate.c @@ -11,6 +11,7 @@ #include "BLI_task.h" #include "BKE_context.h" +#include "BKE_report.h" #include "BKE_unit.h" #include "ED_screen.h" @@ -304,7 +305,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2])) final = large_rotation_limit(final); } else { - applySnapping(t, &final); + applySnappingAsGroup(t, &final); if (!(activeSnap(t) && validSnap(t))) { transform_snap_increment(t, &final); } @@ -322,10 +323,35 @@ 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) { + if (t->spacetype == SPACE_ACTION) { + BKE_report(t->reports, RPT_ERROR, "Rotation is not supported in the Dope Sheet Editor"); + t->state = TRANS_CANCEL; + } + t->mode = TFM_ROTATION; t->transform = applyRotation; + t->transform_matrix = applyRotationMatrix; t->tsnap.applySnap = ApplySnapRotation; t->tsnap.distance = RotationBetween; |