== etch-a-ton ==

Correct joint-guided roll to use the previous bone, not the following (that was silly). Also made first bone use view axis (since it has no previous), this is much nicer that using rotation correction only. Using the joint roll option makes it MUCH more orientation independant.
This commit is contained in:
Martin Poirier 2009-03-31 14:29:58 +00:00
parent f78ee08b67
commit 74e6231ff4

@ -201,12 +201,12 @@ float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float qrot[4],
}
}
float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4])
float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4], float up_axis[3])
{
if (previous == NULL)
{
QuatOne(qroll);
return rollBoneByQuat(edge->bone, edge->up_axis, qrot);
/* default to up_axis if no previous */
return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis);
}
else
{
@ -223,9 +223,8 @@ float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float
}
else
{
/* SHOULDN'T BE HERE */
QuatOne(qroll);
return rollBoneByQuat(edge->bone, edge->up_axis, qrot);
/* default to up_axis if first bone in the chain is an offset */
return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis);
}
VecSubf(vec_second, edge->bone->tail, edge->bone->head);
@ -1846,7 +1845,7 @@ static void repositionBone(RigGraph *rigg, RigEdge *edge, float vec0[3], float v
}
else if (G.scene->toolsettings->skgen_retarget_roll == SK_RETARGET_ROLL_JOINT)
{
bone->roll = rollBoneByQuatJoint(edge, edge->next, qrot, qroll);
bone->roll = rollBoneByQuatJoint(edge, edge->prev, qrot, qroll, up_axis);
}
else
{