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:
authorJoshua Leung <aligorith@gmail.com>2009-05-05 13:43:11 +0400
committerJoshua Leung <aligorith@gmail.com>2009-05-05 13:43:11 +0400
commit42bc76511d829e2fc9002ee7a6f95f30cbb00a42 (patch)
tree382adf5ca22d9a2f2d441889a0012926c8924e6f /source/blender/blenkernel/intern/fcurve.c
parent33322ad1ffa0f9828f56b428b31c460e4c859f63 (diff)
Cycles FModifier - Repeat Mirrored now works for cycles before the start of the keyframe range
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r--source/blender/blenkernel/intern/fcurve.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 3d780ee97d5..cade555a07a 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1774,8 +1774,14 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e
/* calculate where in the cycle we are (overwrite evaltime to reflect this) */
if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)(cycle) % 2)) {
- /* when 'mirror' option is used and cycle number is odd, this cycle is played in reverse */
- evaltime= (float)(lastkey[0] - fmod(evaltime-ofs, cycdx));
+ /* when 'mirror' option is used and cycle number is odd, this cycle is played in reverse
+ * - for 'before' extrapolation, we need to flip in a different way, otherwise values past
+ * then end of the curve get referenced (result of fmod will be negative, and with different phase)
+ */
+ if (side < 0)
+ evaltime= (float)(prevkey[0] - fmod(evaltime-ofs, cycdx));
+ else
+ evaltime= (float)(lastkey[0] - fmod(evaltime-ofs, cycdx));
}
else {
/* the cycle is played normally... */