Fix #131210: Crash on selecting brush in non-updated file

Missed in 9945d511a9

The previous commit fixed files that had not yet been saved in 4.3,
however, the versioning code was not bumped which means that a user who
had a file in a version prior to 4.2 that then saved with the full
release of 4.3 would not have the corrected versioning applied for their
texture paint workspaces.

This commit re-applies similar versioning code and bumps the version
to ensure files are up to date.

Pull Request: https://projects.blender.org/blender/blender/pulls/131337
This commit is contained in:
Sean Kim
2024-12-07 00:18:14 +01:00
committed by Sean Kim
parent f92bfe0f0b
commit c36212bf11
2 changed files with 13 additions and 1 deletions

View File

@@ -31,7 +31,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 10
#define BLENDER_FILE_SUBVERSION 11
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and cancel loading the file, showing a warning to

View File

@@ -5206,6 +5206,18 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
FOREACH_MAIN_ID_END;
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 404, 11)) {
/* #update_paint_modes_for_brush_assets() didn't handle image editor tools for some time. 4.3
* files saved during that period could have invalid tool references stored. */
LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
LISTBASE_FOREACH (bToolRef *, tref, &workspace->tools) {
if (tref->space_type == SPACE_IMAGE && tref->mode == SI_MODE_PAINT) {
STRNCPY(tref->idname, "builtin.brush");
}
}
}
}
/* Always run this versioning; meshes are written with the legacy format which always needs to
* be converted to the new format on file load. Can be moved to a subversion check in a larger
* breaking release. */