[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20068] branches/blender2.5/blender/source /blender/blenkernel/intern/fcurve.c: Cycles FModifier - Repeat Mirrored now works for cycles before the start of the keyframe range

Joshua Leung aligorith at gmail.com
Tue May 5 11:43:11 CEST 2009


Revision: 20068
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20068
Author:   aligorith
Date:     2009-05-05 11:43:11 +0200 (Tue, 05 May 2009)

Log Message:
-----------
Cycles FModifier - Repeat Mirrored now works for cycles before the start of the keyframe range 

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c	2009-05-05 05:57:08 UTC (rev 20067)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c	2009-05-05 09:43:11 UTC (rev 20068)
@@ -1774,8 +1774,14 @@
 		
 		/* 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... */





More information about the Bf-blender-cvs mailing list