change behavior of restoring old settings
- only attempt to restore old 'user' settings (not local), since bundled blender's always use their own settings. - only automatically run 'bpy.ops.wm.read_homefile()' after copying files if the user hasnt alreadt started making changes in the blend file.
This commit is contained in:
@@ -918,23 +918,24 @@ class WM_OT_copy_prev_settings(bpy.types.Operator):
|
||||
import os
|
||||
import shutil
|
||||
ver = bpy.app.version
|
||||
ver_prev = ((ver[0] * 100) + ver[1]) - 1
|
||||
ver_prev = ver_prev // 100, ver_prev % 100
|
||||
for res in ('USER', 'LOCAL'):
|
||||
path_src = bpy.utils.resource_path(res, ver_prev[0], ver_prev[1])
|
||||
path_dst = bpy.utils.resource_path(res)
|
||||
ver_old = ((ver[0] * 100) + ver[1]) - 1
|
||||
path_src = bpy.utils.resource_path('USER', ver_old // 100, ver_old % 100)
|
||||
path_dst = bpy.utils.resource_path('USER')
|
||||
|
||||
if os.path.isdir(path_dst):
|
||||
self.report({'ERROR'}, "Path %r exists" % path_dst)
|
||||
return {'CANCELLED'}
|
||||
else:
|
||||
break
|
||||
|
||||
if os.path.isdir(path_src):
|
||||
if os.path.isdir(path_dst):
|
||||
self.report({'ERROR'}, "Target path %r exists" % path_dst)
|
||||
elif not os.path.isdir(path_src):
|
||||
self.report({'ERROR'}, "Source path %r exists" % path_src)
|
||||
else:
|
||||
shutil.copytree(path_src, path_dst)
|
||||
bpy.ops.wm.read_homefile()
|
||||
# dont loose users work if they open the splash later.
|
||||
if bpy.data.is_saved is bpy.data.is_dirty is False:
|
||||
bpy.ops.wm.read_homefile()
|
||||
else:
|
||||
self.report({'INFO'}, "Reload Start-Up file to restore settings.")
|
||||
return {'FINISHED'}
|
||||
|
||||
return {'FINISHED'}
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
def _webbrowser_bug_fix():
|
||||
|
Reference in New Issue
Block a user