From a80c0ee16784a7338a041474fed3f609bb59fa14 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Sun, 31 Jan 2021 10:21:05 -0300 Subject: Revert "Cleanup: remove unused argument" This reverts commit 780857f8e8139613711cba041f5f0af9799804ec. The `axismtx` argument was supposed to be used. --- .../editors/transform/transform_constraints.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/transform') diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index b6383cce79c..3d80894c1e0 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -537,7 +537,10 @@ static void applyObjectConstraintSize(TransInfo *t, } } -static void constraints_rotation_imp(TransInfo *t, float r_vec[3], float *r_angle) +static void constraints_rotation_imp(TransInfo *t, + float axismtx[3][3], + float r_vec[3], + float *r_angle) { BLI_assert(t->con.mode & CON_APPLY); int mode = t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2); @@ -581,7 +584,7 @@ static void applyAxisConstraintRot( TransInfo *t, TransDataContainer *UNUSED(tc), TransData *td, float vec[3], float *angle) { if (!td && t->con.mode & CON_APPLY) { - constraints_rotation_imp(t, vec, angle); + constraints_rotation_imp(t, t->spacemtx, vec, angle); } } @@ -602,13 +605,25 @@ static void applyObjectConstraintRot( TransInfo *t, TransDataContainer *tc, TransData *td, float vec[3], float *angle) { if (t->con.mode & CON_APPLY) { + float tmp_axismtx[3][3]; + float(*axismtx)[3]; + /* on setup call, use first object */ if (td == NULL) { BLI_assert(tc == NULL); tc = TRANS_DATA_CONTAINER_FIRST_OK(t); td = tc->data; } - constraints_rotation_imp(t, vec, angle); + + if (t->flag & T_EDIT) { + mul_m3_m3m3(tmp_axismtx, tc->mat3_unit, td->axismtx); + axismtx = tmp_axismtx; + } + else { + axismtx = td->axismtx; + } + + constraints_rotation_imp(t, axismtx, vec, angle); } } -- cgit v1.2.3