Fix: Don't average keyframe values if FCurve can only have int/discrete values

This is to prevent problems with integer/enum properties getting invalid
values set.
This commit is contained in:
Joshua Leung 2018-02-21 22:37:48 +13:00
parent dd75211d83
commit bba1120116
1 changed files with 5 additions and 2 deletions

View File

@ -3529,6 +3529,7 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
{
/* NOTE: We assume that all keys are sorted */
ListBase retained_keys = {NULL, NULL};
const bool can_average_points = ((fcu->flag & (FCURVE_INT_VALUES | FCURVE_DISCRETE_VALUES)) == 0);
/* sanity checks */
if ((fcu->totvert == 0) || (fcu->bezt == NULL))
@ -3597,8 +3598,10 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
*/
if (BEZT_ISSEL_ANY(bezt) && (rk->del_count == rk->tot_count - 1)) {
/* Update keyframe */
/* TODO: update handles too? */
bezt->vec[1][1] = rk->val;
if (can_average_points) {
/* TODO: update handles too? */
bezt->vec[1][1] = rk->val;
}
}
else {
/* Delete keyframe */