[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45133] trunk/blender/source/blender/ editors/sculpt_paint/paint_vertex.c: style cleanup: operator/whitespace

Campbell Barton ideasman42 at gmail.com
Sat Mar 24 12:28:09 CET 2012


Revision: 45133
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45133
Author:   campbellbarton
Date:     2012-03-24 11:27:52 +0000 (Sat, 24 Mar 2012)
Log Message:
-----------
style cleanup: operator/whitespace

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2012-03-24 11:02:28 UTC (rev 45132)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2012-03-24 11:27:52 UTC (rev 45133)
@@ -131,10 +131,10 @@
 {
 	if (vertex_paint_mode_poll(C) && 
 	   paint_brush(&CTX_data_tool_settings(C)->vpaint->paint)) {
-		ScrArea *sa= CTX_wm_area(C);
-		if (sa->spacetype==SPACE_VIEW3D) {
-			ARegion *ar= CTX_wm_region(C);
-			if (ar->regiontype==RGN_TYPE_WINDOW)
+		ScrArea *sa = CTX_wm_area(C);
+		if (sa->spacetype == SPACE_VIEW3D) {
+			ARegion *ar = CTX_wm_region(C);
+			if (ar->regiontype == RGN_TYPE_WINDOW)
 				return 1;
 			}
 		}
@@ -150,17 +150,17 @@
 
 int weight_paint_poll(bContext *C)
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	ScrArea *sa;
 
-	if (	(ob != NULL) &&
-		(ob->mode & OB_MODE_WEIGHT_PAINT) &&
-		(paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != NULL) &&
-		(sa= CTX_wm_area(C)) &&
-		(sa->spacetype == SPACE_VIEW3D)
-	) {
-		ARegion *ar= CTX_wm_region(C);
-		if (ar->regiontype==RGN_TYPE_WINDOW) {
+	if ((ob != NULL) &&
+	    (ob->mode & OB_MODE_WEIGHT_PAINT) &&
+	    (paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != NULL) &&
+	    (sa = CTX_wm_area(C)) &&
+	    (sa->spacetype == SPACE_VIEW3D))
+	{
+		ARegion *ar = CTX_wm_region(C);
+		if (ar->regiontype == RGN_TYPE_WINDOW) {
 			return 1;
 		}
 	}
@@ -169,19 +169,19 @@
 
 static VPaint *new_vpaint(int wpaint)
 {
-	VPaint *vp= MEM_callocN(sizeof(VPaint), "VPaint");
+	VPaint *vp = MEM_callocN(sizeof(VPaint), "VPaint");
 	
-	vp->flag= VP_AREA+VP_SPRAY;
+	vp->flag = VP_AREA + VP_SPRAY;
 	
 	if (wpaint)
-		vp->flag= VP_AREA;
+		vp->flag = VP_AREA;
 
 	return vp;
 }
 
 static int *get_indexarray(Mesh *me)
 {
-	return MEM_mallocN(sizeof(int)*(me->totpoly+1), "vertexpaint");
+	return MEM_mallocN(sizeof(int) * (me->totpoly + 1), "vertexpaint");
 }
 
 unsigned int vpaint_get_current_col(VPaint *vp)
@@ -203,54 +203,54 @@
 	short *scolmain, *scol;
 	char *mcol;
 	
-	if (me->mcol==NULL || me->totvert==0 || me->totface==0) return;
+	if (me->mcol == NULL || me->totvert == 0 || me->totface == 0) return;
 	
-	scolmain= MEM_callocN(4*sizeof(short)*me->totvert, "colmain");
+	scolmain = MEM_callocN(4 * sizeof(short) * me->totvert, "colmain");
 	
-	tface= me->mtface;
-	mface= me->mface;
-	mcol= (char *)me->mcol;
-	for (a=me->totface; a>0; a--, mface++, mcol+=16) {
-		if ((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK)==0) {
-			scol= scolmain+4*mface->v1;
-			scol[0]++; scol[1]+= mcol[1]; scol[2]+= mcol[2]; scol[3]+= mcol[3];
-			scol= scolmain+4*mface->v2;
-			scol[0]++; scol[1]+= mcol[5]; scol[2]+= mcol[6]; scol[3]+= mcol[7];
-			scol= scolmain+4*mface->v3;
-			scol[0]++; scol[1]+= mcol[9]; scol[2]+= mcol[10]; scol[3]+= mcol[11];
+	tface = me->mtface;
+	mface = me->mface;
+	mcol = (char *)me->mcol;
+	for (a = me->totface; a > 0; a--, mface++, mcol += 16) {
+		if ((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK) == 0) {
+			scol = scolmain + 4 * mface->v1;
+			scol[0]++; scol[1] += mcol[1]; scol[2] += mcol[2]; scol[3] += mcol[3];
+			scol = scolmain + 4 * mface->v2;
+			scol[0]++; scol[1] += mcol[5]; scol[2] += mcol[6]; scol[3] += mcol[7];
+			scol = scolmain + 4 * mface->v3;
+			scol[0]++; scol[1] += mcol[9]; scol[2] += mcol[10]; scol[3] += mcol[11];
 			if (mface->v4) {
-				scol= scolmain+4*mface->v4;
-				scol[0]++; scol[1]+= mcol[13]; scol[2]+= mcol[14]; scol[3]+= mcol[15];
+				scol = scolmain + 4 * mface->v4;
+				scol[0]++; scol[1] += mcol[13]; scol[2] += mcol[14]; scol[3] += mcol[15];
 			}
 		}
 		if (tface) tface++;
 	}
 	
-	a= me->totvert;
-	scol= scolmain;
+	a = me->totvert;
+	scol = scolmain;
 	while (a--) {
-		if (scol[0]>1) {
-			scol[1]/= scol[0];
-			scol[2]/= scol[0];
-			scol[3]/= scol[0];
+		if (scol[0] > 1) {
+			scol[1] /= scol[0];
+			scol[2] /= scol[0];
+			scol[3] /= scol[0];
 		}
-		scol+= 4;
+		scol += 4;
 	}
 	
-	tface= me->mtface;
-	mface= me->mface;
-	mcol= (char *)me->mcol;
-	for (a=me->totface; a>0; a--, mface++, mcol+=16) {
-		if ((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK)==0) {
-			scol= scolmain+4*mface->v1;
-			mcol[1]= scol[1]; mcol[2]= scol[2]; mcol[3]= scol[3];
-			scol= scolmain+4*mface->v2;
-			mcol[5]= scol[1]; mcol[6]= scol[2]; mcol[7]= scol[3];
-			scol= scolmain+4*mface->v3;
-			mcol[9]= scol[1]; mcol[10]= scol[2]; mcol[11]= scol[3];
+	tface = me->mtface;
+	mface = me->mface;
+	mcol = (char *)me->mcol;
+	for (a = me->totface; a > 0; a--, mface++, mcol += 16) {
+		if ((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK) == 0) {
+			scol = scolmain + 4 * mface->v1;
+			mcol[1] = scol[1]; mcol[2] = scol[2]; mcol[3] = scol[3];
+			scol = scolmain + 4 * mface->v2;
+			mcol[5] = scol[1]; mcol[6] = scol[2]; mcol[7] = scol[3];
+			scol = scolmain + 4 * mface->v3;
+			mcol[9] = scol[1]; mcol[10] = scol[2]; mcol[11] = scol[3];
 			if (mface->v4) {
-				scol= scolmain+4*mface->v4;
-				mcol[13]= scol[1]; mcol[14]= scol[2]; mcol[15]= scol[3];
+				scol = scolmain + 4 * mface->v4;
+				mcol[13] = scol[1]; mcol[14] = scol[2]; mcol[15] = scol[3];
 			}
 		}
 		if (tface) tface++;
@@ -271,17 +271,17 @@
 	/* if no mloopcol: do not do */
 	/* if mtexpoly: only the involved faces, otherwise all */
 
-	if (me->mloopcol==0 || me->totvert==0 || me->totpoly==0) return;
+	if (me->mloopcol == 0 || me->totvert == 0 || me->totpoly == 0) return;
 
-	scol = MEM_callocN(sizeof(float)*me->totvert*5, "scol");
+	scol = MEM_callocN(sizeof(float) * me->totvert * 5, "scol");
 
-	for (i=0; i<me->totloop; i++, ml++, lcol++) {
+	for (i = 0; i < me->totloop; i++, ml++, lcol++) {
 		if (i >= mp->loopstart + mp->totloop) {
 			mp++;
 			if (mtp) mtp++;
 		}
 
-		if (!(mtp && (mtp->mode & TF_SHAREDCOL)) && (me->editflag & ME_EDIT_PAINT_MASK)!=0)
+		if (!(mtp && (mtp->mode & TF_SHAREDCOL)) && (me->editflag & ME_EDIT_PAINT_MASK) != 0)
 			continue;
 
 		scol[ml->v][0] += lcol->r;
@@ -293,7 +293,7 @@
 	}
 	
 	if (has_shared) {
-		for (i=0; i<me->totvert; i++) {
+		for (i = 0; i < me->totvert; i++) {
 			if (!scol[i][4]) continue;
 
 			scol[i][0] /= scol[i][4];
@@ -304,7 +304,7 @@
 	
 		ml = me->mloop;
 		lcol = me->mloopcol;
-		for (i=0; i<me->totloop; i++, ml++, lcol++) {
+		for (i = 0; i < me->totloop; i++, ml++, lcol++) {
 			if (!scol[ml->v][4]) continue;
 
 			lcol->r = scol[ml->v][0];
@@ -325,8 +325,8 @@
 {
 	Mesh *me;
 	if (!ob || ob->id.lib) return;
-	me= get_mesh(ob);
-	if (me==NULL) return;
+	me = get_mesh(ob);
+	if (me == NULL) return;
 	if (me->edit_btmesh) return;
 
 	/* copies from shadedisplist to mcol */
@@ -345,10 +345,10 @@
 		if (!me->mcol || !me->mface) {
 			/* should always be true */
 			if (me->mcol) {
-				memset(me->mcol, 255, 4*sizeof(MCol)*me->totface);
+				memset(me->mcol, 255, 4 * sizeof(MCol) * me->totface);
 			}
 
-			/* create tessfaces because they will be used for drawing & fast updates*/
+			/* create tessfaces because they will be used for drawing & fast updates */
 			BKE_mesh_tessface_calc(me); /* does own call to update pointers */
 		}
 	}
@@ -370,7 +370,7 @@
 /* mirror_vgroup is set to -1 when invalid */
 static int wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active)
 {
-	bDeformGroup *defgroup= BLI_findlink(&ob->defbase, vgroup_active);
+	bDeformGroup *defgroup = BLI_findlink(&ob->defbase, vgroup_active);
 
 	if (defgroup) {
 		bDeformGroup *curdef;
@@ -380,16 +380,16 @@
 		flip_side_name(name, defgroup->name, FALSE);
 
 		if (strcmp(name, defgroup->name) != 0) {
-			for (curdef= ob->defbase.first, mirrdef= 0; curdef; curdef=curdef->next, mirrdef++) {
+			for (curdef = ob->defbase.first, mirrdef = 0; curdef; curdef = curdef->next, mirrdef++) {
 				if (!strcmp(curdef->name, name)) {
 					break;
 				}
 			}
 
-			if (curdef==NULL) {
-				int olddef= ob->actdef;	/* tsk, ED_vgroup_add sets the active defgroup */
-				curdef= ED_vgroup_add_name(ob, name);
-				ob->actdef= olddef;
+			if (curdef == NULL) {
+				int olddef = ob->actdef;	/* tsk, ED_vgroup_add sets the active defgroup */
+				curdef = ED_vgroup_add_name(ob, name);
+				ob->actdef = olddef;
 			}
 
 			/* curdef should never be NULL unless this is
@@ -407,14 +407,14 @@
 {
 	if (vp->vpaint_prev) {
 		MEM_freeN(vp->vpaint_prev);
-		vp->vpaint_prev= NULL;
+		vp->vpaint_prev = NULL;
 	}
-	vp->tot= tot;	
+	vp->tot = tot;
 	
-	if (lcol==NULL || tot==0) return;
+	if (lcol == NULL || tot == 0) return;
 	
-	vp->vpaint_prev= MEM_mallocN(sizeof(int)*tot, "vpaint_prev");
-	memcpy(vp->vpaint_prev, lcol, sizeof(int)*tot);
+	vp->vpaint_prev = MEM_mallocN(sizeof(int) * tot, "vpaint_prev");
+	memcpy(vp->vpaint_prev, lcol, sizeof(int) * tot);
 	
 }
 
@@ -422,12 +422,12 @@
 {
 	if (wp->wpaint_prev) {
 		free_dverts(wp->wpaint_prev, wp->tot);
-		wp->wpaint_prev= NULL;
+		wp->wpaint_prev = NULL;
 	}
 	
 	if (dverts && dcount) {
 		
-		wp->wpaint_prev = MEM_mallocN (sizeof(MDeformVert)*dcount, "wpaint prev");
+		wp->wpaint_prev = MEM_mallocN (sizeof(MDeformVert) * dcount, "wpaint prev");
 		wp->tot = dcount;
 		copy_dverts (wp->wpaint_prev, dverts, dcount);
 	}
@@ -441,23 +441,23 @@
 	MLoopCol *lcol;
 	int i, j, selected;
 
-	me= get_mesh(ob);
-	if (me==NULL || me->totpoly==0) return;
+	me = get_mesh(ob);
+	if (me == NULL || me->totpoly == 0) return;
 
 	if (!me->mloopcol) make_vertexcol(ob);
 	if (!me->mloopcol) return; /* possible we can't make mcol's */
 
 
-	selected= (me->editflag & ME_EDIT_PAINT_MASK);
+	selected = (me->editflag & ME_EDIT_PAINT_MASK);
 
 	mp = me->mpoly;
-	for (i=0; i<me->totpoly; i++, mp++) {
+	for (i = 0; i < me->totpoly; i++, mp++) {
 		if (!(!selected || mp->flag & ME_FACE_SEL))
 			continue;
 
 		lcol = me->mloopcol + mp->loopstart;
-		for (j=0; j<mp->totloop; j++, lcol++) {
-			*(int*)lcol = paintcol;
+		for (j = 0; j < mp->totloop; j++, lcol++) {
+			*(int *)lcol = paintcol;
 		}
 	}
 	
@@ -471,74 +471,74 @@
 /* fills in the selected faces with the current weight and vertex group */
 void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
 {
-	Mesh *me= ob->data;
+	Mesh *me = ob->data;
 	MPoly *mf;
 	MDeformWeight *dw, *dw_prev;
-	int vgroup_active, vgroup_mirror= -1;
+	int vgroup_active, vgroup_mirror = -1;
 	unsigned int index;
 
 	/* mutually exclusive, could be made into a */
-	const short paint_selmode= ME_EDIT_PAINT_SEL_MODE(me);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list