From cda05639dff6e2c0d07035de14214911c3fb8255 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 20 Nov 2017 00:28:03 +1300 Subject: 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. --- source/blender/editors/animation/keyframes_general.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/animation/keyframes_general.c') 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 { -- cgit v1.2.3