UI: Apply recent theme fixes for Preferences saved in 3.1 builds

Followup to e65230f0c0.

Pablo and I decided it's fine to reset themes again when saved with the
recent 3.1 builds.

This needed to be done a bit careful, since a normal version patch
resetting the theme would've reset the theme for anybody opening
preferences of a 3.0 build (even the final release build) in a 3.1
build. So make sure the theme is at least from a 3.1 build (but not
newer then this commit of course).
This commit is contained in:
Julian Eisel 2021-11-05 18:46:00 +01:00
parent cc49c479a7
commit 8d2a0d9b4c
2 changed files with 8 additions and 3 deletions

View File

@ -39,7 +39,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 0
#define BLENDER_FILE_SUBVERSION 1
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file

View File

@ -321,11 +321,16 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
btheme->space_node.grid_levels = 7;
}
if (!USER_VERSION_ATLEAST(300, 40)) {
if (!USER_VERSION_ATLEAST(300, 41)) {
memcpy(btheme, &U_theme_default, sizeof(*btheme));
}
if (!USER_VERSION_ATLEAST(300, 41)) {
/* Again reset the theme, but only if stored with an early 3.1 alpha version. Some changes were
* done in the release branch and then merged into the 3.1 branch (master). So the previous reset
* wouldn't work for people who saved their preferences with a 3.1 build meanwhile. But we still
* don't want to reset theme changes stored in the eventual 3.0 release once opened in a 3.1
* build. */
if (userdef->versionfile > 300 && !USER_VERSION_ATLEAST(301, 1)) {
memcpy(btheme, &U_theme_default, sizeof(*btheme));
}