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:
authorAntony Riakiotakis <kalast@gmail.com>2015-05-20 17:23:55 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-05-20 17:23:55 +0300
commit53cbbcbb21fde90a5c7a6ff860a3d11443213145 (patch)
treeb22f87f79521650d05fc9a45d966ab13ecefa9db /source/blender/editors/animation
parentb6b219996df20a2b63d932032d8b6ea1c0a14fd1 (diff)
Keep interpolation type of keyframes when cleaning
Not sure how well that will work in practice, but there's a whole studio of people ready to test.
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/keyframes_general.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index 19e32b5ccb9..abfbbe53408 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -179,6 +179,17 @@ void duplicate_fcurve_keys(FCurve *fcu)
/* **************************************************** */
/* Various Tools */
+static void copy_bezt_ipo(BezTriple *bezdst, BezTriple *bezsrc)
+{
+ bezdst->back = bezsrc->back;
+ bezdst->ipo = bezsrc->ipo;
+ bezdst->easing = bezsrc->easing;
+ bezdst->amplitude = bezsrc->amplitude;
+ bezdst->period = bezsrc->period;
+ bezdst->h1 = bezsrc->h1;
+ bezdst->h2 = bezsrc->h2;
+}
+
/* Basic F-Curve 'cleanup' function that removes 'double points' and unnecessary keyframes on linear-segments only
* optionally clears up curve if one keyframe with default value remains */
void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, bool cleardefault)
@@ -232,7 +243,8 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo
cur[0] = bezt->vec[1][0]; cur[1] = bezt->vec[1][1];
if (!(bezt->f2 & SELECT)) {
- insert_vert_fcurve(fcu, cur[0], cur[1], 0);
+ insert_vert_fcurve(fcu, cur[0], cur[1], INSERTKEY_FAST);
+ copy_bezt_ipo((fcu->bezt + (fcu->totvert - 1)), bezt);
lastb = (fcu->bezt + (fcu->totvert - 1));
lastb->f1 = lastb->f2 = lastb->f3 = 0;
continue;
@@ -251,7 +263,8 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo
if (cur[1] > next[1]) {
if (IS_EQT(cur[1], prev[1], thresh) == 0) {
/* add new keyframe */
- insert_vert_fcurve(fcu, cur[0], cur[1], 0);
+ insert_vert_fcurve(fcu, cur[0], cur[1], INSERTKEY_FAST);
+ copy_bezt_ipo((fcu->bezt + (fcu->totvert - 1)), bezt);
}
}
}
@@ -259,7 +272,8 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo
/* only add if values are a considerable distance apart */
if (IS_EQT(cur[1], prev[1], thresh) == 0) {
/* add new keyframe */
- insert_vert_fcurve(fcu, cur[0], cur[1], 0);
+ insert_vert_fcurve(fcu, cur[0], cur[1], INSERTKEY_FAST);
+ copy_bezt_ipo((fcu->bezt + (fcu->totvert - 1)), bezt);
}
}
}
@@ -269,22 +283,27 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo
/* does current have same value as previous and next? */
if (IS_EQT(cur[1], prev[1], thresh) == 0) {
/* add new keyframe*/
- insert_vert_fcurve(fcu, cur[0], cur[1], 0);
+ insert_vert_fcurve(fcu, cur[0], cur[1], INSERTKEY_FAST);
+ copy_bezt_ipo((fcu->bezt + (fcu->totvert - 1)), bezt);
}
else if (IS_EQT(cur[1], next[1], thresh) == 0) {
/* add new keyframe */
- insert_vert_fcurve(fcu, cur[0], cur[1], 0);
+ insert_vert_fcurve(fcu, cur[0], cur[1], INSERTKEY_FAST);
+ copy_bezt_ipo((fcu->bezt + (fcu->totvert - 1)), bezt);
}
}
else {
/* add if value doesn't equal that of previous */
if (IS_EQT(cur[1], prev[1], thresh) == 0) {
/* add new keyframe */
- insert_vert_fcurve(fcu, cur[0], cur[1], 0);
+ insert_vert_fcurve(fcu, cur[0], cur[1], INSERTKEY_FAST);
+ copy_bezt_ipo((fcu->bezt + (fcu->totvert - 1)), bezt);
}
}
}
}
+
+ calchandles_fcurve(fcu);
/* now free the memory used by the old BezTriples */
if (old_bezts)