All pastes #487309 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-14 11:55 UTC
rendered paste body
Index: source/blender/blenkernel/intern/lattice.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/intern/lattice.c,v
retrieving revision 1.40
diff -u -p -r1.40 lattice.c
--- source/blender/blenkernel/intern/lattice.c	4 Apr 2007 13:18:28 -0000	1.40
+++ source/blender/blenkernel/intern/lattice.c	13 May 2007 17:14:31 -0000
@@ -568,9 +568,15 @@ static float *calc_curve_deform(Object *
 	/* we want the ipo to work on the default 100 frame range, because there's no  
 	   actual time involved in path position */
 	if(cu->ipo) {
-		fac*= 100.0f;
-		if(calc_ipo_spec(cu->ipo, CU_SPEED, &fac)==0)
-			fac/= 100.0;
+		IpoCurve *icu = find_ipocurve(cu->ipo, CU_SPEED);
+		if(icu) {
+			float xmax = icu->bezt[icu->totvert - 1].vec[1][0];
+			printf("icu->bezt[%d].vec[1][0] = %f\n", icu->totvert - 1,
+			       icu->bezt[icu->totvert - 1].vec[1][0]);
+			fac *= xmax;
+			if(calc_ipo_spec(cu->ipo, CU_SPEED, &fac)==0)
+				fac /= xmax;
+		}
 	}
 	
 	if( where_on_path_deform(par, fac, loc, dir)) {	/* returns OK */