[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41364] branches/bmesh/blender/source/ blender/editors/sculpt_paint/paint_vertex.c: Fix for #29080: vertex paint mask doesn't work

Andrew Wiggin ender79bl at gmail.com
Sat Oct 29 15:25:19 CEST 2011


Revision: 41364
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41364
Author:   ender79
Date:     2011-10-29 13:25:18 +0000 (Sat, 29 Oct 2011)
Log Message:
-----------
Fix for #29080: vertex paint mask doesn't work

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

Modified: branches/bmesh/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2011-10-29 11:34:26 UTC (rev 41363)
+++ branches/bmesh/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2011-10-29 13:25:18 UTC (rev 41364)
@@ -271,7 +271,7 @@
 	MTexPoly *mtp = me->mtpoly;
 	MPoly *mp = me->mpoly;
 	float (*scol)[5];
-	int i;
+	int i, has_shared = 0;
 
 	/* if no mloopcol: do not do */
 	/* if mtexpoly: only the involved faces, otherwise all */
@@ -286,7 +286,7 @@
 			if (mtp) mtp++;
 		}
 
-		if (mtp && !(mtp->mode & TF_SHAREDCOL))
+		if (!(mtp && (mtp->mode & TF_SHAREDCOL)) && (me->editflag & ME_EDIT_PAINT_MASK)!=0)
 			continue;
 
 		scol[ml->v][0] += lcol->r;
@@ -294,31 +294,36 @@
 		scol[ml->v][2] += lcol->b;
 		scol[ml->v][3] += lcol->a;
 		scol[ml->v][4] += 1.0;
+		has_shared = 1;
 	}
 	
-	for (i=0; i<me->totvert; i++) {
-		if (!scol[i][4]) continue;
+	if (has_shared) {
+		for (i=0; i<me->totvert; i++) {
+			if (!scol[i][4]) continue;
 
-		scol[i][0] /= scol[i][4];
-		scol[i][1] /= scol[i][4];
-		scol[i][2] /= scol[i][4];
-		scol[i][3] /= scol[i][4];
-	}
+			scol[i][0] /= scol[i][4];
+			scol[i][1] /= scol[i][4];
+			scol[i][2] /= scol[i][4];
+			scol[i][3] /= scol[i][4];
+		}
 	
-	ml = me->mloop;
-	lcol = me->mloopcol;
-	for (i=0; i<me->totloop; i++, ml++, lcol++) {
-		if (!scol[ml->v][4]) continue;
+		ml = me->mloop;
+		lcol = me->mloopcol;
+		for (i=0; i<me->totloop; i++, ml++, lcol++) {
+			if (!scol[ml->v][4]) continue;
 
-		lcol->r = scol[ml->v][0];
-		lcol->g = scol[ml->v][1];
-		lcol->b = scol[ml->v][2];
-		lcol->a = scol[ml->v][3];
+			lcol->r = scol[ml->v][0];
+			lcol->g = scol[ml->v][1];
+			lcol->b = scol[ml->v][2];
+			lcol->a = scol[ml->v][3];
+		}
 	}
 
 	MEM_freeN(scol);
 
-	do_shared_vertex_tesscol(me);
+	if (has_shared) {
+		do_shared_vertex_tesscol(me);
+	}
 }
 
 static void make_vertexcol(Object *ob)	/* single ob */
@@ -2679,7 +2684,10 @@
 		
 	swap_m4m4(vc->rv3d->persmat, mat);
 			
-	do_shared_vertexcol(me);
+	/* was disabled because it is slow, but necessary for blur */
+	if(brush->vertexpaint_tool == VP_BLUR) {
+		do_shared_vertexcol(me);
+	}
 
 	ED_region_tag_redraw(vc->ar);		
 	DAG_id_tag_update(ob->data, 0);




More information about the Bf-blender-cvs mailing list