[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54479] trunk/blender/source/blender: code cleanup: some style edits, also allow mul_v2_m2v2() to have the same value as in-out, since this is a convention for existing matrix functions.

Campbell Barton ideasman42 at gmail.com
Tue Feb 12 01:35:31 CET 2013


Revision: 54479
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54479
Author:   campbellbarton
Date:     2013-02-12 00:35:31 +0000 (Tue, 12 Feb 2013)
Log Message:
-----------
code cleanup: some style edits, also allow mul_v2_m2v2() to have the same value as in-out, since this is a convention for existing matrix functions.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/math_matrix.c
    trunk/blender/source/blender/editors/interface/interface.c
    trunk/blender/source/blender/editors/uvedit/uvedit_smart_stitch.c

Modified: trunk/blender/source/blender/blenlib/intern/math_matrix.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_matrix.c	2013-02-11 22:52:13 UTC (rev 54478)
+++ trunk/blender/source/blender/blenlib/intern/math_matrix.c	2013-02-12 00:35:31 UTC (rev 54479)
@@ -344,10 +344,13 @@
 	in[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2] + mat[3][2];
 }
 
-void mul_v2_m2v2(float r[2], float M[2][2], const float v[2])
+void mul_v2_m2v2(float r[2], float mat[2][2], const float vec[2])
 {
-	r[0] = M[0][0]*v[0] + M[1][0]*v[1];
-	r[1] = M[0][1]*v[0] + M[1][1]*v[1];
+	float x;
+
+	x = vec[0];
+	r[0] = mat[0][0] * x + mat[1][0] * vec[1];
+	r[1] = mat[0][1] * x + mat[1][1] * vec[1];
 }
 
 /* same as mul_m4_v3() but doesnt apply translation component */

Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c	2013-02-11 22:52:13 UTC (rev 54478)
+++ trunk/blender/source/blender/editors/interface/interface.c	2013-02-12 00:35:31 UTC (rev 54479)
@@ -2781,21 +2781,21 @@
 	return but;
 }
 
-/* ui_def_but_rna_propname and ui_def_but_rna
+static void ui_def_but_rna__disable(uiBut *but)
+{
+	but->flag |= UI_BUT_DISABLED;
+	but->lock = true;
+	but->lockstr = "";
+}
+
+/**
+ * ui_def_but_rna_propname and ui_def_but_rna
  * both take the same args except for propname vs prop, this is done so we can
  * avoid an extra lookup on 'prop' when its already available.
  *
  * When this kind of change won't disrupt branches, best look into making more
  * of our UI functions take prop rather then propname.
  */
-
-#define UI_DEF_BUT_RNA_DISABLE(but)  { \
-		but->flag |= UI_BUT_DISABLED;  \
-		but->lock = TRUE;              \
-		but->lockstr = "";             \
-	} (void)0
-
-
 static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str,
                              int x, int y, short width, short height,
                              PointerRNA *ptr, PropertyRNA *prop, int index,
@@ -2932,7 +2932,7 @@
 	}
 	
 	if (!RNA_property_editable(&but->rnapoin, prop)) {
-		UI_DEF_BUT_RNA_DISABLE(but);
+		ui_def_but_rna__disable(but);
 	}
 
 	if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == FALSE)) {
@@ -2962,7 +2962,7 @@
 	else {
 		but = ui_def_but(block, type, retval, propname, x, y, width, height, NULL, min, max, a1, a2, tip);
 
-		UI_DEF_BUT_RNA_DISABLE(but);
+		ui_def_but_rna__disable(but);
 	}
 
 	return but;

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_smart_stitch.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_smart_stitch.c	2013-02-11 22:52:13 UTC (rev 54478)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_smart_stitch.c	2013-02-12 00:35:31 UTC (rev 54479)
@@ -429,13 +429,18 @@
 			}
 
 			island_stitch_data[i].medianPoint[1] /= state->aspect;
-			if ((island_stitch_data[i].rotation + island_stitch_data[i].rotation_neg < M_PI_2) ||
-				island_stitch_data[i].num_rot_elements == 0 || island_stitch_data[i].num_rot_elements_neg == 0)
-				rotation = (island_stitch_data[i].rotation*island_stitch_data[i].num_rot_elements -
-							island_stitch_data[i].rotation_neg*island_stitch_data[i].num_rot_elements_neg)/totelem;
-			else
-				rotation = (island_stitch_data[i].rotation*island_stitch_data[i].num_rot_elements +
-							(2*M_PI - island_stitch_data[i].rotation_neg)*island_stitch_data[i].num_rot_elements_neg)/totelem;
+			if ((island_stitch_data[i].rotation + island_stitch_data[i].rotation_neg < (float)M_PI_2) ||
+			    island_stitch_data[i].num_rot_elements == 0 || island_stitch_data[i].num_rot_elements_neg == 0)
+			{
+				rotation = (island_stitch_data[i].rotation * island_stitch_data[i].num_rot_elements -
+				            island_stitch_data[i].rotation_neg *
+				            island_stitch_data[i].num_rot_elements_neg) / totelem;
+			}
+			else {
+				rotation = (island_stitch_data[i].rotation * island_stitch_data[i].num_rot_elements +
+				            (2.0f * (float)M_PI - island_stitch_data[i].rotation_neg) *
+				            island_stitch_data[i].num_rot_elements_neg) / totelem;
+			}
 
 			rotate_m2(rotation_mat, rotation);
 			numOfIslandUVs = getNumOfIslandUvs(state->element_map, i);
@@ -521,7 +526,8 @@
 	if (edgesin > 0.0f) {
 		island_stitch_data[element1->island].num_rot_elements++;
 		island_stitch_data[element1->island].rotation += rotation;
-	} else {
+	}
+	else {
 		island_stitch_data[element1->island].num_rot_elements_neg++;
 		island_stitch_data[element1->island].rotation_neg += rotation;
 	}




More information about the Bf-blender-cvs mailing list