[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43803] trunk/blender/source/blender/ blenkernel/intern/lattice.c: fix [#30037] Curve Modifier doesn' t work within -X -Y -Z translation in such cases?

Campbell Barton ideasman42 at gmail.com
Tue Jan 31 22:06:59 CET 2012


Revision: 43803
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43803
Author:   campbellbarton
Date:     2012-01-31 21:06:52 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
fix [#30037] Curve Modifier doesn't work within -X -Y -Z translation in such cases?

the curve modifier was applying the offet between the mesh and the curve object twice.
for positive axis it was (offset+offser), for neg axis (offset-offset) --- giving no offset,
in both cases not very useful.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/lattice.c

Modified: trunk/blender/source/blender/blenkernel/intern/lattice.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/lattice.c	2012-01-31 20:48:48 UTC (rev 43802)
+++ trunk/blender/source/blender/blenkernel/intern/lattice.c	2012-01-31 21:06:52 UTC (rev 43803)
@@ -462,27 +462,17 @@
 	   so we store in latmat transform from path coord inside object 
 	 */
 typedef struct {
-	float dmin[3], dmax[3], dscale, dloc[3];
+	float dmin[3], dmax[3];
 	float curvespace[4][4], objectspace[4][4], objectspace3[3][3];
 	int no_rot_axis;
 } CurveDeform;
 
-static void init_curve_deform(Object *par, Object *ob, CurveDeform *cd, int dloc)
+static void init_curve_deform(Object *par, Object *ob, CurveDeform *cd)
 {
 	invert_m4_m4(ob->imat, ob->obmat);
 	mult_m4_m4m4(cd->objectspace, ob->imat, par->obmat);
 	invert_m4_m4(cd->curvespace, cd->objectspace);
 	copy_m3_m4(cd->objectspace3, cd->objectspace);
-	
-	// offset vector for 'no smear'
-	if(dloc) {
-		invert_m4_m4(par->imat, par->obmat);
-		mul_v3_m4v3(cd->dloc, par->imat, ob->obmat[3]);
-	}
-	else {
-		cd->dloc[0]=cd->dloc[1]=cd->dloc[2]= 0.0f;
-	}
-	
 	cd->no_rot_axis= 0;
 }
 
@@ -561,13 +551,13 @@
 		if(cu->flag & CU_STRETCH)
 			fac= (-co[index]-cd->dmax[index])/(cd->dmax[index] - cd->dmin[index]);
 		else
-			fac= (cd->dloc[index])/(cu->path->totdist) - (co[index]-cd->dmax[index])/(cu->path->totdist);
+			fac= - (co[index]-cd->dmax[index])/(cu->path->totdist);
 	}
 	else {
 		if(cu->flag & CU_STRETCH)
 			fac= (co[index]-cd->dmin[index])/(cd->dmax[index] - cd->dmin[index]);
 		else
-			fac= (cd->dloc[index])/(cu->path->totdist) + (co[index]-cd->dmin[index])/(cu->path->totdist);
+			fac= + (co[index]-cd->dmin[index])/(cu->path->totdist);
 	}
 	
 #if 0 // XXX old animation system
@@ -677,7 +667,7 @@
 	flag = cu->flag;
 	cu->flag |= (CU_PATH|CU_FOLLOW); // needed for path & bevlist
 
-	init_curve_deform(cuOb, target, &cd, (cu->flag & CU_STRETCH)==0);
+	init_curve_deform(cuOb, target, &cd);
 
 	/* dummy bounds, keep if CU_DEFORM_BOUNDS_OFF is set */
 	if(defaxis < 3) {
@@ -799,7 +789,7 @@
 		return;
 	}
 
-	init_curve_deform(cuOb, target, &cd, 0);	/* 0 no dloc */
+	init_curve_deform(cuOb, target, &cd);
 	cd.no_rot_axis= no_rot_axis;				/* option to only rotate for XY, for example */
 	
 	copy_v3_v3(cd.dmin, orco);




More information about the Bf-blender-cvs mailing list