diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-06-21 00:29:25 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-06-21 00:29:25 +0400 |
commit | 001dab25d448e5aea93f7ee7026eb52f3230b927 (patch) | |
tree | 37302e212f5149c5ce082e1491ebdfe54029e197 /source/blender/editors/sculpt_paint/sculpt.c | |
parent | a42b436a98263749955c1cc85963c3fa0945f2c1 (diff) |
2.5/Sculpt:
Added a clay brush. It behaves like a combination of the flatten and draw brushes.
Credit to Fredrik Hannson for the original patch (#18666)
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 7703dc0c303..fa33e214737 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -248,8 +248,9 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache) switch(sd->brush->sculpt_tool){ case SCULPT_TOOL_DRAW: case SCULPT_TOOL_INFLATE: - return alpha * dir * pressure * flip; /*XXX: not sure why? was multiplied by G.vd->grid */; + case SCULPT_TOOL_CLAY: case SCULPT_TOOL_FLATTEN: + return alpha * dir * pressure * flip; /*XXX: not sure why? was multiplied by G.vd->grid */; case SCULPT_TOOL_SMOOTH: return alpha * 4 * pressure; case SCULPT_TOOL_PINCH: @@ -552,7 +553,7 @@ static void calc_flatten_center(SculptSession *ss, ActiveData *node, float co[3] VecMulf(co, 1.0f / FLATTEN_SAMPLE_SIZE); } -static void do_flatten_brush(Sculpt *sd, SculptSession *ss, const ListBase *active_verts) +static void do_flatten_clay_brush(Sculpt *sd, SculptSession *ss, const ListBase *active_verts, int clay) { ActiveData *node= active_verts->first; /* area_normal and cntr define the plane towards which vertices are squashed */ @@ -575,16 +576,23 @@ static void do_flatten_brush(Sculpt *sd, SculptSession *ss, const ListBase *acti VecAddf(intr, intr, p1); VecSubf(val, intr, co); - VecMulf(val, node->Fade); + VecMulf(val, fabs(node->Fade)); VecAddf(val, val, co); + if(clay) { + /* Clay brush displaces after flattening */ + float tmp[3]; + VecCopyf(tmp, area_normal); + VecMulf(tmp, ss->cache->radius * node->Fade * 0.1); + VecAddf(val, val, tmp); + } + sculpt_clip(ss->cache, co, val); node= node->next; } } - - + /* Uses symm to selectively flip any axis of a coordinate. */ static void flip_coord(float out[3], float in[3], const char symm) { @@ -852,8 +860,10 @@ static void do_brush_action(Sculpt *sd, StrokeCache *cache) do_layer_brush(sd, ss, &active_verts); break; case SCULPT_TOOL_FLATTEN: - do_flatten_brush(sd, ss, &active_verts); + do_flatten_clay_brush(sd, ss, &active_verts, 0); break; + case SCULPT_TOOL_CLAY: + do_flatten_clay_brush(sd, ss, &active_verts, 1); } /* Copy the modified vertices from mesh to the active key */ |