Fix #142151: Scrape brush 'Plane Offset' not versioned correctly

The general Plane brush is a replacement for the Flatten, Fill, and
Scrape brushes that formerly existed. When the old brush types were
converted to the new type, the 'Plane Offset' usecase was missed due to
the field not being used for the bundled essential brushes.

To preserve brush behavior across 4.4 and 4.5, Scrape brushes with a
given 'Plane Offset' need to have this signed distance inverted.

Unfortunately, as this was discovered after 4.5 was officially released,
and the versioning having no clear indicators that can be used to fix
this with a subsequent version bump, this commit cannot address users
who have already started using 4.5. The best we can do in this case is
fix the incorrect versioning and make a note of the issue in the release
notes so that future users will not continue to experience this issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/143020
This commit is contained in:
Sean Kim
2025-07-24 21:59:38 +02:00
committed by Sean Kim
parent 121e9464f5
commit 7bab7155ad

View File

@@ -4942,6 +4942,20 @@ static void version_convert_sculpt_planar_brushes(Main *bmain)
brush->plane_inversion_mode = brush->flag & BRUSH_INVERT_TO_SCRAPE_FILL ?
BRUSH_PLANE_SWAP_HEIGHT_AND_DEPTH :
BRUSH_PLANE_INVERT_DISPLACEMENT;
/* Note, this fix was committed after some users had already run the versioning after
* 4.5 was released. Since 4.5 is an LTS and will be used for the foreseeable future to
* transition between 4.x and 5.x the fix has been added here, even though that does
* not fix the issue for some users with custom brush assets who have started using 4.5
* already.
*
* Since the `sculpt_brush_type` field changed from 'SCULPT_BRUSH_TYPE_SCRAPE' to
* 'SCULPT_BRUSH_TYPE_PLANE', we do not have a value that can be used to definitively apply
* a corrective versioning step along with a subversion bump without potentially affecting
* some false positives.
*
* See #142151 for more details. */
brush->plane_offset *= -1.0f;
}
if (brush->flag & BRUSH_PLANE_TRIM) {