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
This commit is contained in:
Ramil Roosileht
2022-06-22 10:00:47 -07:00
committed by Joseph Eagar
parent 1cde1562e8
commit b6a76243cd

View File

@@ -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) {