Apply Pose as Rest Pose: Bendy Bone support
authorJoshua Leung <aligorith@gmail.com>
Mon, 29 Jan 2018 01:46:03 +0000 (14:46 +1300)
committerJoshua Leung <aligorith@gmail.com>
Mon, 29 Jan 2018 04:22:02 +0000 (17:22 +1300)
The "Apply Pose as Rest Pose" operator now affects Bendy Bone settings
too, making it possible to use interactive posing tools (e.g. Pose Sculpting
brushes) to get the desired shape for the rest-pose shape of Bendy Bones.
When such posing tools are available, this change makes it easier to get
the desired Bendy Bone shapes, as you are no longer restricted to using
buttons to get the desired effects.

source/blender/editors/armature/pose_transform.c

index 3707b914ecbfc8c3fb5abafea3d01363713f6a26..4feb16813492d1c7e86d9064c6e456f85a555c4c 100644 (file)
@@ -151,6 +151,28 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
                        curbone->roll = eul[1];
                }
                
+               /* combine pose and rest values for bendy bone settings,
+                * then clear the pchan values (so we don't get a double-up)
+                */
+               if (pchan->bone->segments > 1) {
+                       curbone->curveInX += pchan->curveInX;
+                       curbone->curveInY += pchan->curveInY;
+                       curbone->curveOutX += pchan->curveOutX;
+                       curbone->curveOutY += pchan->curveOutY;
+                       curbone->roll1 += pchan->roll1;
+                       curbone->roll2 += pchan->roll2;
+                       curbone->ease1 += pchan->ease1;
+                       curbone->ease2 += pchan->ease2;
+                       curbone->scaleIn += pchan->scaleIn;
+                       curbone->scaleOut += pchan->scaleOut;
+                       
+                       pchan->curveInX = pchan->curveOutX = 0.0f;
+                       pchan->curveInY = pchan->curveOutY = 0.0f;
+                       pchan->roll1 = pchan->roll2 = 0.0f;
+                       pchan->ease1 = pchan->ease2 = 0.0f;
+                       pchan->scaleIn = pchan->scaleOut = 1.0f;
+               }
+               
                /* clear transform values for pchan */
                zero_v3(pchan->loc);
                zero_v3(pchan->eul);