From 8911d7136c9af7f42ecf7a7d7532ceacd3e2ae94 Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Tue, 4 Feb 2025 07:10:00 +0100 Subject: [PATCH] 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 --- source/blender/editors/sculpt_paint/sculpt.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index 18ed860a799..bb3189f80ca 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -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; }