[Bf-blender-cvs] [f2cdb1c7ccb] master: Tweak/Fix for T54106 - Moving multiple selected keyframes on top of an unselected one would not merge the keys

Joshua Leung noreply at git.blender.org
Wed Feb 21 13:59:57 CET 2018


Commit: f2cdb1c7ccb1893db4c093d49b13204dadc7e535
Author: Joshua Leung
Date:   Wed Feb 21 19:14:33 2018 +1300
Branches: master
https://developer.blender.org/rBf2cdb1c7ccb1893db4c093d49b13204dadc7e535

Tweak/Fix for T54106 - Moving multiple selected keyframes on top of an unselected one would not merge the keys

This commit removes an earlier attempt at optimising the lookups
for duplicates of a particular tRetainedKeyframe once we'd already
deleted all the selected copies. The problem was that now, instead
of getting rid of the unselected keys (i.e. the basic function here),
we were only getting rid of the selected duplicates.

With this fix, unselected keyframes will now get removed (as expected)
again. However, we currently don't take their values into account
when merging keyframes, since it is assumed that we don't care so much
about their values when overriding.

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

M	source/blender/editors/transform/transform_conversions.c

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

diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 3693c3e40fb..35fa373854a 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -3529,7 +3529,6 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
 {
 	/* NOTE: We assume that all keys are sorted */
 	ListBase retained_keys = {NULL, NULL};
-	tRetainedKeyframe *last_rk = NULL;
 	
 	/* sanity checks */
 	if ((fcu->totvert == 0) || (fcu->bezt == NULL))
@@ -3587,9 +3586,6 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
 			printf("   %d: f = %f, v = %f (n = %d)\n", rk_index, rk->frame, rk->val, rk->tot_count);
 			rk_index++;
 		}
-		
-		/* "last_rk" is the last one we need to search (assuming everything is sorted) */
-		last_rk = retained_keys.last;
 	}
 	
 	/* 2) Delete all keyframes duplicating the "retained keys" found above
@@ -3602,8 +3598,7 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
 		
 		/* Is this a candidate for deletion? */
 		// TODO: Replace loop with an O(1) lookup instead
-		// TODO: update last_rk on each deletion
-		for (tRetainedKeyframe *rk = last_rk; rk; rk = rk->prev) {
+		for (tRetainedKeyframe *rk = retained_keys.last; rk; rk = rk->prev) {
 			if (IS_EQT(bezt->vec[1][0], rk->frame, BEZT_BINARYSEARCH_THRESH)) {
 				/* Delete this keyframe, unless it's the last selected one on this frame,
 				 * in which case, we'll update its value instead
@@ -3612,9 +3607,6 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
 					/* Update keyframe */
 					// XXX: update handles too...
 					bezt->vec[1][1] = rk->val;
-					
-					/* Adjust last_rk, since we don't need to use this one anymore */
-					last_rk = rk->prev;
 				}
 				else {
 					/* Delete keyframe */
@@ -3625,10 +3617,6 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
 				rk->del_count++;
 				break;
 			}
-			else if (rk->frame < bezt->vec[1][0]) {
-				/* Terminate search early - There shouldn't be anything */
-				break;
-			}
 		}
 	}



More information about the Bf-blender-cvs mailing list