Fix autokeyframe not working on bones mirrored bones

The previous code for this didn't work as the MIRROR bone flag would be
cleared before the autokeyframe code was run.
This commit is contained in:
Sebastian Parborg 2019-10-14 17:46:28 +02:00
parent 2cdc187142
commit b8ca806b77
Notes: blender-bot 2023-02-14 07:45:38 +01:00
Referenced by commit 08048f7cce, Fix T75810: Child bone frozen when both Auto IK and X-Axis mirror are
Referenced by issue #75810, Child bone frozen when both Auto IK and X-Axis mirror are used
2 changed files with 11 additions and 5 deletions

View File

@ -429,7 +429,7 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb)
bone->flag |= BONE_TRANSFORM_CHILD;
}
else {
bone->flag &= ~(BONE_TRANSFORM | BONE_TRANSFORM_MIRROR);
bone->flag &= ~BONE_TRANSFORM;
}
bone_children_clear_transflag(mode, around, &bone->childbase);
@ -455,14 +455,14 @@ int count_set_pose_transflags(Object *ob,
bone->flag |= BONE_TRANSFORM;
}
else {
bone->flag &= ~(BONE_TRANSFORM | BONE_TRANSFORM_MIRROR);
bone->flag &= ~BONE_TRANSFORM;
}
bone->flag &= ~BONE_HINGE_CHILD_TRANSFORM;
bone->flag &= ~BONE_TRANSFORM_CHILD;
}
else {
bone->flag &= ~(BONE_TRANSFORM | BONE_TRANSFORM_MIRROR);
bone->flag &= ~BONE_TRANSFORM;
}
}
@ -1542,8 +1542,8 @@ void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, int tmode, short t
}
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->bone->flag & (BONE_TRANSFORM | BONE_TRANSFORM_MIRROR)) {
if ((pchan->bone->flag & BONE_TRANSFORM) ||
((pose->flag & POSE_MIRROR_EDIT) && (pchan->bone->flag & BONE_TRANSFORM_MIRROR))) {
ListBase dsources = {NULL, NULL};
/* clear any 'unkeyed' flag it may have */

View File

@ -792,6 +792,12 @@ static void pose_transform_mirror_update(Object *ob, PoseInitData_Mirror *pid)
unit_m4(flip_mtx);
flip_mtx[0][0] = -1;
for (bPoseChannel *pchan_orig = ob->pose->chanbase.first; pchan_orig;
pchan_orig = pchan_orig->next) {
/* Clear the MIRROR flag from previous runs */
pchan_orig->bone->flag &= ~BONE_TRANSFORM_MIRROR;
}
for (bPoseChannel *pchan_orig = ob->pose->chanbase.first; pchan_orig;
pchan_orig = pchan_orig->next) {
/* no layer check, correct mirror is more important */