Revision: 32651
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32651
Author:   aligorith
Date:     2010-10-22 13:38:10 +0200 (Fri, 22 Oct 2010)

Log Message:
-----------
Bugfix #20708: segmented bones don't work well with spline IK

There was a slight discreptancy between the tail values calculated on the 
spline before the head was displaced for the "chain offset" option and after 
this operation. However, only the original version got set. 

This small difference resulted in B-Bones thinking that the endpoints of the 
bones were in places that they were not in, hence causing the curly patterns 
observed in the report.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_armature.h
    trunk/blender/source/blender/blenkernel/intern/armature.c

Modified: trunk/blender/source/blender/blenkernel/BKE_armature.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_armature.h      2010-10-22 
11:19:11 UTC (rev 32650)
+++ trunk/blender/source/blender/blenkernel/BKE_armature.h      2010-10-22 
11:38:10 UTC (rev 32651)
@@ -91,6 +91,7 @@
 void armature_rebuild_pose(struct Object *ob, struct bArmature *arm);
 void where_is_pose (struct Scene *scene, struct Object *ob);
 void where_is_pose_bone(struct Scene *scene, struct Object *ob, struct 
bPoseChannel *pchan, float ctime, int do_extra);
+void where_is_pose_bone_tail(struct bPoseChannel *pchan);
 
 /* get_objectspace_bone_matrix has to be removed still */
 void get_objectspace_bone_matrix (struct Bone* bone, float 
M_accumulatedMatrix[][4], int root, int posed);

Modified: trunk/blender/source/blender/blenkernel/intern/armature.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/armature.c   2010-10-22 
11:19:11 UTC (rev 32650)
+++ trunk/blender/source/blender/blenkernel/intern/armature.c   2010-10-22 
11:38:10 UTC (rev 32651)
@@ -2018,8 +2018,10 @@
        /* finally, store the new transform */
        copy_m4_m4(pchan->pose_mat, poseMat);
        VECCOPY(pchan->pose_head, poseHead);
-       VECCOPY(pchan->pose_tail, poseTail);
        
+       /* recalculate tail, as it's now outdated after the head gets adjusted 
above! */
+       where_is_pose_bone_tail(pchan);
+       
        /* done! */
        pchan->flag |= POSE_DONE;
 }
@@ -2231,6 +2233,15 @@
        }
 }
 
+/* calculate tail of posechannel */
+void where_is_pose_bone_tail(bPoseChannel *pchan)
+{
+       float vec[3];
+       
+       VECCOPY(vec, pchan->pose_mat[1]);
+       mul_v3_fl(vec, pchan->bone->length);
+       add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec);
+}
 
 /* The main armature solver, does all constraints excluding IK */
 /* pchan is validated, as having bone and parent pointer
@@ -2364,9 +2375,7 @@
        /* calculate head */
        VECCOPY(pchan->pose_head, pchan->pose_mat[3]);
        /* calculate tail */
-       VECCOPY(vec, pchan->pose_mat[1]);
-       mul_v3_fl(vec, bone->length);
-       add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec);
+       where_is_pose_bone_tail(pchan);
 }
 
 /* This only reads anim data from channels, and writes to channels */


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to