diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2020-11-22 14:17:21 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2021-06-05 16:29:46 +0300 |
commit | d2dc452333a4cfd335a0075277c21349473ba678 (patch) | |
tree | 5b8e5c0c93f964232e07ceca1b7ff89c5bb5df2f /source/blender/blenkernel/intern | |
parent | 2cd1bc3aa7e66a295313c9ab82fbd7ba4b4905e1 (diff) |
Limit Rotation: add an Euler Order option.
Since Limit Rotation is based on Euler decomposition, it should allow
specifying the order to use for the same reasons as Copy Rotation does,
namely, if the bone uses Quaternion rotation for its animation channels,
there is no way to choose the order for the constraint.
Ref D9626
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 9293a2b449a..766d0f5dd2e 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1635,10 +1635,18 @@ static void rotlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UN float eul[3]; float size[3]; + /* Select the Euler rotation order, defaulting to the owner value. */ + short rot_order = cob->rotOrder; + + if (data->euler_order != CONSTRAINT_EULER_AUTO) { + rot_order = data->euler_order; + } + + /* Decompose the matrix using the specified order. */ copy_v3_v3(loc, cob->matrix[3]); mat4_to_size(size, cob->matrix); - mat4_to_eulO(eul, cob->rotOrder, cob->matrix); + mat4_to_eulO(eul, rot_order, cob->matrix); /* constraint data uses radians internally */ @@ -1671,7 +1679,7 @@ static void rotlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UN } } - loc_eulO_size_to_mat4(cob->matrix, loc, eul, size, cob->rotOrder); + loc_eulO_size_to_mat4(cob->matrix, loc, eul, size, rot_order); } static bConstraintTypeInfo CTI_ROTLIMIT = { |