[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47708] trunk/blender/source/blender/ editors/transform: style cleanup

Campbell Barton ideasman42 at gmail.com
Mon Jun 11 00:13:24 CEST 2012


Revision: 47708
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47708
Author:   campbellbarton
Date:     2012-06-10 22:13:17 +0000 (Sun, 10 Jun 2012)
Log Message:
-----------
style cleanup

Modified Paths:
--------------
    trunk/blender/source/blender/editors/transform/transform.c
    trunk/blender/source/blender/editors/transform/transform_constraints.c
    trunk/blender/source/blender/editors/transform/transform_conversions.c
    trunk/blender/source/blender/editors/transform/transform_generics.c
    trunk/blender/source/blender/editors/transform/transform_input.c
    trunk/blender/source/blender/editors/transform/transform_manipulator.c
    trunk/blender/source/blender/editors/transform/transform_orientations.c
    trunk/blender/source/blender/editors/transform/transform_snap.c

Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c	2012-06-10 21:38:24 UTC (rev 47707)
+++ trunk/blender/source/blender/editors/transform/transform.c	2012-06-10 22:13:17 UTC (rev 47708)
@@ -1607,7 +1607,7 @@
 
 	t->state = TRANS_STARTING;
 
-	if ( (prop = RNA_struct_find_property(op->ptr, "texture_space")) && RNA_property_is_set(op->ptr, prop)) {
+	if ((prop = RNA_struct_find_property(op->ptr, "texture_space")) && RNA_property_is_set(op->ptr, prop)) {
 		if (RNA_property_boolean_get(op->ptr, prop)) {
 			options |= CTX_TEXTURE;
 		}
@@ -2071,7 +2071,9 @@
 		mul_qt_fl(quat, qlen);
 		
 		/* quaternions flip w sign to accumulate rotations correctly */
-		if ( (nquat[0] < 0.0f && quat[0] > 0.0f) || (nquat[0] > 0.0f && quat[0] < 0.0f) ) {
+		if ((nquat[0] < 0.0f && quat[0] > 0.0f) ||
+		    (nquat[0] > 0.0f && quat[0] < 0.0f))
+		{
 			mul_qt_fl(quat, -1.0f);
 		}
 	}
@@ -2818,9 +2820,9 @@
 	float ratio;
 	int i;
 	char str[200];
-	
+
 	/* for manipulator, center handle, the scaling can't be done relative to center */
-	if ( (t->flag & T_USES_MANIPULATOR) && t->con.mode == 0) {
+	if ((t->flag & T_USES_MANIPULATOR) && t->con.mode == 0) {
 		ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1])) / 100.0f;
 	}
 	else {

Modified: trunk/blender/source/blender/editors/transform/transform_constraints.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_constraints.c	2012-06-10 21:38:24 UTC (rev 47707)
+++ trunk/blender/source/blender/editors/transform/transform_constraints.c	2012-06-10 22:13:17 UTC (rev 47708)
@@ -77,7 +77,7 @@
 {
 	int mode = t->con.mode;
 	if (mode & CON_APPLY) {
-		float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f;
+		float nval = (t->flag & T_NULL_ONE) ? 1.0f : 0.0f;
 
 		if ((mode & CON_AXIS0) == 0) {
 			vec[0] = nval;
@@ -95,21 +95,21 @@
 {
 	int mode = t->con.mode;
 	if (mode & CON_APPLY) {
-		float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f;
+		float nval = (t->flag & T_NULL_ONE) ? 1.0f : 0.0f;
 
 		if (getConstraintSpaceDimension(t) == 2) {
-			int axis = mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
-			if (axis == (CON_AXIS0|CON_AXIS1)) {
+			int axis = mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2);
+			if (axis == (CON_AXIS0 | CON_AXIS1)) {
 				/* vec[0] = vec[0]; */ /* same */
 				/* vec[1] = vec[1]; */ /* same */
 				vec[2] = nval;
 			}
-			else if (axis == (CON_AXIS1|CON_AXIS2)) {
+			else if (axis == (CON_AXIS1 | CON_AXIS2)) {
 				vec[2] = vec[1];
 				vec[1] = vec[0];
 				vec[0] = nval;
 			}
-			else if (axis == (CON_AXIS0|CON_AXIS2)) {
+			else if (axis == (CON_AXIS0 | CON_AXIS2)) {
 				/* vec[0] = vec[0]; */  /* same */
 				vec[2] = vec[1];
 				vec[1] = nval;
@@ -184,7 +184,7 @@
 {
 	if (t->spacetype == SPACE_VIEW3D) {
 		// View3D *v3d = t->sa->spacedata.first;
-		const float min_dist= 1.0f; // v3d->near;
+		const float min_dist = 1.0f;  /* v3d->near; */
 		float dir[3];
 		float l;
 
@@ -194,7 +194,7 @@
 		}
 		project_v3_v3v3(dir, dir, t->viewinv[2]);
 
-		l= len_v3(dir);
+		l = len_v3(dir);
 
 		if (l < min_dist) {
 			float diff[3];
@@ -211,7 +211,7 @@
 	float norm[3], vec[3], factor, angle;
 	float t_con_center[3];
 
-	if (in[0]==0.0f && in[1]==0.0f && in[2]==0.0f)
+	if (in[0] == 0.0f && in[1] == 0.0f && in[2] == 0.0f)
 		return;
 
 	copy_v3_v3(t_con_center, t->con.center);
@@ -232,12 +232,12 @@
 		project_v3_v3v3(vec, in, t->viewinv[1]);
 		factor = dot_v3v3(t->viewinv[1], vec) * 2.0f;
 		/* since camera distance is quite relative, use quadratic relationship. holding shift can compensate */
-		if (factor<0.0f) factor*= -factor;
-		else factor*= factor;
+		if (factor < 0.0f) factor *= -factor;
+		else factor *= factor;
 
 		copy_v3_v3(out, axis);
 		normalize_v3(out);
-		mul_v3_fl(out, -factor);	/* -factor makes move down going backwards */
+		mul_v3_fl(out, -factor);  /* -factor makes move down going backwards */
 	}
 	else {
 		float v[3], i1[3], i2[3];
@@ -276,10 +276,10 @@
 			sub_v3_v3v3(out, i1, t_con_center);
 
 			/* possible some values become nan when
-			 * viewpoint and object are both zero */
-			if (!finite(out[0])) out[0]= 0.0f;
-			if (!finite(out[1])) out[1]= 0.0f;
-			if (!finite(out[2])) out[2]= 0.0f;
+			* viewpoint and object are both zero */
+			if (!finite(out[0])) out[0] = 0.0f;
+			if (!finite(out[1])) out[1] = 0.0f;
+			if (!finite(out[2])) out[2] = 0.0f;
 		}
 	}
 }
@@ -386,7 +386,7 @@
 			copy_v3_v3(out, pvec);
 		}
 		else {
-			int i=0;
+			int i = 0;
 
 			out[0] = out[1] = out[2] = 0.0f;
 			if (t->con.mode & CON_AXIS0) {
@@ -475,21 +475,21 @@
 static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3], float *angle)
 {
 	if (!td && t->con.mode & CON_APPLY) {
-		int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
+		int mode = t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2);
 
 		switch (mode) {
-		case CON_AXIS0:
-		case (CON_AXIS1|CON_AXIS2):
-			copy_v3_v3(vec, t->con.mtx[0]);
-			break;
-		case CON_AXIS1:
-		case (CON_AXIS0|CON_AXIS2):
-			copy_v3_v3(vec, t->con.mtx[1]);
-			break;
-		case CON_AXIS2:
-		case (CON_AXIS0|CON_AXIS1):
-			copy_v3_v3(vec, t->con.mtx[2]);
-			break;
+			case CON_AXIS0:
+			case (CON_AXIS1 | CON_AXIS2):
+				copy_v3_v3(vec, t->con.mtx[0]);
+				break;
+			case CON_AXIS1:
+			case (CON_AXIS0 | CON_AXIS2):
+				copy_v3_v3(vec, t->con.mtx[1]);
+				break;
+			case CON_AXIS2:
+			case (CON_AXIS0 | CON_AXIS1):
+				copy_v3_v3(vec, t->con.mtx[2]);
+				break;
 		}
 		/* don't flip axis if asked to or if num input */
 		if (angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
@@ -517,26 +517,26 @@
 static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3], float *angle)
 {
 	if (t->con.mode & CON_APPLY) {
-		int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
+		int mode = t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2);
 
 		/* on setup call, use first object */
 		if (td == NULL) {
-			td= t->data;
+			td = t->data;
 		}
 
 		switch (mode) {
-		case CON_AXIS0:
-		case (CON_AXIS1|CON_AXIS2):
-			copy_v3_v3(vec, td->axismtx[0]);
-			break;
-		case CON_AXIS1:
-		case (CON_AXIS0|CON_AXIS2):
-			copy_v3_v3(vec, td->axismtx[1]);
-			break;
-		case CON_AXIS2:
-		case (CON_AXIS0|CON_AXIS1):
-			copy_v3_v3(vec, td->axismtx[2]);
-			break;
+			case CON_AXIS0:
+			case (CON_AXIS1 | CON_AXIS2):
+				copy_v3_v3(vec, td->axismtx[0]);
+				break;
+			case CON_AXIS1:
+			case (CON_AXIS0 | CON_AXIS2):
+				copy_v3_v3(vec, td->axismtx[1]);
+				break;
+			case CON_AXIS2:
+			case (CON_AXIS0 | CON_AXIS1):
+				copy_v3_v3(vec, td->axismtx[2]);
+				break;
 		}
 		if (angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
 			if (dot_v3v3(vec, t->viewinv[2]) > 0.0f) {
@@ -604,33 +604,33 @@
 	char text[40];
 
 	switch (orientation) {
-	case V3D_MANIP_GLOBAL:
+		case V3D_MANIP_GLOBAL:
 		{
-			float mtx[3][3]= MAT3_UNITY;
+			float mtx[3][3] = MAT3_UNITY;
 			BLI_snprintf(text, sizeof(text), ftext, "global");
 			setConstraint(t, mtx, mode, text);
 		}
 		break;
-	case V3D_MANIP_LOCAL:
-		BLI_snprintf(text, sizeof(text), ftext, "local");
-		setLocalConstraint(t, mode, text);
-		break;
-	case V3D_MANIP_NORMAL:
-		BLI_snprintf(text, sizeof(text), ftext, "normal");
-		setConstraint(t, t->spacemtx, mode, text);
-		break;
-	case V3D_MANIP_VIEW:
-		BLI_snprintf(text, sizeof(text), ftext, "view");
-		setConstraint(t, t->spacemtx, mode, text);
-		break;
-	case V3D_MANIP_GIMBAL:
-		BLI_snprintf(text, sizeof(text), ftext, "gimbal");
-		setConstraint(t, t->spacemtx, mode, text);
-		break;
-	default: /* V3D_MANIP_CUSTOM */
-		BLI_snprintf(text, sizeof(text), ftext, t->spacename);
-		setConstraint(t, t->spacemtx, mode, text);
-		break;
+		case V3D_MANIP_LOCAL:
+			BLI_snprintf(text, sizeof(text), ftext, "local");
+			setLocalConstraint(t, mode, text);
+			break;
+		case V3D_MANIP_NORMAL:
+			BLI_snprintf(text, sizeof(text), ftext, "normal");
+			setConstraint(t, t->spacemtx, mode, text);
+			break;
+		case V3D_MANIP_VIEW:
+			BLI_snprintf(text, sizeof(text), ftext, "view");
+			setConstraint(t, t->spacemtx, mode, text);
+			break;
+		case V3D_MANIP_GIMBAL:
+			BLI_snprintf(text, sizeof(text), ftext, "gimbal");
+			setConstraint(t, t->spacemtx, mode, text);
+			break;
+		default: /* V3D_MANIP_CUSTOM */
+			BLI_snprintf(text, sizeof(text), ftext, t->spacename);
+			setConstraint(t, t->spacemtx, mode, text);
+			break;
 	}
 
 	t->con.orientation = orientation;
@@ -682,8 +682,8 @@
 
 			setlinestyle(1);
 			glBegin(GL_LINE_STRIP);
-				glVertex3fv(tc->center);
-				glVertex3fv(vec);
+			glVertex3fv(tc->center);
+			glVertex3fv(vec);
 			glEnd();
 			setlinestyle(0);
 
@@ -733,7 +733,7 @@
 			float aspx, aspy;
 
 			ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
-			glScalef(1.0f/aspx, 1.0f/aspy, 1.0);
+			glScalef(1.0f / aspx, 1.0f / aspy, 1.0);
 		}
 
 		set_inverted_drawing(1);
@@ -747,7 +747,7 @@
 static void drawObjectConstraint(TransInfo *t)
 {
 	int i;
-	TransData * td = t->data;
+	TransData *td = t->data;
 
 	/* Draw the first one lighter because that's the one who controls the others.
 	 * Meaning the transformation is projected on that one and just copied on the others
@@ -767,7 +767,7 @@
 
 	td++;
 
-	for (i=1; i < t->total; i++, td++) {
+	for (i = 1; i < t->total; i++, td++) {
 		if (t->con.mode & CON_AXIS0) {
 			drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', 0);
 		}
@@ -791,7 +791,7 @@
 
 void stopConstraint(TransInfo *t)
 {
-	t->con.mode &= ~(CON_APPLY|CON_SELECT);
+	t->con.mode &= ~(CON_APPLY | CON_SELECT);
 	*t->con.text = '\0';
 	t->num.idx_max = t->idx_max;
 }
@@ -803,21 +803,21 @@
 	unit_m3(t->con.pmtx);
 
 	if (!(t->con.mode & CON_AXIS0)) {
-		t->con.pmtx[0][0]		=
-			t->con.pmtx[0][1]	=
-			t->con.pmtx[0][2]	= 0.0f;
+		t->con.pmtx[0][0]       =
+		    t->con.pmtx[0][1]   =
+		    t->con.pmtx[0][2]   = 0.0f;
 	}
 
 	if (!(t->con.mode & CON_AXIS1)) {
-		t->con.pmtx[1][0]		=
-			t->con.pmtx[1][1]	=
-			t->con.pmtx[1][2]	= 0.0f;
+		t->con.pmtx[1][0]       =
+		    t->con.pmtx[1][1]   =
+		    t->con.pmtx[1][2]   = 0.0f;
 	}
 
 	if (!(t->con.mode & CON_AXIS2)) {
-		t->con.pmtx[2][0]		=
-			t->con.pmtx[2][1]	=
-			t->con.pmtx[2][2]	= 0.0f;
+		t->con.pmtx[2][0]       =
+		    t->con.pmtx[2][1]   =
+		    t->con.pmtx[2][2]   = 0.0f;
 	}
 
 	mul_m3_m3m3(mat, t->con.pmtx, t->con.imtx);
@@ -866,7 +866,7 @@
 static void setNearestAxis2d(TransInfo *t)
 {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list