Fix T67212: No smooth blending in "Push Pose from Breakdown" and "Relax Pose to Breakdown"

The previous method produced non smooth interpolation results and it was
very hard to control. (At least for me it seemed to be broken until I
actually took a look at what the code actually did)

Now we simply linearly interpolate between the breakdown position and
the current bone data.

Reviewed By: Sybren, Hjalti

Differential Revision: http://developer.blender.org/D5892
This commit is contained in:
Sebastian Parborg 2019-10-04 16:37:56 +02:00
parent b9736e8e12
commit 0bcada85b3
Notes: blender-bot 2023-02-14 06:37:09 +01:00
Referenced by issue #67212, No smooth blending in "Push Pose from Breakdown" and "Relax Pose to Breakdown"
1 changed files with 4 additions and 20 deletions

View File

@ -368,30 +368,14 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, Object *ob, flo
switch (pso->mode) {
case POSESLIDE_PUSH: /* make the current pose more pronounced */
{
/* perform a weighted average here, favoring the middle pose
* - numerator should be larger than denominator to 'expand' the result
* - perform this weighting a number of times given by the percentage...
*/
/* TODO: maybe a sensitivity ctrl on top of this is needed */
int iters = (int)ceil(10.0f * pso->percentage);
while (iters-- > 0) {
(*val) = (-((sVal * w2) + (eVal * w1)) + ((*val) * 6.0f)) / 5.0f;
}
/* Slide the pose away from the breakdown pose in the timeline */
(*val) -= ((sVal * w2) + (eVal * w1) - (*val)) * pso->percentage;
break;
}
case POSESLIDE_RELAX: /* make the current pose more like its surrounding ones */
{
/* perform a weighted average here, favoring the middle pose
* - numerator should be smaller than denominator to 'relax' the result
* - perform this weighting a number of times given by the percentage...
*/
/* TODO: maybe a sensitivity ctrl on top of this is needed */
int iters = (int)ceil(10.0f * pso->percentage);
while (iters-- > 0) {
(*val) = (((sVal * w2) + (eVal * w1)) + ((*val) * 5.0f)) / 6.0f;
}
/* Slide the pose towards the breakdown pose in the timeline */
(*val) += ((sVal * w2) + (eVal * w1) - (*val)) * pso->percentage;
break;
}
case POSESLIDE_BREAKDOWN: /* make the current pose slide around between the endpoints */