Fix #130548: Crash on selecting brush tool in older blender version file

This commit adds extra filtering when applying versioning code to older
files to support the Image Editor paint brushes with brush assets.

Previously, the versioning code updated all of the View3D space tools
that used a paint context to have a specific hardcoded tool name - this
unfortunately misses the default startup.blend Texture Paint brush.

Pull Request: https://projects.blender.org/blender/blender/pulls/130560
This commit is contained in:
Sean Kim
2024-11-20 20:34:02 +01:00
committed by Sean Kim
parent bc5fcbe1c3
commit 9945d511a9

View File

@@ -2848,6 +2848,12 @@ static void update_paint_modes_for_brush_assets(Main &bmain)
/* Replace persistent tool references with the new single builtin brush tool. */
LISTBASE_FOREACH (WorkSpace *, workspace, &bmain.workspaces) {
LISTBASE_FOREACH (bToolRef *, tref, &workspace->tools) {
if (STREQ(tref->idname, "builtin_brush.Draw")) {
/* Explicitly check against the old brush name, as the old texture paint image mode brush
* tool has a non-paint related mode. */
STRNCPY(tref->idname, "builtin.brush");
continue;
}
if (tref->space_type != SPACE_VIEW3D) {
continue;
}