From c7942efdba12dcfbeede0219968c95e058a2baed Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 13 May 2005 13:06:20 +0000 Subject: [PATCH] Deform with Curves didn't take the 'tilt' value into account. Note, the tilting only works for '3D' curves, and is accessible in EditMode curve with TKEY. --- source/blender/blenkernel/intern/lattice.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 4d6f0942f91..3da60f99826 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -457,7 +457,7 @@ static int where_on_path_deform(Object *ob, float ctime, float *vec, float *dir) static void calc_curve_deform(Object *par, float *co, short axis, CurveDeform *cd) { Curve *cu= par->data; - float fac, loc[4], dir[3], *quat, mat[3][3], cent[3]; + float fac, loc[4], dir[3], *quat, q[4], mat[3][3], cent[3]; short upflag, index; if(axis==OB_POSX || axis==OB_NEGX) { @@ -495,6 +495,17 @@ static void calc_curve_deform(Object *par, float *co, short axis, CurveDeform *c if( where_on_path_deform(par, fac, loc, dir)) { /* returns OK */ quat= vectoquat(dir, axis, upflag); + + /* the tilt */ + if(loc[3]!=0.0) { + Normalise(dir); + q[0]= (float)cos(0.5*loc[3]); + fac= (float)sin(0.5*loc[3]); + q[1]= -fac*dir[0]; + q[2]= -fac*dir[1]; + q[3]= -fac*dir[2]; + QuatMul(quat, q, quat); + } QuatToMat3(quat, mat); /* local rotation */