== Auto-Keyframing - Needed ==
Now, the 'Only Needed' Auto-Keyframing tool only adds keyframes for the relevant transforms when working with bones in PoseMode. Previously, all transform channels were keyed in such cases, as Auto-IK used to make things difficult.
This commit is contained in:
@@ -397,11 +397,11 @@ static bKinematicConstraint *has_targetless_ik(bPoseChannel *pchan)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apply_targetless_ik(Object *ob)
|
static short apply_targetless_ik(Object *ob)
|
||||||
{
|
{
|
||||||
bPoseChannel *pchan, *parchan, *chanlist[256];
|
bPoseChannel *pchan, *parchan, *chanlist[256];
|
||||||
bKinematicConstraint *data;
|
bKinematicConstraint *data;
|
||||||
int segcount;
|
int segcount, apply= 0;
|
||||||
|
|
||||||
/* now we got a difficult situation... we have to find the
|
/* now we got a difficult situation... we have to find the
|
||||||
target-less IK pchans, and apply transformation to the all
|
target-less IK pchans, and apply transformation to the all
|
||||||
@@ -499,10 +499,12 @@ static void apply_targetless_ik(Object *ob)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply= 1;
|
||||||
data->flag &= ~CONSTRAINT_IK_AUTO;
|
data->flag &= ~CONSTRAINT_IK_AUTO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return apply;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, TransData *td)
|
static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, TransData *td)
|
||||||
@@ -2197,6 +2199,7 @@ void special_aftertrans_update(TransInfo *t)
|
|||||||
bAction *act;
|
bAction *act;
|
||||||
bPose *pose;
|
bPose *pose;
|
||||||
bPoseChannel *pchan;
|
bPoseChannel *pchan;
|
||||||
|
short targetless_ik= 0;
|
||||||
|
|
||||||
ob= t->poseobj;
|
ob= t->poseobj;
|
||||||
arm= ob->data;
|
arm= ob->data;
|
||||||
@@ -2207,7 +2210,7 @@ void special_aftertrans_update(TransInfo *t)
|
|||||||
|
|
||||||
/* if target-less IK grabbing, we calculate the pchan transforms and clear flag */
|
/* if target-less IK grabbing, we calculate the pchan transforms and clear flag */
|
||||||
if(!cancelled && t->mode==TFM_TRANSLATION)
|
if(!cancelled && t->mode==TFM_TRANSLATION)
|
||||||
apply_targetless_ik(ob);
|
targetless_ik= apply_targetless_ik(ob);
|
||||||
else {
|
else {
|
||||||
/* not forget to clear the auto flag */
|
/* not forget to clear the auto flag */
|
||||||
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
|
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
|
||||||
@@ -2247,19 +2250,23 @@ void special_aftertrans_update(TransInfo *t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (U.uiflag & USER_KEYINSERTNEED) {
|
else if (U.uiflag & USER_KEYINSERTNEED) {
|
||||||
|
if ((t->mode==TFM_TRANSLATION) && (targetless_ik==0)) {
|
||||||
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_X);
|
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_X);
|
||||||
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Y);
|
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Y);
|
||||||
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Z);
|
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Z);
|
||||||
|
}
|
||||||
|
if ((t->mode==TFM_ROTATION) || ((t->mode==TFM_TRANSLATION) && targetless_ik)) {
|
||||||
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_W);
|
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_W);
|
||||||
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_X);
|
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_X);
|
||||||
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Y);
|
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Y);
|
||||||
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Z);
|
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Z);
|
||||||
|
}
|
||||||
|
if (t->mode==TFM_RESIZE) {
|
||||||
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X);
|
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X);
|
||||||
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y);
|
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y);
|
||||||
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Z);
|
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Z);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X);
|
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X);
|
||||||
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y);
|
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y);
|
||||||
|
|||||||
Reference in New Issue
Block a user