Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-04-15 16:51:08 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-04-15 16:54:42 +0300
commit7d1c7a6485f7c37b3ad49953df1164a022cb2fe5 (patch)
tree3a2bd11b188126c5acb49840000b689b70e496e7 /release
parent5fb4ff77118d03e55f756b5cab1331bc315ec8e7 (diff)
Fix splash screen not showing button to load config from 2.83 into 2.90
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_operators/userpref.py36
-rw-r--r--release/scripts/startup/bl_operators/wm.py4
2 files changed, 26 insertions, 14 deletions
diff --git a/release/scripts/startup/bl_operators/userpref.py b/release/scripts/startup/bl_operators/userpref.py
index f78ee026927..a4c19d5a8da 100644
--- a/release/scripts/startup/bl_operators/userpref.py
+++ b/release/scripts/startup/bl_operators/userpref.py
@@ -110,20 +110,30 @@ class PREFERENCES_OT_copy_prev(Operator):
bl_idname = "preferences.copy_prev"
bl_label = "Copy Previous Settings"
- @staticmethod
- def previous_version():
- ver = bpy.app.version
- ver_old = ((ver[0] * 100) + ver[1]) - 1
- return ver_old // 100, ver_old % 100
+ @classmethod
+ def _old_version_path(cls, version):
+ return bpy.utils.resource_path('USER', version[0], version[1])
- @staticmethod
- def _old_path():
- ver = bpy.app.version
- ver_old = ((ver[0] * 100) + ver[1]) - 1
- return bpy.utils.resource_path('USER', ver_old // 100, ver_old % 100)
+ @classmethod
+ def previous_version(cls):
+ # Find config folder from previous version.
+ import os
+ version = bpy.app.version
+ version_old = ((version[0] * 100) + version[1]) - 1
+ while version_old % 10 > 0:
+ version_split = version_old // 100, version_old % 100
+ if os.path.isdir(cls._old_version_path(version_split)):
+ return version_split
+ version_old = version_old - 1
+ return None
- @staticmethod
- def _new_path():
+ @classmethod
+ def _old_path(cls):
+ version_old = cls.previous_version()
+ return cls._old_version_path(version_old) if version_old else None
+
+ @classmethod
+ def _new_path(cls):
return bpy.utils.resource_path('USER')
@classmethod
@@ -132,6 +142,8 @@ class PREFERENCES_OT_copy_prev(Operator):
old = cls._old_path()
new = cls._new_path()
+ if not old:
+ return False
# Disable operator in case config path is overridden with environment
# variable. That case has no automatic per-version configuration.
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index f0f3ba14d92..99785fe0c4b 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -2483,8 +2483,8 @@ class WM_MT_splash(Menu):
row = layout.row()
sub = row.row()
- if bpy.types.PREFERENCES_OT_copy_prev.poll(context):
- old_version = bpy.types.PREFERENCES_OT_copy_prev.previous_version()
+ old_version = bpy.types.PREFERENCES_OT_copy_prev.previous_version()
+ if bpy.types.PREFERENCES_OT_copy_prev.poll(context) and old_version:
sub.operator("preferences.copy_prev", text="Load %d.%d Settings" % old_version)
sub.operator("wm.save_userpref", text="Save New Settings")
else: