== 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) if (previous == NULL)
{ {
QuatOne(qroll); /* default to up_axis if no previous */
return rollBoneByQuat(edge->bone, edge->up_axis, qrot); return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis);
} }
else else
{ {
@ -223,9 +223,8 @@ float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float
} }
else else
{ {
/* SHOULDN'T BE HERE */ /* default to up_axis if first bone in the chain is an offset */
QuatOne(qroll); return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis);
return rollBoneByQuat(edge->bone, edge->up_axis, qrot);
} }
VecSubf(vec_second, edge->bone->tail, edge->bone->head); 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) 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 else
{ {