diff options
author | Joshua Leung <aligorith@gmail.com> | 2017-11-19 14:28:03 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2017-11-19 15:57:20 +0300 |
commit | cda05639dff6e2c0d07035de14214911c3fb8255 (patch) | |
tree | f326bf4a23aa45c3a668e06c4fd39156df0005bc /source/blender/editors/animation/keyframes_general.c | |
parent | 3133d2d58c391544a48342860120336e2a0f944e (diff) |
Fix T53229: "Sample Keyframes" errors with multiple pairs of keyframes selected
There were 2 issues here (first was the one reported):
1) Curve shape changes if multiple consecutive pairs of keyframes
are selected. The problem is that after the first pair is handled,
subsequent pairs get sampled on the basis of the modified curve.
2) With multiple separate "islands" selected, unselected points in between
would get ignored, causing the entire curve to get sampled.
Diffstat (limited to 'source/blender/editors/animation/keyframes_general.c')
-rw-r--r-- | source/blender/editors/animation/keyframes_general.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 97f53561bfe..bf5d4ec0300 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -448,6 +448,18 @@ void sample_fcurve(FCurve *fcu) /* check if selected, and which end this is */ if (BEZT_ISSEL_ANY(bezt)) { if (start) { + /* If next bezt is also selected, don't start sampling yet, + * but instead wait for that one to reconsider, to avoid + * changing the curve when sampling consecutive segments + * (T53229) + */ + if (i < fcu->totvert - 1) { + BezTriple *next = &fcu->bezt[i + 1]; + if (BEZT_ISSEL_ANY(next)) { + continue; + } + } + /* set end */ end = bezt; @@ -480,8 +492,8 @@ void sample_fcurve(FCurve *fcu) i += (range - 1); } - /* bezt was selected, so it now marks the start of a whole new chain to search */ - start = bezt; + /* the current selection island has ended, so start again from scratch */ + start = NULL; end = NULL; } else { |