From b6a76243cd06d93dc8ef4a6437c6fef143bf7375 Mon Sep 17 00:00:00 2001 From: Ramil Roosileht Date: Wed, 22 Jun 2022 10:00:47 -0700 Subject: [PATCH] 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 --- source/blender/editors/sculpt_paint/sculpt.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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) {