Fix T64533: Using "X-Axis Mirror" while posing with auto keyframe on does not keyfram...
authorSebastian Parborg <darkdefende@gmail.com>
Thu, 6 Jun 2019 13:52:52 +0000 (15:52 +0200)
committerSebastian Parborg <darkdefende@gmail.com>
Thu, 6 Jun 2019 13:54:49 +0000 (15:54 +0200)
Use an additional pose bone flag so we can keep track of mirrored bones that should be autokeyframed.

Reviewed By: Brecht

Differential Revision: https://developer.blender.org/D5033

source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/makesdna/DNA_armature_types.h

index e766709..19a61e1 100644 (file)
@@ -812,7 +812,7 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb)
       bone->flag |= BONE_TRANSFORM_CHILD;
     }
     else {
-      bone->flag &= ~BONE_TRANSFORM;
+      bone->flag &= ~(BONE_TRANSFORM | BONE_TRANSFORM_MIRROR);
     }
 
     bone_children_clear_transflag(mode, around, &bone->childbase);
@@ -838,14 +838,14 @@ int count_set_pose_transflags(Object *ob,
         bone->flag |= BONE_TRANSFORM;
       }
       else {
-        bone->flag &= ~BONE_TRANSFORM;
+        bone->flag &= ~(BONE_TRANSFORM | BONE_TRANSFORM_MIRROR);
       }
 
       bone->flag &= ~BONE_HINGE_CHILD_TRANSFORM;
       bone->flag &= ~BONE_TRANSFORM_CHILD;
     }
     else {
-      bone->flag &= ~BONE_TRANSFORM;
+      bone->flag &= ~(BONE_TRANSFORM | BONE_TRANSFORM_MIRROR);
     }
   }
 
@@ -6778,7 +6778,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) {
+      if (pchan->bone->flag & (BONE_TRANSFORM | BONE_TRANSFORM_MIRROR)) {
+
         ListBase dsources = {NULL, NULL};
 
         /* clear any 'unkeyed' flag it may have */
index 0a361d0..d6c0971 100644 (file)
@@ -819,6 +819,9 @@ static void pose_transform_mirror_update(Object *ob, PoseInitData_Mirror *pid)
           pid++;
         }
         BKE_pchan_apply_mat4(pchan, pchan_mtx_final, false);
+
+        /* set flag to let autokeyframe know to keyframe the mirrred bone */
+        pchan->bone->flag |= BONE_TRANSFORM_MIRROR;
       }
     }
   }
index b18ab50..589b657 100644 (file)
@@ -249,6 +249,8 @@ typedef enum eBone_Flag {
   BONE_RELATIVE_PARENTING = (1 << 23),
   /** it will add the parent end roll to the inroll */
   BONE_ADD_PARENT_END_ROLL = (1 << 24),
+  /** this bone was transformed by the mirror function */
+  BONE_TRANSFORM_MIRROR = (1 << 25),
 
 } eBone_Flag;