[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42987] trunk/blender/source/blender/ editors/sculpt_paint/paint_vertex.c: improvement to how weight paint blur works

Campbell Barton ideasman42 at gmail.com
Fri Dec 30 05:38:56 CET 2011


Revision: 42987
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42987
Author:   campbellbarton
Date:     2011-12-30 04:38:45 +0000 (Fri, 30 Dec 2011)
Log Message:
-----------
improvement to how weight paint blur works
* the accumulated blur weight now takes into account how far verts are from the brush, giving more even results
* verts where the weight wasnt found were being ignored, now treat them as zero weight verts.

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	2011-12-30 03:50:04 UTC (rev 42986)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2011-12-30 04:38:45 UTC (rev 42987)
@@ -1985,7 +1985,7 @@
 	float mat[4][4];
 	float paintweight;
 	int *indexar;
-	int totw;
+	float totw;
 	unsigned int index, totindex;
 	float alpha;
 	float mval[2];
@@ -2084,7 +2084,7 @@
 			
 	/* make sure each vertex gets treated only once */
 	/* and calculate filter weight */
-	totw= 0;
+	totw= 0.0f;
 	if(brush->vertexpaint_tool==VP_BLUR) 
 		paintweight= 0.0f;
 	else
@@ -2118,11 +2118,11 @@
 
 				do {
 					unsigned int vidx= *(&mface->v1 + fidx);
-
-					dw = dw_func(&me->dvert[vidx], wpi.vgroup_active);
-					if(dw) {
-						paintweight += dw->weight;
-						totw++;
+					const float fac = calc_vp_strength(wp, vc, wpd->vertexcosnos+6*vidx, mval, brush_size_final);
+					if (fac > 0.0f) {
+						dw = dw_func(&me->dvert[vidx], wpi.vgroup_active);
+						paintweight += dw ? (dw->weight * fac) : 0.0f;
+						totw += fac;
 					}
 
 				} while (fidx--);
@@ -2131,9 +2131,10 @@
 		}
 	}
 			
-	if(brush->vertexpaint_tool==VP_BLUR) 
-		paintweight/= (float)totw;
-			
+	if (brush->vertexpaint_tool==VP_BLUR) {
+		paintweight /= totw;
+	}
+
 	for(index=0; index<totindex; index++) {
 				
 		if(indexar[index] && indexar[index]<=me->totface) {




More information about the Bf-blender-cvs mailing list