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:
authorSybren A. Stüvel <sybren@blender.org>2020-10-05 14:16:10 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-10-05 15:26:51 +0300
commit8b72d9cc1530fb6fbd37b6a2e02aa61242f8d24a (patch)
treeedd465845cef829425286888de28862e21cfc031 /source/blender/blenkernel/BKE_fcurve.h
parentdfbf8682980ba51451ccc7d1ee4cc02497dfeec3 (diff)
Insert keyframes while preserving shape of curve
Apply the De Casteljau algorithm to split the Bèzier curve at the X coordinate where the new key is inserted, and uses the result to update both the newly inserted and surrounding handles. For curves that use Auto keyframes this has been largely addressed by the new algorithm from D2884. This commit extends this to non-auto handles. This code is heavily based on D3172 by Alexander Gavrilov (@angavrilov). Manifest Task: https://developer.blender.org/T81353
Diffstat (limited to 'source/blender/blenkernel/BKE_fcurve.h')
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 52ef86671cc..9b6189612ba 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -267,6 +267,18 @@ typedef enum eFCU_Cycle_Type {
eFCU_Cycle_Type BKE_fcurve_get_cycle_type(struct FCurve *fcu);
+/** Adjust Bezier handles of all three given BezTriples, so that `bezt` can be inserted between
+ * `prev` and `next` without changing the resulting curve shape.
+ *
+ * \param r_pdelta: return Y difference between `bezt` and the original curve value at its X
+ * position.
+ * \return Whether the split was succesful.
+ */
+bool BKE_bezt_subdivide_handles(struct BezTriple *bezt,
+ struct BezTriple *prev,
+ struct BezTriple *next,
+ float *r_pdelta);
+
/* -------- Curve Sanity -------- */
void calchandles_fcurve(struct FCurve *fcu);