[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26063] trunk/blender/source/blender: NLA (Un)Mapping Fixes:

Joshua Leung aligorith at gmail.com
Mon Jan 18 01:35:29 CET 2010


Revision: 26063
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26063
Author:   aligorith
Date:     2010-01-18 01:35:28 +0100 (Mon, 18 Jan 2010)

Log Message:
-----------
NLA (Un)Mapping Fixes:

Hopefully this time I've finally found the proper fix for this. At least in the mini test-suite I made for this, the new inverse process seemed stable enough.

---

Also, tweaked the keyframe drawing code so that it doesn't convert the handles too when performing NLA mapping. This should provide some minor speed boosts when drawing keyframes under these conditions...

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/nla.c
    trunk/blender/source/blender/editors/animation/keyframes_draw.c
    trunk/blender/source/blender/makesrna/intern/rna_nla.c

Modified: trunk/blender/source/blender/blenkernel/intern/nla.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/nla.c	2010-01-17 22:12:00 UTC (rev 26062)
+++ trunk/blender/source/blender/blenkernel/intern/nla.c	2010-01-18 00:35:28 UTC (rev 26063)
@@ -369,14 +369,7 @@
 			return strip->end - scale*(cframe - strip->actstart);
 		}
 		else if (mode == NLATIME_CONVERT_UNMAP) {
-			int repeatsNum = (int)((cframe - strip->start) / (actlength * scale));
-			
-			/* this method doesn't clip the values to lie within the action range only 
-			 *	- the '(repeatsNum * actlength * scale)' compensates for the fmod(...)
-			 *	- the fmod(...) works in the same way as for eval 
-			 */
-			return strip->actend - (repeatsNum * actlength * scale) 
-					- (fmod(cframe - strip->start, actlength*scale) / scale);
+			return strip->actend - (strip->end - cframe) / scale;	
 		}
 		else /* if (mode == NLATIME_CONVERT_EVAL) */{
 			if (IS_EQ(cframe, strip->end) && IS_EQ(strip->repeat, ((int)strip->repeat))) {
@@ -399,14 +392,7 @@
 			return strip->start + scale*(cframe - strip->actstart);
 		}
 		else if (mode == NLATIME_CONVERT_UNMAP) {
-			int repeatsNum = (int)((cframe - strip->start) / (actlength * scale));
-			
-			/* this method doesn't clip the values to lie within the action range only 
-			 *	- the '(repeatsNum * actlength * scale)' compensates for the fmod(...)
-			 *	- the fmod(...) works in the same way as for eval 
-			 */
-			return strip->actstart + (repeatsNum * actlength * scale) 
-					+ (fmod(cframe - strip->start, actlength*scale) / scale);
+			return strip->actstart + (cframe - strip->start) / scale;
 		}
 		else /* if (mode == NLATIME_CONVERT_EVAL) */{
 			if (IS_EQ(cframe, strip->end) && IS_EQ(strip->repeat, ((int)strip->repeat))) {

Modified: trunk/blender/source/blender/editors/animation/keyframes_draw.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframes_draw.c	2010-01-17 22:12:00 UTC (rev 26062)
+++ trunk/blender/source/blender/editors/animation/keyframes_draw.c	2010-01-18 00:35:28 UTC (rev 26063)
@@ -855,7 +855,7 @@
 	if (fcu && fcu->totvert && fcu->bezt) {
 		/* apply NLA-mapping (if applicable) */
 		if (adt)	
-			ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1);
+			ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0);
 		
 		/* if getting long keyframes too, grab the BezTriples in a BST for 
 		 * accelerated searching...
@@ -892,7 +892,7 @@
 		
 		/* unapply NLA-mapping if applicable */
 		if (adt)
-			ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1);
+			ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 0);
 	}
 }
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_nla.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nla.c	2010-01-17 22:12:00 UTC (rev 26062)
+++ trunk/blender/source/blender/makesrna/intern/rna_nla.c	2010-01-18 00:35:28 UTC (rev 26063)
@@ -187,7 +187,7 @@
 	NlaStrip *data= (NlaStrip*)ptr->data;
 	float actlen, mapping;
 	
-	/* set scale value */
+	/* set repeat value */
 	CLAMP(value, 0.01f, 1000.0f); /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
 	data->repeat= value;
 	





More information about the Bf-blender-cvs mailing list