Pose armature cleanup: remove old commented code replaced by use of new generic pchan_to_pose_mat().

After two months, think we can get rid of it, it’s in svn anyway if we ever need it!
This commit is contained in:
Bastien Montagne 2012-04-29 13:18:59 +00:00
parent b7a59f52b8
commit d47528b2f4
2 changed files with 1 additions and 151 deletions

@ -1208,9 +1208,8 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
else
mult_m4_m4m4(rotscale_mat, parchan->pose_mat, offs_bone);
# if 1
/* Compose the loc matrix for this bone. */
/* NOTE: That version deos not modify bone's loc when HINGE/NO_SCALE options are set. */
/* NOTE: That version does not modify bone's loc when HINGE/NO_SCALE options are set. */
/* In this case, use the object's space *orientation*. */
if (bone->flag & BONE_NO_LOCAL_LOCATION) {
@ -1236,58 +1235,6 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
/* Else (i.e. default, usual case), just use the same matrix for rotation/scaling, and location. */
else
copy_m4_m4(loc_mat, rotscale_mat);
# endif
# if 0
/* Compose the loc matrix for this bone. */
/* NOTE: That version modifies bone's loc when HINGE/NO_SCALE options are set. */
/* In these cases we need to compute location separately */
if (bone->flag & (BONE_HINGE|BONE_NO_SCALE|BONE_NO_LOCAL_LOCATION)) {
float bone_loc[4][4], bone_rotscale[3][3], tmat4[4][4], tmat3[3][3];
unit_m4(bone_loc);
unit_m4(loc_mat);
unit_m4(tmat4);
mul_v3_m4v3(bone_loc[3], parchan->pose_mat, offs_bone[3]);
/* "No local location" is not transformed by bone matrix. */
/* This only affects orientations (rotations), as scale is always 1.0 here. */
if (bone->flag & BONE_NO_LOCAL_LOCATION)
unit_m3(bone_rotscale);
else
/* We could also use bone->bone_mat directly, here... */
copy_m3_m4(bone_rotscale, offs_bone);
if (bone->flag & BONE_HINGE) {
copy_m3_m4(tmat3, parbone->arm_mat);
/* for hinge-only, we use armature *rotation*, but pose mat *scale*! */
if (!(bone->flag & BONE_NO_SCALE)) {
float size[3], tsmat[3][3];
mat4_to_size(size, parchan->pose_mat);
size_to_mat3(tsmat, size);
mul_m3_m3m3(tmat3, tsmat, tmat3);
}
mul_m3_m3m3(bone_rotscale, tmat3, bone_rotscale);
}
else if (bone->flag & BONE_NO_SCALE) {
/* For no-scale only, normalized parent pose mat is enough! */
copy_m3_m4(tmat3, parchan->pose_mat);
normalize_m3(tmat3);
mul_m3_m3m3(bone_rotscale, tmat3, bone_rotscale);
}
/* NO_LOCAL_LOCATION only. */
else {
copy_m3_m4(tmat3, parchan->pose_mat);
mul_m3_m3m3(bone_rotscale, tmat3, bone_rotscale);
}
copy_m4_m3(tmat4, bone_rotscale);
mult_m4_m4m4(loc_mat, bone_loc, tmat4);
}
/* Else, just use the same matrix for rotation/scaling, and location. */
else
copy_m4_m4(loc_mat, rotscale_mat);
# endif
}
/* Root bones. */
else {
@ -2438,16 +2385,6 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
/* Construct the posemat based on PoseChannels, that we do before applying constraints. */
/* pose_mat(b) = pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) */
armature_mat_bone_to_pose(pchan, pchan->chan_mat, pchan->pose_mat);
#if 0 /* XXX Old code, will remove this later. */
{
float rotscale_mat[4][4], loc_mat[4][4];
pchan_to_pose_mat(pchan, rotscale_mat, loc_mat);
/* Rotation and scale. */
mult_m4_m4m4(pchan->pose_mat, rotscale_mat, pchan->chan_mat);
/* Location. */
mul_v3_m4v3(pchan->pose_mat[3], loc_mat, pchan->chan_mat[3]);
}
#endif
/* Only rootbones get the cyclic offset (unless user doesn't want that). */
/* XXX That could be a problem for snapping and other "reverse transform" features... */

@ -424,51 +424,6 @@ static short apply_targetless_ik(Object *ob)
bone= parchan->bone;
bone->flag |= BONE_TRANSFORM; /* ensures it gets an auto key inserted */
/* XXX Old code. Will remove it later. */
#if 0
if (parchan->parent) {
Bone *parbone= parchan->parent->bone;
float offs_bone[4][4];
/* offs_bone = yoffs(b-1) + root(b) + bonemat(b) */
copy_m4_m3(offs_bone, bone->bone_mat);
/* The bone's root offset (is in the parent's coordinate system) */
copy_v3_v3(offs_bone[3], bone->head);
/* Get the length translation of parent (length along y axis) */
offs_bone[3][1]+= parbone->length;
/* pose_mat(b-1) * offs_bone */
if (parchan->bone->flag & BONE_HINGE) {
/* the rotation of the parent restposition */
copy_m4_m4(rmat, parbone->arm_mat); /* rmat used as temp */
/* the location of actual parent transform */
copy_v3_v3(rmat[3], offs_bone[3]);
offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
mul_m4_v3(parchan->parent->pose_mat, rmat[3]);
mult_m4_m4m4(tmat, rmat, offs_bone);
}
else if (parchan->bone->flag & BONE_NO_SCALE) {
mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone);
normalize_m4(tmat);
}
else
mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone);
invert_m4_m4(imat, tmat);
}
else {
copy_m4_m3(tmat, bone->bone_mat);
copy_v3_v3(tmat[3], bone->head);
invert_m4_m4(imat, tmat);
}
/* result matrix */
mult_m4_m4m4(rmat, imat, parchan->pose_mat);
#endif
armature_mat_pose_to_bone(parchan, parchan->pose_mat, rmat);
/* apply and decompose, doesn't work for constraints or non-uniform scale well */
@ -599,48 +554,6 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
mul_serie_m3(td->mtx, pmat, omat, NULL, NULL,NULL,NULL,NULL,NULL);
}
/* XXX Old code. Will remove it later. */
#if 0
if (ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION))
unit_m3(bmat);
else
copy_m3_m3(bmat, pchan->bone->bone_mat);
if (pchan->parent) {
if (pchan->bone->flag & BONE_HINGE) {
copy_m3_m4(pmat, pchan->parent->bone->arm_mat);
if (!(pchan->bone->flag & BONE_NO_SCALE)) {
float tsize[3], tsmat[3][3];
mat4_to_size(tsize, pchan->parent->pose_mat);
size_to_mat3(tsmat, tsize);
mul_m3_m3m3(pmat, tsmat, pmat);
}
}
else {
copy_m3_m4(pmat, pchan->parent->pose_mat);
if (pchan->bone->flag & BONE_NO_SCALE)
normalize_m3(pmat);
}
if (constraints_list_needinv(t, &pchan->constraints)) {
copy_m3_m4(tmat, pchan->constinv);
invert_m3_m3(cmat, tmat);
mul_serie_m3(td->mtx, bmat, pmat, omat, cmat, NULL,NULL,NULL,NULL);
}
else
mul_serie_m3(td->mtx, bmat, pmat, omat, NULL,NULL,NULL,NULL,NULL);
}
else {
if (constraints_list_needinv(t, &pchan->constraints)) {
copy_m3_m4(tmat, pchan->constinv);
invert_m3_m3(cmat, tmat);
mul_serie_m3(td->mtx, bmat, omat, cmat, NULL,NULL,NULL,NULL,NULL);
}
else
mul_m3_m3m3(td->mtx, omat, bmat);
}
# endif
invert_m3_m3(td->smtx, td->mtx);
/* exceptional case: rotate the pose bone which also applies transformation