From 8a0a0e3a74a4bbd4161b9bfad79cb6e3350a0ef6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 31 Jan 2012 20:38:03 +0000 Subject: minor cleanup made while looking into bug report (having vector size in comments is silly, may as well have in declaration) --- source/blender/blenkernel/BKE_anim.h | 2 +- source/blender/blenkernel/BKE_lattice.h | 2 +- source/blender/blenkernel/intern/anim.c | 11 +++++++---- source/blender/blenkernel/intern/lattice.c | 28 ++++++++++++++++------------ 4 files changed, 25 insertions(+), 18 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index c2b4e30ef3b..a55955c4d04 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -61,7 +61,7 @@ void animviz_calc_motionpaths(struct Scene *scene, ListBase *targets); void free_path(struct Path *path); void calc_curvepath(struct Object *ob); int interval_test(int min, int max, int p1, int cycl); -int where_on_path(struct Object *ob, float ctime, float *vec, float *dir, float *quat, float *radius, float *weight); +int where_on_path(struct Object *ob, float ctime, float vec[4], float dir[3], float quat[4], float *radius, float *weight); /* ---------------------------------------------------- */ /* Dupli-Geometry */ diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index dcca857179c..b5395309896 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -59,7 +59,7 @@ void curve_deform_verts(struct Scene *scene, struct Object *cuOb, struct Object struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts, const char *vgroup, short defaxis); void curve_deform_vector(struct Scene *scene, struct Object *cuOb, struct Object *target, - float *orco, float *vec, float mat[][3], int no_rot_axis); + float orco[3], float vec[3], float mat[][3], int no_rot_axis); void lattice_deform_verts(struct Object *laOb, struct Object *target, struct DerivedMesh *dm, float (*vertexCos)[3], diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 89bad72044e..fabc35361b9 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -585,11 +585,14 @@ int interval_test(int min, int max, int p1, int cycl) } -/* calculate the deformation implied by the curve path at a given parametric position, and returns whether this operation succeeded - * - *vec needs FOUR items! - * - ctime is normalized range <0-1> +/* calculate the deformation implied by the curve path at a given parametric position, + * and returns whether this operation succeeded. + * + * note: ctime is normalized range <0-1> + * + * returns OK: 1/0 */ -int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat, float *radius, float *weight) /* returns OK */ +int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float quat[4], float *radius, float *weight) { Curve *cu; Nurb *nu; diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 4c30789db73..12c920059e8 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -486,8 +486,11 @@ static void init_curve_deform(Object *par, Object *ob, CurveDeform *cd, int dloc cd->no_rot_axis= 0; } -/* this makes sure we can extend for non-cyclic. *vec needs 4 items! */ -static int where_on_path_deform(Object *ob, float ctime, float *vec, float *dir, float *quat, float *radius) /* returns OK */ +/* this makes sure we can extend for non-cyclic. + * + * returns OK: 1/0 + */ +static int where_on_path_deform(Object *ob, float ctime, float vec[4], float dir[3], float quat[4], float *radius) { Curve *cu= ob->data; BevList *bl; @@ -532,12 +535,12 @@ static int where_on_path_deform(Object *ob, float ctime, float *vec, float *dir, return 0; } - /* for each point, rotate & translate to curve */ - /* use path, since it has constant distances */ - /* co: local coord, result local too */ - /* returns quaternion for rotation, using cd->no_rot_axis */ - /* axis is using another define!!! */ -static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, CurveDeform *cd, float *quatp) +/* for each point, rotate & translate to curve */ +/* use path, since it has constant distances */ +/* co: local coord, result local too */ +/* returns quaternion for rotation, using cd->no_rot_axis */ +/* axis is using another define!!! */ +static int calc_curve_deform(Scene *scene, Object *par, float co[3], short axis, CurveDeform *cd, float quat_r[4]) { Curve *cu= par->data; float fac, loc[4], dir[3], new_quat[4], radius; @@ -636,7 +639,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C * 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); - cent[axis < 4 ? axis-1 : axis-4]= 0.0f; + cent[index]= 0.0f; /* scale if enabled */ @@ -650,8 +653,8 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C /* translation */ add_v3_v3v3(co, cent, loc); - if(quatp) - copy_qt_qt(quatp, quat); + if(quat_r) + copy_qt_qt(quat_r, quat); return 1; } @@ -787,7 +790,8 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target, /* input vec and orco = local coord in armature space */ /* orco is original not-animated or deformed reference point */ /* result written in vec and mat */ -void curve_deform_vector(Scene *scene, Object *cuOb, Object *target, float *orco, float *vec, float mat[][3], int no_rot_axis) +void curve_deform_vector(Scene *scene, Object *cuOb, Object *target, + float orco[3], float vec[3], float mat[][3], int no_rot_axis) { CurveDeform cd; float quat[4]; -- cgit v1.2.3