diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-01 01:32:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-01 01:32:06 +0400 |
commit | 2050ab09a5514290402f53a0ae0331763b8c1cf9 (patch) | |
tree | 3298de4c65388de0343867683e97095c90ffe907 /source | |
parent | 888187fa8cb32b9ec53da3ab07f77bebf8f9a39a (diff) |
calc_curve_deform was using axis range of 1-6, but other parts of the code use 0-5. (confusion here casued an error in the code).
make calc_curve_deform use 0-5 too, only minor changes needed.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/lattice.c | 16 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_curve.c | 4 |
2 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 94922a5d1d1..054a4a3a7dd 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -536,7 +536,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float co[3], Curve *cu= par->data; float fac, loc[4], dir[3], new_quat[4], radius; short index; - const int is_neg_axis = (axis > 3); + const int is_neg_axis = (axis > 2); /* to be sure, mostly after file load */ if(cu->path==NULL) { @@ -546,14 +546,14 @@ static int calc_curve_deform(Scene *scene, Object *par, float co[3], /* options */ if (is_neg_axis) { - index = axis - 4; + index = axis - 3; if(cu->flag & CU_STRETCH) fac= (-co[index]-cd->dmax[index])/(cd->dmax[index] - cd->dmin[index]); else fac= - (co[index]-cd->dmax[index])/(cu->path->totdist); } else { - index = axis - 1; + index = axis; if(cu->flag & CU_STRETCH) fac= (co[index]-cd->dmin[index])/(cd->dmax[index] - cd->dmin[index]); else @@ -579,7 +579,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float co[3], dir[cd->no_rot_axis-1]= 0.0f; /* -1 for compatibility with old track defines */ - vec_to_quat( quat,dir, axis-1, upflag); + vec_to_quat( quat,dir, axis, upflag); /* the tilt */ if(loc[3]!=0.0) { @@ -627,8 +627,8 @@ static int calc_curve_deform(Scene *scene, Object *par, float co[3], /* zero the axis which is not used, * the big block of text above now applies to these 3 lines */ - quat_apply_track(quat, axis-1, (axis==1 || axis==3) ? 1:0); /* up flag is a dummy, set so no rotation is done */ - vec_apply_track(cent, axis-1); + quat_apply_track(quat, axis, (axis == 0 || axis == 2) ? 1:0); /* up flag is a dummy, set so no rotation is done */ + vec_apply_track(cent, axis); cent[index]= 0.0f; @@ -659,7 +659,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target, int a, flag; CurveDeform cd; int use_vgroups; - const int is_neg_axis = (defaxis > 3); + const int is_neg_axis = (defaxis > 2); if(cuOb->type != OB_CURVE) return; @@ -798,7 +798,7 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target, mul_m4_v3(cd.curvespace, vec); - if(calc_curve_deform(scene, cuOb, vec, target->trackflag+1, &cd, quat)) { + if(calc_curve_deform(scene, cuOb, vec, target->trackflag, &cd, quat)) { float qmat[3][3]; quat_to_mat3( qmat,quat); diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 9a7dd3fc898..5ce05e5e062 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -119,8 +119,10 @@ static void deformVerts(ModifierData *md, Object *ob, { CurveModifierData *cmd = (CurveModifierData*) md; + /* silly that defaxis and curve_deform_verts are off by 1 + * but leave for now to save having to call do_versions */ curve_deform_verts(md->scene, cmd->object, ob, derivedData, vertexCos, numVerts, - cmd->name, cmd->defaxis); + cmd->name, cmd->defaxis-1); } static void deformVertsEM( |