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:
Diffstat (limited to 'source/blender/editors/animation/keyframing.c')
-rw-r--r--source/blender/editors/animation/keyframing.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index adc580c253d..125c8bbc55a 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -26,6 +26,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
+/** \file blender/editors/animation/keyframing.c
+ * \ingroup edanimation
+ */
+
#include <stdio.h>
#include <stddef.h>
@@ -295,6 +300,7 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag)
int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
{
BezTriple beztr= {{{0}}};
+ unsigned int oldTot = fcu->totvert;
int a;
/* set all three points, for nicer start position
@@ -330,10 +336,16 @@ int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
if ((fcu->totvert > 2) && (flag & INSERTKEY_REPLACE)==0) {
BezTriple *bezt= (fcu->bezt + a);
- /* set interpolation from previous (if available) */
- // FIXME: this doesn't work if user tweaked the interpolation specifically, and they were just overwriting some existing key in the process...
- if (a > 0) bezt->ipo= (bezt-1)->ipo;
- else if (a < fcu->totvert-1) bezt->ipo= (bezt+1)->ipo;
+ /* set interpolation from previous (if available), but only if we didn't just replace some keyframe
+ * - replacement is indicated by no-change in number of verts
+ * - when replacing, the user may have specified some interpolation that should be kept
+ */
+ if (fcu->totvert > oldTot) {
+ if (a > 0)
+ bezt->ipo= (bezt-1)->ipo;
+ else if (a < fcu->totvert-1)
+ bezt->ipo= (bezt+1)->ipo;
+ }
/* don't recalculate handles if fast is set
* - this is a hack to make importers faster