[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29285] branches/soc-2010-nicolasbishop/ source/blender/editors/sculpt_paint/sculpt.c: * Sculpting now pays attention to the mask
Nicholas Bishop
nicholasbishop at gmail.com
Sun Jun 6 23:44:11 CEST 2010
Revision: 29285
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29285
Author: nicholasbishop
Date: 2010-06-06 23:44:11 +0200 (Sun, 06 Jun 2010)
Log Message:
-----------
* Sculpting now pays attention to the mask
Modified Paths:
--------------
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c
Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c 2010-06-06 21:13:03 UTC (rev 29284)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c 2010-06-06 21:44:11 UTC (rev 29285)
@@ -637,7 +637,7 @@
}
/* Return a multiplier for brush strength on a particular vertex. */
-static float tex_strength(SculptSession *ss, Brush *br, float *point, const float len)
+static float tex_strength(SculptSession *ss, Brush *br, float *point, float *mask, const float len)
{
MTex *tex = &br->mtex;
float avg= 1;
@@ -706,6 +706,8 @@
}
avg*= brush_curve_strength(br, len, ss->cache->radius); /* Falloff curve */
+ if(mask)
+ avg*= *mask;
return avg;
}
@@ -869,7 +871,7 @@
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
/* offset vertex */
- float fade = tex_strength(ss, brush, vd.co, test.dist);
+ float fade = tex_strength(ss, brush, vd.co, vd.mask, test.dist);
float val[3]= {vd.co[0] + offset[0]*fade,
vd.co[1] + offset[1]*fade,
vd.co[2] + offset[2]*fade};
@@ -939,7 +941,7 @@
BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
- float fade = tex_strength(ss, brush, vd.co, test.dist)*bstrength;
+ float fade = tex_strength(ss, brush, vd.co, vd.mask, test.dist)*bstrength;
float avg[3], val[3];
CLAMP(fade, 0.0f, 1.0f);
@@ -1010,7 +1012,7 @@
copy_v3_v3(co, data[x + y*gridsize].co);
if(sculpt_brush_test(&test, co)) {
- float fade = tex_strength(ss, brush, co, test.dist)*bstrength;
+ float fade = tex_strength(ss, brush, co, &data[x + y*gridsize].mask, test.dist)*bstrength;
float avg[3], val[3];
copy_v3_v3(avg, tmpgrid[x + y*gridsize]);
@@ -1073,7 +1075,7 @@
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
- float fade = tex_strength(ss, brush, vd.co, test.dist)*bstrength;
+ float fade = tex_strength(ss, brush, vd.co, vd.mask, test.dist)*bstrength;
float val[3]= {vd.co[0]+(test.location[0]-vd.co[0])*fade,
vd.co[1]+(test.location[1]-vd.co[1])*fade,
vd.co[2]+(test.location[2]-vd.co[2])*fade};
@@ -1108,7 +1110,7 @@
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, origco[vd.i])) {
- float fade = tex_strength(ss, brush, origco[vd.i], test.dist)*bstrength;
+ float fade = tex_strength(ss, brush, origco[vd.i], vd.mask, test.dist)*bstrength;
float add[3]= {vd.co[0]+fade*grab_delta[0],
vd.co[1]+fade*grab_delta[1],
vd.co[2]+fade*grab_delta[2]};
@@ -1157,7 +1159,7 @@
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
- float fade = tex_strength(ss, brush, vd.co, test.dist)*bstrength;
+ float fade = tex_strength(ss, brush, vd.co, vd.mask, test.dist)*bstrength;
float *disp= &layer_disp[vd.i];
float val[3];
@@ -1207,7 +1209,7 @@
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
- float fade = tex_strength(ss, brush, vd.co, test.dist)*bstrength;
+ float fade = tex_strength(ss, brush, vd.co, vd.mask, test.dist)*bstrength;
float add[3];
if(vd.fno) copy_v3_v3(add, vd.fno);
@@ -1334,7 +1336,7 @@
float intr[3], val[3];
if(!clay || plane_point_side(vd.co, area_normal, cntr2, flip)) {
- const float fade = tex_strength(ss, brush, vd.co, test.dist)*bstrength;
+ const float fade = tex_strength(ss, brush, vd.co, vd.mask, test.dist)*bstrength;
/* Find the intersection between squash-plane and vertex (along the area normal) */
point_plane_project(intr, vd.co, area_normal, cntr);
More information about the Bf-blender-cvs
mailing list