diff options
author | Joshua Leung <aligorith@gmail.com> | 2018-02-21 09:14:33 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2018-02-21 15:46:09 +0300 |
commit | f2cdb1c7ccb1893db4c093d49b13204dadc7e535 (patch) | |
tree | 2e11cb0601e6f2b8c1a97dd9276c5dfeb24385a4 | |
parent | 63da3b79edc630d1a5e311d24bfca6506ecfdac8 (diff) |
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.
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 14 |
1 files changed, 1 insertions, 13 deletions
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; - } } } |