diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-05-05 13:43:11 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-05-05 13:43:11 +0400 |
commit | 42bc76511d829e2fc9002ee7a6f95f30cbb00a42 (patch) | |
tree | 382adf5ca22d9a2f2d441889a0012926c8924e6f /source | |
parent | 33322ad1ffa0f9828f56b428b31c460e4c859f63 (diff) |
Cycles FModifier - Repeat Mirrored now works for cycles before the start of the keyframe range
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 10 |
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... */ |