diff options
author | Joshua Leung <aligorith@gmail.com> | 2018-02-21 12:37:48 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2018-02-21 15:46:10 +0300 |
commit | bba112011692d38829f7291d05b173418d8ba91a (patch) | |
tree | 1ac641890b89f91574ea3337d0d1b70824172608 | |
parent | dd75211d83b81212a433ee9b872a1da3f1192abb (diff) |
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.
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 9d44bf50b02..41511015d61 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -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 */ |