Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2018-02-22 17:13:56 +0300
committerJoshua Leung <aligorith@gmail.com>2018-02-22 17:13:56 +0300
commite83b9cde1a6caeb4468f12d68632df0d0e4e8ae7 (patch)
treedcac7562eace19d82fb23e06564426168c0d8a78 /source/blender/editors
parent00ba28e9f82b4caa156f831a0d9d1eae859da116 (diff)
Fix T54129: Moving keyframes on top of other keyframes, removes both keyframes
Regression caused by earlier commits to improve the automerge behaviour. In this case, the problems only occurred when moving a selected keyframe forwards in time to overlap an unselected keyframe.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/transform/transform_conversions.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 42a15939aee..adcd3a29bd0 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -3595,27 +3595,40 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
for (int i = fcu->totvert - 1; i >= 0; i--) {
BezTriple *bezt = &fcu->bezt[i];
- /* Is this a candidate for deletion? */
+ /* Is this keyframe a candidate for deletion? */
/* TODO: Replace loop with an O(1) lookup instead */
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
- */
- if (BEZT_ISSEL_ANY(bezt) && (rk->del_count == rk->tot_count - 1)) {
- /* Update keyframe */
- if (can_average_points) {
- /* TODO: update handles too? */
- bezt->vec[1][1] = rk->val;
+ /* Selected keys are treated with greater care than unselected ones... */
+ if (BEZT_ISSEL_ANY(bezt)) {
+ /* - If this is the last selected key left (based on rk->del_count) ==> UPDATE IT
+ * (or else we wouldn't have any keyframe left here)
+ * - Otherwise, there are still other selected keyframes on this frame
+ * to be merged down still ==> DELETE IT
+ */
+ if (rk->del_count == rk->tot_count - 1) {
+ /* Update keyframe... */
+ if (can_average_points) {
+ /* TODO: update handles too? */
+ bezt->vec[1][1] = rk->val;
+ }
+ }
+ else {
+ /* Delete Keyframe */
+ delete_fcurve_key(fcu, i, 0);
}
+
+ /* Update count of how many we've deleted
+ * - It should only matter that we're doing this for all but the last one
+ */
+ rk->del_count++;
}
else {
- /* Delete keyframe */
+ /* Always delete - Unselected keys don't matter */
delete_fcurve_key(fcu, i, 0);
}
-
- /* Stop searching for matching RK's */
- rk->del_count++;
+
+ /* Stop the RK search... we've found our match now */
break;
}
}