From 1cb884be35e160740e97065afd6548e6a052c9d8 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Tue, 17 Oct 2017 19:39:10 +0300 Subject: Make auto handle placement aware of cyclic extrapolation. Cyclic extrapolation is implemented as an f-curve modifier, so this technically violates abstraction separation and is something of a hack. However without such behavior achieving smooth looping with cyclic extrapolation is extremely cumbersome. The new behavior is applied when the first modifier is Cyclic extrapolation in Repeat or Repeat with Offset mode without using influence, repeat count or range restrictions. This change in behavior means that curve handles have to be updated when the modifier is added, removed or its options change. Due to the way code is structured, it seems it requires a helper link to the containing curve from the modifier object. Reviewers: aligorith Differential Revision: https://developer.blender.org/D2783 --- source/blender/blenkernel/BKE_fcurve.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/BKE_fcurve.h') diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index b38f1299763..09f5ecce050 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -188,7 +188,7 @@ const FModifierTypeInfo *get_fmodifier_typeinfo(const int type); /* ---------------------- */ -struct FModifier *add_fmodifier(ListBase *modifiers, int type); +struct FModifier *add_fmodifier(ListBase *modifiers, int type, struct FCurve *owner_fcu); struct FModifier *copy_fmodifier(const struct FModifier *src); void copy_fmodifiers(ListBase *dst, const ListBase *src); bool remove_fmodifier(ListBase *modifiers, struct FModifier *fcm); @@ -266,6 +266,9 @@ bool fcurve_are_keyframes_usable(struct FCurve *fcu); bool fcurve_is_keyframable(struct FCurve *fcu); bool BKE_fcurve_is_protected(struct FCurve *fcu); +/* The curve is an infinite cycle via Cycles modifier */ +bool BKE_fcurve_is_cyclic(struct FCurve *fcu); + /* -------- Curve Sanity -------- */ void calchandles_fcurve(struct FCurve *fcu); -- cgit v1.2.3