[Bf-blender-cvs] [cda05639dff] master: Fix T53229: "Sample Keyframes" errors with multiple pairs of keyframes selected

Joshua Leung noreply at git.blender.org
Sun Nov 19 14:09:22 CET 2017


Commit: cda05639dff6e2c0d07035de14214911c3fb8255
Author: Joshua Leung
Date:   Mon Nov 20 00:28:03 2017 +1300
Branches: master
https://developer.blender.org/rBcda05639dff6e2c0d07035de14214911c3fb8255

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.

===================================================================

M	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 {



More information about the Bf-blender-cvs mailing list