Fix splash screen not showing button to load config from 2.83 into 2.90
This commit is contained in:
parent
5fb4ff7711
commit
7d1c7a6485
|
@ -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.
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue