diff options
author | Ton Roosendaal <ton@blender.org> | 2005-11-05 23:02:04 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-11-05 23:02:04 +0300 |
commit | ffdde59cf1801f6555c7ec1a65a02eb93ef9e2d3 (patch) | |
tree | 03ffdba9d0ac9cf9fdaa561cb588ca48a5832478 /source/blender/src/transform_conversions.c | |
parent | 9bba0e889eae02aec159ffba21a18e429802a9b3 (diff) |
Bugfix #3342
Target-less IK, with a hinge bone that has an offset to its parent, didn't
get applied correctly after transform.
Diffstat (limited to 'source/blender/src/transform_conversions.c')
-rwxr-xr-x | source/blender/src/transform_conversions.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index 8edbbfaf802..2f4a2f3b950 100755 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -456,6 +456,7 @@ static void apply_targetless_ik(Object *ob) bone= parchan->bone; if(parchan->parent) { + Bone *parbone= parchan->parent->bone; float offs_bone[4][4]; /* offs_bone = yoffs(b-1) + root(b) + bonemat(b) */ @@ -465,11 +466,20 @@ static void apply_targetless_ik(Object *ob) VECCOPY(offs_bone[3], bone->head); /* Get the length translation of parent (length along y axis) */ - offs_bone[3][1]+= parchan->parent->bone->length; + offs_bone[3][1]+= parbone->length; /* pose_mat(b-1) * offs_bone */ - if(parchan->bone->flag & BONE_HINGE) - Mat4MulMat4(tmat, offs_bone, parchan->parent->bone->arm_mat); + if(parchan->bone->flag & BONE_HINGE) { + /* the rotation of the parent restposition */ + Mat4CpyMat4(rmat, parbone->arm_mat); /* rmat used as temp */ + + /* the location of actual parent transform */ + VECCOPY(rmat[3], offs_bone[3]); + offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f; + Mat4MulVecfl(parchan->parent->pose_mat, rmat[3]); + + Mat4MulMat4(tmat, offs_bone, rmat); + } else Mat4MulMat4(tmat, offs_bone, parchan->parent->pose_mat); |