Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-30 08:38:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-30 08:38:45 +0400
commit230c6f58f744b029df8328bfb39f6878bb829862 (patch)
treeb187ec34cfcc29671a33bb5552bc477f4f865aa3 /source/blender/editors
parentbc7b67c1c67ab0980bea8c8797fbba36a63d0da8 (diff)
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 61cf8c74d3d..f4b12a97de0 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1985,7 +1985,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
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 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
/* 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 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
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 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
}
}
- 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) {