Fix: BRUSH_INVERT_TO_SCRAPE_FILL flag applies for too many brushes

The `BRUSH_INVERT_TO_SCRAPE_FILL` check inside `brush_flip` applies to
any brush instead of just the Fill and Scrape brush, this means that if
an asset is in a weird state where the user has enabled this flag but
switched away from the brush type, the flag still applies even though
the option is no longer visible.

This commit checks the brush type to ensure it only applies to the
specified types.

Pull Request: https://projects.blender.org/blender/blender/pulls/134014
This commit is contained in:
Sean Kim
2025-02-04 07:10:00 +01:00
committed by Sean Kim
parent ebc918c717
commit 8911d7136c

View File

@@ -2088,7 +2088,11 @@ void calc_area_normal_and_center(const Depsgraph &depsgraph,
*/
static float brush_flip(const Brush &brush, const blender::ed::sculpt_paint::StrokeCache &cache)
{
if (brush.flag & BRUSH_INVERT_TO_SCRAPE_FILL) {
/* The Fill and Scrape brushes do not invert direction when this flag is set. The behavior of
* the brush completely changes. */
if (ELEM(brush.sculpt_brush_type, SCULPT_BRUSH_TYPE_FILL, SCULPT_BRUSH_TYPE_SCRAPE) &&
brush.flag & BRUSH_INVERT_TO_SCRAPE_FILL)
{
return 1.0f;
}