Apply Pose as Rest Pose: Bendy Bone support

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.
This commit is contained in:
Joshua Leung 2018-01-29 14:46:03 +13:00
parent 5b67a7a2e7
commit 5dd5286995
1 changed files with 22 additions and 0 deletions

View 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);