[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31086] trunk/blender/source/blender/ modifiers/intern/MOD_screw.c: fix for un-initialized variable in screw modifier.

Campbell Barton ideasman42 at gmail.com
Fri Aug 6 02:13:45 CEST 2010


Revision: 31086
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31086
Author:   campbellbarton
Date:     2010-08-06 02:13:44 +0200 (Fri, 06 Aug 2010)

Log Message:
-----------
fix for un-initialized variable in screw modifier.

Modified Paths:
--------------
    trunk/blender/source/blender/modifiers/intern/MOD_screw.c

Modified: trunk/blender/source/blender/modifiers/intern/MOD_screw.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_screw.c	2010-08-05 23:40:21 UTC (rev 31085)
+++ trunk/blender/source/blender/modifiers/intern/MOD_screw.c	2010-08-06 00:13:44 UTC (rev 31086)
@@ -195,16 +195,13 @@
 	axis_vec[ltmd->axis]= 1.0f;
 
 	if (ltmd->ob_axis) {
-		float mtx3_tx[3][3];
 		/* calc the matrix relative to the axis object */
 		invert_m4_m4(mtx_tmp_a, ob->obmat);
 		copy_m4_m4(mtx_tx_inv, ltmd->ob_axis->obmat);
 		mul_m4_m4m4(mtx_tx, mtx_tx_inv, mtx_tmp_a);
 
-		copy_m3_m4(mtx3_tx, mtx_tx);
-
 		/* calc the axis vec */
-		mul_m3_v3(mtx3_tx, axis_vec);
+		mul_mat3_m4_v3(mtx_tx, axis_vec); /* only rotation component */
 		normalize_v3(axis_vec);
 
 		/* screw */
@@ -226,8 +223,9 @@
 
 #if 0	// cant incluide this, not pradictable enough, though quite fun,.
 		if(ltmd->flag & MOD_SCREW_OBJECT_ANGLE) {
+			float mtx3_tx[3][3];
+			copy_m3_m4(mtx3_tx, mtx_tx);
 
-
 			float vec[3] = {0,1,0};
 			float cross1[3];
 			float cross2[3];
@@ -511,7 +509,7 @@
 							else {
 								/* not so simple to work out which edge is higher */
 								sub_v3_v3v3(tmp_vec1, tmpf1, vc_tmp->co);
-								sub_v3_v3v3(tmp_vec1, tmpf2, vc_tmp->co);
+								sub_v3_v3v3(tmp_vec2, tmpf2, vc_tmp->co);
 								normalize_v3(tmp_vec1);
 								normalize_v3(tmp_vec2);
 
@@ -673,10 +671,9 @@
 	for (step=1; step < step_tot; step++) {
 		const int varray_stride= totvert * step;
 		float step_angle;
-		float no_tx[3];
+		float nor_tx[3];
 		/* Rotation Matrix */
-		if (close)		step_angle= (angle / step_tot) * step;
-		else			step_angle= (angle / (step_tot-1)) * step;
+		step_angle= (angle / (step_tot - (!close))) * step;
 
 		if (ltmd->ob_axis) {
 			axis_angle_to_mat3(mat3, axis_vec, step_angle);
@@ -700,10 +697,10 @@
 		for (j=0; j<totvert; j++, mv_new_base++, mv_new++) {
 			/* set normal */
 			if(vert_connect) {
-				mul_v3_m3v3(no_tx, mat3, vert_connect[j].no);
+				mul_v3_m3v3(nor_tx, mat3, vert_connect[j].no);
 
 				/* set the normal now its transformed */
-				normal_float_to_short_v3(mv_new->no, no_tx);
+				normal_float_to_short_v3(mv_new->no, nor_tx);
 			}
 			
 			/* set location */





More information about the Bf-blender-cvs mailing list