diff options
author | Ramil Roosileht <Limarest> | 2022-06-22 20:00:47 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-06-22 20:03:27 +0300 |
commit | b6a76243cd06d93dc8ef4a6437c6fef143bf7375 (patch) | |
tree | 5c6cadd55d4e11748a2a224a13685f5e90b7f1f7 /source/blender/editors | |
parent | 1cde1562e84c1780c33fac817c8690de5914908e (diff) |
D14974: Tip roundness - match square and round brush radius
Oneliner for T97961. Square sculpt brushes no longer fit
inside the radius circle, they now use the radius for
the square size.
{F13082514}
Note: original patch was modified to scale PBVH
search radius to avoid artifacts.
Differential Revision: https://developer.blender.org/D14974
Reviewed By: Joseph Eagar & Julien Kaspar
Ref: D14974
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 9ce80e4a433..4f7cb291364 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1181,6 +1181,12 @@ void SCULPT_floodfill_free(SculptFloodFill *flood) /** \} */ +static bool sculpt_tool_has_cube_tip(const char sculpt_tool) +{ + return ELEM( + sculpt_tool, SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_PAINT, SCULPT_TOOL_MULTIPLANE_SCRAPE); +} + /* -------------------------------------------------------------------- */ /** \name Tool Capabilities * @@ -1623,7 +1629,7 @@ bool SCULPT_brush_test_cube(SculptBrushTest *test, const float local[4][4], const float roundness) { - float side = M_SQRT1_2; + float side = 1.0f; float local_co[3]; if (sculpt_brush_test_clipping(test, co)) { @@ -3254,6 +3260,11 @@ static void do_brush_action(Sculpt *sd, ss->cache->original; float radius_scale = 1.0f; + /* Corners of square brushes can go outside the brush radius. */ + if (sculpt_tool_has_cube_tip(brush->sculpt_tool)) { + radius_scale = M_SQRT2; + } + /* With these options enabled not all required nodes are inside the original brush radius, so * the brush can produce artifacts in some situations. */ if (brush->sculpt_tool == SCULPT_TOOL_DRAW && brush->flag & BRUSH_ORIGINAL_NORMAL) { |