diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-07-28 14:44:03 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-07-28 14:44:03 +0400 |
commit | e765fbf1265b35d4091ddbc9560913dc001c5704 (patch) | |
tree | e25b2a016f5c7a436e35bba7f7a6962a820b55c6 /source | |
parent | 48b07b7f15590724c1234405e2c1f2cabf3d12b6 (diff) |
== Constraints - Important Bugfix ==
At last, the 'Local' option for Armatures works properly!
Tonight I went through carefully and cross-checked the code once again, and found several bad mistakes I had made. These were:
* the value of one variable from the armatures code was not what I expected it to be, based off the name).
* Mat4MulSerie swaps the first two args! Grrr...
Note:
There's only one rig that I've tested that was broken. That was slikdigit's "mancandy", and the part in question was the jaw. It is likely that a few more rigs out there (in particular, their 'local' action constraints) relied on the wacky rotation values that used to be used, so are now broken.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index ca82006acf8..2ab7bfb6049 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -956,32 +956,32 @@ static void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float /* pose to local */ else if (to == CONSTRAINT_SPACE_LOCAL) { if (pchan->bone) { - if (pchan->parent && pchan->parent->bone) { + if (pchan->parent) { float offs_bone[4][4]; /* construct offs_bone the same way it is done in armature.c */ Mat4CpyMat3(offs_bone, pchan->bone->bone_mat); VECCOPY(offs_bone[3], pchan->bone->head); - offs_bone[3][1]+= pchan->parent->bone->length; + offs_bone[3][1]+= pchan->bone->parent->length; if (pchan->bone->flag & BONE_HINGE) { /* pose_mat = par_pose-space_location * chan_mat */ float tmat[4][4]; /* the rotation of the parent restposition */ - Mat4CpyMat4(tmat, pchan->parent->bone->arm_mat); + Mat4CpyMat4(tmat, pchan->bone->parent->arm_mat); /* the location of actual parent transform */ VECCOPY(tmat[3], offs_bone[3]); offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f; Mat4MulVecfl(pchan->parent->pose_mat, tmat[3]); - Mat4MulMat4(diff_mat, tmat, offs_bone); + Mat4MulMat4(diff_mat, offs_bone, tmat); Mat4Invert(imat, diff_mat); } else { /* pose_mat = par_pose_mat * bone_mat * chan_mat */ - Mat4MulMat4(diff_mat, pchan->parent->pose_mat, offs_bone); + Mat4MulMat4(diff_mat, offs_bone, pchan->parent->pose_mat); Mat4Invert(imat, diff_mat); } } @@ -1017,27 +1017,27 @@ static void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float /* construct offs_bone the same way it is done in armature.c */ Mat4CpyMat3(offs_bone, pchan->bone->bone_mat); VECCOPY(offs_bone[3], pchan->bone->head); - offs_bone[3][1]+= pchan->parent->bone->length; + offs_bone[3][1]+= pchan->bone->parent->length; if (pchan->bone->flag & BONE_HINGE) { /* pose_mat = par_pose-space_location * chan_mat */ float tmat[4][4]; /* the rotation of the parent restposition */ - Mat4CpyMat4(tmat, pchan->parent->bone->arm_mat); + Mat4CpyMat4(tmat, pchan->bone->parent->arm_mat); /* the location of actual parent transform */ VECCOPY(tmat[3], offs_bone[3]); offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f; Mat4MulVecfl(pchan->parent->pose_mat, tmat[3]); - Mat4MulMat4(diff_mat, tmat, offs_bone); + Mat4MulMat4(diff_mat, offs_bone, tmat); Mat4CpyMat4(tempmat, mat); Mat4MulMat4(mat, tempmat, diff_mat); } else { /* pose_mat = par_pose_mat * bone_mat * chan_mat */ - Mat4MulMat4(diff_mat, pchan->parent->pose_mat, offs_bone); + Mat4MulMat4(diff_mat, offs_bone, pchan->parent->pose_mat); Mat4CpyMat4(tempmat, mat); Mat4MulMat4(mat, tempmat, diff_mat); } |