Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2005-10-21 03:07:43 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2005-10-21 03:07:43 +0400
commit70024f7f62e360f8121f632a72921de2fba7159b (patch)
treea5128d4e22b7038395b6a04c779c2bff3e8fe616 /source
parent446a007a439b9eda1d5dc99295f1924e93ce4aa4 (diff)
Bugfix: #3149, Parent rotation influences DoF / rotation limits
The rotation of the parent of the root in an IK chain was included in the segment's basis, leading to the DoF / rotation limits to be computed on the wrong basis.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/armature.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index a15cfc93092..5b8899e7fa7 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1161,14 +1161,16 @@ static void execute_posetree(Object *ob, PoseTree *tree)
/* gather transformations for this IK segment */
- if(a>0 && pchan->parent) {
+ if (pchan->parent)
Mat3CpyMat4(R_parmat, pchan->parent->pose_mat);
- VECCOPY(start, bone->head); /* bone offset */
- }
- else {
+ else
Mat3One(R_parmat);
+
+ /* bone offset */
+ if (pchan->parent && (a > 0))
+ VecCopyf(start, bone->head);
+ else
start[0]= start[1]= start[2]= 0.0f;
- }
/* change length based on bone size */
length= bone->length*VecLength(R_bonemat[1]);
@@ -1212,7 +1214,13 @@ static void execute_posetree(Object *ob, PoseTree *tree)
/* first set the goal inverse transform, assuming the root of tree was done ok! */
pchan= tree->pchan[0];
- Mat4One(rootmat);
+ if (pchan->parent)
+ /* transform goal by parent mat, so this rotation is not part of the
+ segment's basis. otherwise rotation limits do not work on the
+ local transform of the segment itself. */
+ Mat4CpyMat4(rootmat, pchan->parent->pose_mat);
+ else
+ Mat4One(rootmat);
VECCOPY(rootmat[3], pchan->pose_head);
Mat4MulMat4 (imat, rootmat, ob->obmat);