From 291af7418e122d0b1f4fbf21ba4f7b7ceb26cd10 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 18 Jul 2005 19:36:17 +0000 Subject: [PATCH] Two small fixes (armatures); - adding relations to pose-constraints should call DAG on the pose - prevented constraints to break "IK" chains --- source/blender/blenkernel/intern/armature.c | 24 +++++++-------------- source/blender/src/buttons_object.c | 1 + 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 82cf3bf51d3..276f16bdd1a 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -571,22 +571,6 @@ void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[] Mat4CpyMat4(M_accumulatedMatrix, bone->arm_mat); } -#if 0 -/* IK in the sense of; connected directly */ -static Bone *get_last_ik_bone (Bone *bone) -{ - Bone *curBone; - - for (curBone = bone->childbase.first; curBone; curBone=curBone->next){ - if (curBone->flag & BONE_IK_TOPARENT){ - return get_last_ik_bone (curBone); - } - } - - return bone; -} - -#endif /* **************** The new & simple (but OK!) armature evaluation ********* */ @@ -1029,6 +1013,9 @@ static void where_is_pose_bone(Object *ob, bPoseChannel *pchan) if(pchan->constraints.first) { static Object conOb; static int initialized= 0; + float vec[3]; + + VECCOPY(vec, pchan->pose_mat[3]); /* Build a workob to pass the bone to the constraint solver */ if(initialized==0) { @@ -1054,6 +1041,11 @@ static void where_is_pose_bone(Object *ob, bPoseChannel *pchan) /* Take out of worldspace */ Mat4MulMat4 (pchan->pose_mat, conOb.obmat, ob->imat); + + /* prevent constraints breaking a chain */ + if(pchan->bone->flag & BONE_IK_TOPARENT) + VECCOPY(pchan->pose_mat[3], vec); + } /* calculate head */ diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index c8256ee03f1..c835b4c2257 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -811,6 +811,7 @@ void do_constraintbuts(unsigned short event) case B_CONSTRAINT_DEL: case B_CONSTRAINT_CHANGETARGET: + if(ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels DAG_scene_sort(G.scene); break;