From 9c9081d9ef5bf97b39f316d68651f7e72266ac5d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 14 May 2019 12:23:55 +1000 Subject: Preferences: file menu item to temporarily load factory settings It's common to load factory settings as a test without wanting to overwrite your own settings on exit. --- release/scripts/startup/bl_ui/space_topbar.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'release') diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index cb949560936..6da08a15db1 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -172,6 +172,7 @@ class TOPBAR_MT_file(Menu): def draw(self, context): layout = self.layout + prefs = context.preferences layout.operator_context = 'INVOKE_AREA' layout.menu("TOPBAR_MT_file_new", text="New", icon='FILE_NEW') @@ -195,20 +196,26 @@ class TOPBAR_MT_file(Menu): layout.operator_context = 'INVOKE_AREA' if any(bpy.utils.app_template_paths()): - app_template = context.preferences.app_template + app_template = prefs.app_template else: app_template = None if app_template: layout.label(text=bpy.path.display_name(app_template, has_ext=False)) - layout.operator("wm.save_homefile") - layout.operator( + + layout.operator("wm.save_homefile") + props = layout.operator("wm.read_factory_settings") + if app_template: + props.app_template = app_template + + if prefs.use_preferences_save: + props = layout.operator( "wm.read_factory_settings", - text="Load Factory Settings", - ).app_template = app_template - else: - layout.operator("wm.save_homefile") - layout.operator("wm.read_factory_settings") + text="Load Factory Settings (Temporary)" + ) + if app_template: + props.app_template = app_template + props.use_temporary_preferences = True layout.separator() -- cgit v1.2.3