Cleanup: remove old, commented code for constraints' space conversion for bones.
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 25 Oct 2012 10:14:35 +0000 (10:14 +0000)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 25 Oct 2012 10:14:35 +0000 (10:14 +0000)
source/blender/blenkernel/intern/constraint.c

index aef9ad633f794cd188f16354ee25861d3b3361fe..887a322d91dedb8d314256c181760d6da9d892a9 100644 (file)
@@ -221,51 +221,6 @@ void constraints_clear_evalob(bConstraintOb *cob)
 
 /* -------------- Space-Conversion API -------------- */
 
-#if 0 /* XXX Old code, does the same as one in armature.c, will remove it later. */
-static void constraint_pchan_diff_mat(bPoseChannel *pchan, float diff_mat[4][4])
-{
-       if (pchan->parent) {
-               float offs_bone[4][4];
-
-               /* construct offs_bone the same way it is done in armature.c */
-               copy_m4_m3(offs_bone, pchan->bone->bone_mat);
-               copy_v3_v3(offs_bone[3], pchan->bone->head);
-               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 */
-                       copy_m4_m4(tmat, pchan->bone->parent->arm_mat);
-
-                       /* the location of actual parent transform */
-                       copy_v3_v3(tmat[3], offs_bone[3]);
-                       zero_v3(offs_bone[3]);
-                       mul_m4_v3(pchan->parent->pose_mat, tmat[3]);
-
-                       mult_m4_m4m4(diff_mat, tmat, offs_bone);
-               }
-               else {
-                       /* pose_mat = par_pose_mat * bone_mat * chan_mat */
-                       if (pchan->bone->flag & BONE_NO_SCALE) {
-                               float tmat[4][4];
-                               copy_m4_m4(tmat, pchan->parent->pose_mat);
-                               normalize_m4(tmat);
-                               mult_m4_m4m4(diff_mat, tmat, offs_bone);
-                       }
-                       else {
-                               mult_m4_m4m4(diff_mat, pchan->parent->pose_mat, offs_bone);
-                       }
-               }
-       }
-       else {
-               /* pose_mat = chan_mat * arm_mat */
-               copy_m4_m4(diff_mat, pchan->bone->arm_mat);
-       }
-}
-#endif
-
 /* This function is responsible for the correct transformations/conversions 
  * of a matrix from one space to another for constraint evaluation.
  * For now, this is only implemented for Objects and PoseChannels.
@@ -307,18 +262,6 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4]
                                else if (to == CONSTRAINT_SPACE_LOCAL) {
                                        if (pchan->bone) {
                                                BKE_armature_mat_pose_to_bone(pchan, mat, mat);
-#if 0  /* XXX Old code, will remove it later. */
-                                               constraint_pchan_diff_mat(pchan, diff_mat);
-
-                                               invert_m4_m4(imat, diff_mat);
-                                               mult_m4_m4m4(mat, imat, mat);
-
-                                               /* override with local location */
-                                               if ((pchan->parent) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) {
-                                                       BKE_armature_mat_pose_to_bone_ex(ob, pchan, pchan->pose_mat, tempmat);
-                                                       copy_v3_v3(mat[3], tempmat[3]);
-                                               }
-#endif
                                        }
                                }
                                /* pose to local with parent */
@@ -336,11 +279,6 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4]
                                if (pchan->bone) {
                                        /* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */
                                        BKE_armature_mat_bone_to_pose(pchan, mat, mat);
-#if 0
-                                       constraint_pchan_diff_mat(pchan, diff_mat);
-
-                                       mult_m4_m4m4(mat, diff_mat, mat);
-#endif
                                }
                                
                                /* use pose-space as stepping stone for other spaces */