[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43801] trunk/blender/source/blender/ blenkernel: minor cleanup made while looking into bug report ( having vector size in comments is silly, may as well have in declaration)

Campbell Barton ideasman42 at gmail.com
Tue Jan 31 21:38:12 CET 2012


Revision: 43801
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43801
Author:   campbellbarton
Date:     2012-01-31 20:38:03 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
minor cleanup made while looking into bug report (having vector size in comments is silly, may as well have in declaration)

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_anim.h
    trunk/blender/source/blender/blenkernel/BKE_lattice.h
    trunk/blender/source/blender/blenkernel/intern/anim.c
    trunk/blender/source/blender/blenkernel/intern/lattice.c

Modified: trunk/blender/source/blender/blenkernel/BKE_anim.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_anim.h	2012-01-31 19:57:01 UTC (rev 43800)
+++ trunk/blender/source/blender/blenkernel/BKE_anim.h	2012-01-31 20:38:03 UTC (rev 43801)
@@ -61,7 +61,7 @@
 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 */

Modified: trunk/blender/source/blender/blenkernel/BKE_lattice.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_lattice.h	2012-01-31 19:57:01 UTC (rev 43800)
+++ trunk/blender/source/blender/blenkernel/BKE_lattice.h	2012-01-31 20:38:03 UTC (rev 43801)
@@ -59,7 +59,7 @@
                         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],

Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c	2012-01-31 19:57:01 UTC (rev 43800)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c	2012-01-31 20:38:03 UTC (rev 43801)
@@ -585,11 +585,14 @@
 }
 
 
-/* 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;

Modified: trunk/blender/source/blender/blenkernel/intern/lattice.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/lattice.c	2012-01-31 19:57:01 UTC (rev 43800)
+++ trunk/blender/source/blender/blenkernel/intern/lattice.c	2012-01-31 20:38:03 UTC (rev 43801)
@@ -486,8 +486,11 @@
 	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 @@
 	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 @@
 		 * 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 @@
 		/* 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 @@
 /* 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];



More information about the Bf-blender-cvs mailing list