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:
authorAlexander Gavrilov <angavrilov@gmail.com>2017-11-01 21:34:30 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2017-11-01 21:57:39 +0300
commit8bdc391c5488228dfe9c9e995277d67558293f08 (patch)
treeee7296ec1348a36546357f62271c0324d86e0e0a /source/blender/makesdna
parent88356a24422faf45d6355b449b3855e6904edf51 (diff)
Implement a new automatic handle algorithm to produce smooth F-Curves.
The legacy algorithm only considers two adjacent points when computing the bezier handles, which cannot produce satisfactory results. Animators are often forced to manually adjust all curves. The new approach instead solves a system of equations to trace a cubic spline with continuous second derivative through the whole segment of auto points, delimited at ends by keyframes with handles set by other requirements. This algorithm also adjusts Vector handles that face ordinary bezier keyframes to achieve zero acceleration at the Vector keyframe, instead of simply pointing it at the adjacent point. Original idea and implementation by Benoit Bolsee <benoit.bolsee@online.be>; code mostly rewritten to improve code clarity and extensibility. Reviewers: aligorith Differential Revision: https://developer.blender.org/D2884
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_anim_types.h9
-rw-r--r--source/blender/makesdna/DNA_curve_types.h9
2 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 977cd2347ad..099d5da7c49 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -490,7 +490,10 @@ typedef struct FCurve {
float curval; /* value stored from last time curve was evaluated (not threadsafe, debug display only!) */
short flag; /* user-editable settings for this curve */
short extend; /* value-extending mode for this curve (does not cover */
+ char auto_smoothing; /* auto-handle smoothing mode */
+ char pad[7];
+
/* RNA - data link */
int array_index; /* if applicable, the index of the RNA-array item to get */
char *rna_path; /* RNA-path to resolve data-access */
@@ -545,6 +548,12 @@ typedef enum eFCurve_Coloring {
FCURVE_COLOR_CUSTOM = 2, /* custom color */
} eFCurve_Coloring;
+/* curve smoothing modes */
+typedef enum eFCurve_Smoothing {
+ FCURVE_SMOOTH_NONE = 0, /* legacy mode: auto handles only consider adjacent points */
+ FCURVE_SMOOTH_CONT_ACCEL = 1, /* maintain continuity of the acceleration */
+} eFCurve_Smoothing;
+
/* ************************************************ */
/* 'Action' Datatypes */
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index a25c00915d2..2207b0ec0b1 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -124,7 +124,8 @@ typedef struct BezTriple {
float back; /* BEZT_IPO_BACK */
float amplitude, period; /* BEZT_IPO_ELASTIC */
- char pad[4];
+ char f5; /* f5: used for auto handle to distinguish between normal handle and exception (extrema) */
+ char pad[3];
} BezTriple;
/* note; alfa location in struct is abused by Key system */
@@ -395,6 +396,12 @@ typedef enum eBezTriple_Handle {
HD_ALIGN_DOUBLESIDE = 5, /* align handles, displayed both of them. used for masks */
} eBezTriple_Handle;
+/* f5 (beztriple) */
+typedef enum eBezTriple_Auto_Type {
+ HD_AUTOTYPE_NORMAL = 0,
+ HD_AUTOTYPE_SPECIAL = 1
+} eBezTriple_Auto_Type;
+
/* interpolation modes (used only for BezTriple->ipo) */
typedef enum eBezTriple_Interpolation {
/* traditional interpolation */