diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-22 07:56:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-22 07:56:50 +0400 |
commit | 2fe940f8df9c4513ad1ad0674f49818417450984 (patch) | |
tree | 973e55b1f0ea46b3018c0993efeaa3b22f1173dc /source/blender/blenkernel/intern/armature.c | |
parent | bcac1def4c1b459e116ae1957e8ac4e20a7d9192 (diff) |
Fix for snapping pose bones with axis-angle rotation.
- armature_mat_pose_to_bone() was missing axis-angle check.
- added loc_axisangle_size_to_mat4() for completeness.
- use 'const' prefix where possible in math rotation functions.
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index f0c39e6373e..f77992262a7 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1108,12 +1108,19 @@ void armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[][4], float outm /* paranoia: prevent crashes with no pose-channel supplied */ if (pchan==NULL) return; - + /* get the inverse matrix of the pchan's transforms */ - if (pchan->rotmode) - loc_eul_size_to_mat4(pc_trans, pchan->loc, pchan->eul, pchan->size); - else + switch(pchan->rotmode) { + case ROT_MODE_QUAT: loc_quat_size_to_mat4(pc_trans, pchan->loc, pchan->quat, pchan->size); + break; + case ROT_MODE_AXISANGLE: + loc_axisangle_size_to_mat4(pc_trans, pchan->loc, pchan->rotAxis, pchan->rotAngle, pchan->size); + break; + default: /* euler */ + loc_eul_size_to_mat4(pc_trans, pchan->loc, pchan->eul, pchan->size); + } + invert_m4_m4(inv_trans, pc_trans); /* Remove the pchan's transforms from it's pose_mat. |