[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45585] trunk/blender/source/blender/ editors/uvedit: style cleanup: uv editor

Campbell Barton ideasman42 at gmail.com
Fri Apr 13 08:34:00 CEST 2012


Revision: 45585
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45585
Author:   campbellbarton
Date:     2012-04-13 06:33:59 +0000 (Fri, 13 Apr 2012)
Log Message:
-----------
style cleanup: uv editor

Modified Paths:
--------------
    trunk/blender/source/blender/editors/uvedit/uvedit_buttons.c
    trunk/blender/source/blender/editors/uvedit/uvedit_draw.c
    trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
    trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c
    trunk/blender/source/blender/editors/uvedit/uvedit_smart_stitch.c
    trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_buttons.c	2012-04-13 05:39:27 UTC (rev 45584)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_buttons.c	2012-04-13 06:33:59 UTC (rev 45585)
@@ -58,7 +58,7 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
-#define B_UVEDIT_VERTEX		3
+#define B_UVEDIT_VERTEX     3
 
 /* UV Utilities */
 
@@ -138,27 +138,27 @@
 		}
 
 		if (sima->flag & SI_COORDFLOATS) {
-			step= 1;
-			digits= 3;
+			step = 1;
+			digits = 3;
 		}
 		else {
-			step= 100;
-			digits= 2;
+			step = 100;
+			digits = 2;
 		}
 		
 		uiBlockBeginAlign(block);
-		uiDefButF(block, NUM, B_UVEDIT_VERTEX, "X:",	10, 10, 145, 19, &uvedit_old_center[0], -10*imx, 10.0*imx, step, digits, "");
-		uiDefButF(block, NUM, B_UVEDIT_VERTEX, "Y:",	165, 10, 145, 19, &uvedit_old_center[1], -10*imy, 10.0*imy, step, digits, "");
+		uiDefButF(block, NUM, B_UVEDIT_VERTEX, "X:",    10, 10, 145, 19, &uvedit_old_center[0], -10 * imx, 10.0 * imx, step, digits, "");
+		uiDefButF(block, NUM, B_UVEDIT_VERTEX, "Y:",    165, 10, 145, 19, &uvedit_old_center[1], -10 * imy, 10.0 * imy, step, digits, "");
 		uiBlockEndAlign(block);
 	}
 }
 
 static void do_uvedit_vertex(bContext *C, void *UNUSED(arg), int event)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Image *ima= sima->image;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = sima->image;
 	BMEditMesh *em;
 	float center[2], delta[2];
 	int imx, imy;
@@ -172,12 +172,12 @@
 	uvedit_center(scene, em, ima, center);
 
 	if (sima->flag & SI_COORDFLOATS) {
-		delta[0]= uvedit_old_center[0] - center[0];
-		delta[1]= uvedit_old_center[1] - center[1];
+		delta[0] = uvedit_old_center[0] - center[0];
+		delta[1] = uvedit_old_center[1] - center[1];
 	}
 	else {
-		delta[0]= uvedit_old_center[0]/imx - center[0];
-		delta[1]= uvedit_old_center[1]/imy - center[1];
+		delta[0] = uvedit_old_center[0] / imx - center[0];
+		delta[1] = uvedit_old_center[1] / imy - center[1];
 	}
 
 	uvedit_translate(scene, em, ima, delta);
@@ -189,7 +189,7 @@
 
 static int image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt))
 {
-	Object *obedit= CTX_data_edit_object(C);
+	Object *obedit = CTX_data_edit_object(C);
 	return ED_uvedit_test(obedit);
 }
 
@@ -197,7 +197,7 @@
 {
 	uiBlock *block;
 	
-	block= uiLayoutAbsoluteBlock(pa->layout);
+	block = uiLayoutAbsoluteBlock(pa->layout);
 	uiBlockSetHandleFunc(block, do_uvedit_vertex, NULL);
 
 	uvedit_vertex_buttons(C, block);
@@ -207,11 +207,11 @@
 {
 	PanelType *pt;
 
-	pt= MEM_callocN(sizeof(PanelType), "spacetype image panel uv");
+	pt = MEM_callocN(sizeof(PanelType), "spacetype image panel uv");
 	strcpy(pt->idname, "IMAGE_PT_uv");
 	strcpy(pt->label, "UV Vertex");
-	pt->draw= image_panel_uv;
-	pt->poll= image_panel_uv_poll;
+	pt->draw = image_panel_uv;
+	pt->poll = image_panel_uv_poll;
 	BLI_addtail(&art->paneltypes, pt);
 }
 

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_draw.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_draw.c	2012-04-13 05:39:27 UTC (rev 45584)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_draw.c	2012-04-13 06:33:59 UTC (rev 45585)
@@ -71,37 +71,37 @@
 	ED_space_image_size(sima, &width, &height);
 	ED_space_image_zoom(sima, ar, &zoomx, &zoomy);
 
-	w= zoomx*width/256.0f;
-	h= zoomy*height/256.0f;
+	w = zoomx * width / 256.0f;
+	h = zoomy * height / 256.0f;
 	
 	cpack(0xFFFFFF);
 	glTranslatef(sima->cursor[0], sima->cursor[1], 0.0);
-	fdrawline(-0.05f/w, 0, 0, 0.05f/h);
-	fdrawline(0, 0.05f/h, 0.05f/w, 0.0f);
-	fdrawline(0.05f/w, 0.0f, 0.0f, -0.05f/h);
-	fdrawline(0.0f, -0.05f/h, -0.05f/w, 0.0f);
+	fdrawline(-0.05f / w, 0, 0, 0.05f / h);
+	fdrawline(0, 0.05f / h, 0.05f / w, 0.0f);
+	fdrawline(0.05f / w, 0.0f, 0.0f, -0.05f / h);
+	fdrawline(0.0f, -0.05f / h, -0.05f / w, 0.0f);
 
 	setlinestyle(4);
 	cpack(0xFF);
-	fdrawline(-0.05f/w, 0.0f, 0.0f, 0.05f/h);
-	fdrawline(0.0f, 0.05f/h, 0.05f/w, 0.0f);
-	fdrawline(0.05f/w, 0.0f, 0.0f, -0.05f/h);
-	fdrawline(0.0f, -0.05f/h, -0.05f/w, 0.0f);
+	fdrawline(-0.05f / w, 0.0f, 0.0f, 0.05f / h);
+	fdrawline(0.0f, 0.05f / h, 0.05f / w, 0.0f);
+	fdrawline(0.05f / w, 0.0f, 0.0f, -0.05f / h);
+	fdrawline(0.0f, -0.05f / h, -0.05f / w, 0.0f);
 
 
 	setlinestyle(0.0f);
 	cpack(0x0);
-	fdrawline(-0.020f/w, 0.0f, -0.1f/w, 0.0f);
-	fdrawline(0.1f/w, 0.0f, 0.020f/w, 0.0f);
-	fdrawline(0.0f, -0.020f/h, 0.0f, -0.1f/h);
-	fdrawline(0.0f, 0.1f/h, 0.0f, 0.020f/h);
+	fdrawline(-0.020f / w, 0.0f, -0.1f / w, 0.0f);
+	fdrawline(0.1f / w, 0.0f, 0.020f / w, 0.0f);
+	fdrawline(0.0f, -0.020f / h, 0.0f, -0.1f / h);
+	fdrawline(0.0f, 0.1f / h, 0.0f, 0.020f / h);
 
 	setlinestyle(1);
 	cpack(0xFFFFFF);
-	fdrawline(-0.020f/w, 0.0f, -0.1f/w, 0.0f);
-	fdrawline(0.1f/w, 0.0f, 0.020f/w, 0.0f);
-	fdrawline(0.0f, -0.020f/h, 0.0f, -0.1f/h);
-	fdrawline(0.0f, 0.1f/h, 0.0f, 0.020f/h);
+	fdrawline(-0.020f / w, 0.0f, -0.1f / w, 0.0f);
+	fdrawline(0.1f / w, 0.0f, 0.020f / w, 0.0f);
+	fdrawline(0.0f, -0.020f / h, 0.0f, -0.1f / h);
+	fdrawline(0.0f, 0.1f / h, 0.0f, 0.020f / h);
 
 	glTranslatef(-sima->cursor[0], -sima->cursor[1], 0.0);
 	setlinestyle(0);
@@ -109,7 +109,7 @@
 
 static int draw_uvs_face_check(Scene *scene)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
 	/* checks if we are selecting only faces */
 	if (ts->uv_flag & UV_SYNC_SELECTION) {
@@ -139,7 +139,7 @@
 	BM_ITER(efa, &iter, bm, BM_FACES_OF_MESH, NULL) {
 		glBegin(GL_LINE_LOOP);
 		BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, efa) {
-			luv= CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+			luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
 
 			glVertex2fv(luv->uv);
 		}
@@ -168,7 +168,7 @@
 	BMIter iter, liter;
 	MTexPoly *tf;
 	MLoopUV *luv;
-	Image *ima= sima->image;
+	Image *ima = sima->image;
 	BLI_array_declare(tf_uv);
 	BLI_array_declare(tf_uvorig);
 	float aspx, aspy, col[4], (*tf_uv)[2] = NULL, (*tf_uvorig)[2] = NULL;
@@ -176,13 +176,13 @@
 
 	ED_space_image_uv_aspect(sima, &aspx, &aspy);
 	
-	switch(sima->dt_uvstretch) {
+	switch (sima->dt_uvstretch) {
 		case SI_UVDT_STRETCH_AREA:
 		{
-			float totarea=0.0f, totuvarea=0.0f, areadiff, uvarea, area;
+			float totarea = 0.0f, totuvarea = 0.0f, areadiff, uvarea, area;
 			
 			BM_ITER(efa, &iter, bm, BM_FACES_OF_MESH, NULL) {
-				tf= CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY);
+				tf = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY);
 				
 				BLI_array_empty(tf_uv);
 				BLI_array_empty(tf_uvorig);
@@ -191,7 +191,7 @@
 
 				i = 0;
 				BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, efa) {
-					luv= CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+					luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
 
 					copy_v2_v2(tf_uvorig[i], luv->uv);
 
@@ -209,7 +209,7 @@
 				}
 				else {
 					if (tf == activetf)
-						activetf= NULL;
+						activetf = NULL;
 					BM_elem_flag_disable(efa, BM_ELEM_TAG);
 				}
 			}
@@ -241,7 +241,7 @@
 
 						i = 0;
 						BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, efa) {
-							luv= CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+							luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
 
 							copy_v2_v2(tf_uvorig[i], luv->uv);
 
@@ -255,10 +255,10 @@
 						
 						if (area < FLT_EPSILON || uvarea < FLT_EPSILON)
 							areadiff = 1.0f;
-						else if (area>uvarea)
-							areadiff = 1.0f-(uvarea/area);
+						else if (area > uvarea)
+							areadiff = 1.0f - (uvarea / area);
 						else
-							areadiff = 1.0f-(area/uvarea);
+							areadiff = 1.0f - (area / uvarea);
 						
 						weight_to_rgb(col, areadiff);
 						glColor3fv(col);
@@ -278,8 +278,8 @@
 		{
 			float *uvang = NULL;
 			float *ang = NULL;
-			float (* av)[3] = NULL; /* use for 2d and 3d  angle vectors */
-			float (* auv)[2] = NULL;
+			float (*av)[3] = NULL;  /* use for 2d and 3d  angle vectors */
+			float (*auv)[2] = NULL;
 			float a;
 
 			BLI_array_declare(uvang);
@@ -292,7 +292,7 @@
 			glShadeModel(GL_SMOOTH);
 			
 			BM_ITER(efa, &iter, bm, BM_FACES_OF_MESH, NULL) {
-				tf= CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY);
+				tf = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY);
 				
 				if (uvedit_face_visible(scene, ima, efa, tf)) {
 					nverts = efa->len;
@@ -324,22 +324,22 @@
 						j = i;
 					}
 
-					for(i = 0; i < nverts; i++) {
+					for (i = 0; i < nverts; i++) {
 #if 0
 						/* Simple but slow, better reuse normalized vectors
 						 * (Not ported to bmesh, copied for reference) */
 						uvang1 = RAD2DEG(angle_v2v2v2(tf_uv[3], tf_uv[0], tf_uv[1]));
 						ang1 = RAD2DEG(angle_v3v3v3(efa->v4->co, efa->v1->co, efa->v2->co));
 #endif
-						uvang[i] = angle_normalized_v2v2(auv[i], auv[(i+1)%nverts]);
-						ang[i] = angle_normalized_v3v3(av[i], av[(i+1)%nverts]);
+						uvang[i] = angle_normalized_v2v2(auv[i], auv[(i + 1) % nverts]);
+						ang[i] = angle_normalized_v3v3(av[i], av[(i + 1) % nverts]);
 					}
 
 					glBegin(GL_POLYGON);
 					BM_ITER_INDEX(l, &liter, bm, BM_LOOPS_OF_FACE, efa, i) {
 						luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
-						a = fabsf(uvang[i]-ang[i])/(float)M_PI;
-						weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f));
+						a = fabsf(uvang[i] - ang[i]) / (float)M_PI;
+						weight_to_rgb(col, 1.0f - powf((1.0f - a), 2.0f));
 						glColor3fv(col);
 						glVertex2fv(luv->uv);
 					}
@@ -347,7 +347,7 @@
 				}
 				else {
 					if (tf == activetf)
-						activetf= NULL;
+						activetf = NULL;
 					BM_elem_flag_disable(efa, BM_ELEM_TAG);
 				}
 			}
@@ -373,15 +373,15 @@
 
 	glColor3ub(96, 96, 96);
 
-	for (base=scene->base.first; base; base=base->next) {
-		Object *ob= base->object;
+	for (base = scene->base.first; base; base = base->next) {
+		Object *ob = base->object;
 
 		if (!(base->flag & SELECT)) continue;
 		if (!(base->lay & scene->lay)) continue;
 		if (ob->restrictflag & OB_RESTRICT_VIEW) continue;
 
-		if ((ob->type==OB_MESH) && (ob!=obedit)) {
-			Mesh *me= ob->data;
+		if ((ob->type == OB_MESH) && (ob != obedit)) {
+			Mesh *me = ob->data;
 
 			if (me->mtpoly) {
 				MPoly *mpoly = me->mpoly;
@@ -407,7 +407,7 @@
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list