Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2018-02-21 14:44:03 +0300
committerJoshua Leung <aligorith@gmail.com>2018-02-21 15:46:11 +0300
commitcab608066a9ac85c60956ebf94bdca67c01a76c7 (patch)
tree4ddb051528e971ed774d988b69867f6b6da47b27 /source
parent915d120c3629868f93ddf2a10acfcafbeff5a327 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/transform/transform_conversions.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index fc6865c3ed1..42a15939aee 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -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