Fix: Return back to conventional way of averaging points for keyframe de-dup
The other approach was causing too much error in some cases (e.g. favouring the lower-valued keyframes). This fix should make the resulting curves less bumpy/jagged.
This commit is contained in:
parent
915d120c36
commit
cab608066a
|
@ -3548,7 +3548,7 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
|
|||
/* If there's another selected frame here, merge it */
|
||||
for (tRetainedKeyframe *rk = retained_keys.last; rk; rk = rk->prev) {
|
||||
if (IS_EQT(rk->frame, bezt->vec[1][0], BEZT_BINARYSEARCH_THRESH)) {
|
||||
rk->val += (bezt->vec[1][1] - rk->val) / ((float)rk->tot_count);
|
||||
rk->val += bezt->vec[1][1];
|
||||
rk->tot_count++;
|
||||
|
||||
found = true;
|
||||
|
@ -3580,6 +3580,12 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
|
|||
}
|
||||
return;
|
||||
}
|
||||
else {
|
||||
/* Compute the average values for each retained keyframe */
|
||||
for (tRetainedKeyframe *rk = retained_keys.first; rk; rk = rk->next) {
|
||||
rk->val = rk->val / (float)rk->tot_count;
|
||||
}
|
||||
}
|
||||
|
||||
/* 2) Delete all keyframes duplicating the "retained keys" found above
|
||||
* - Most of these will be unselected keyframes
|
||||
|
|
Loading…
Reference in New Issue