From 781d03efe4b889089c261de68bf25263454ddf29 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 5 Oct 2022 17:08:28 +1100 Subject: Preferences: support loading factory settings only for app-templates When app-templates are enabled, support resetting defaults only for the app-templates. Without this, it's not possible to reset app-template preferences without also resetting the default preferences for all settings the app-template does not override (used when there is no application template loaded, and other app-templates). These additional menu items are shown in menus when an app-template has been loaded. Address issue raised by T96427. Reviewed By: mont29, brecht Ref D16150 --- release/scripts/startup/bl_ui/space_topbar.py | 9 ++++++++- release/scripts/startup/bl_ui/space_userpref.py | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index b1ddd2c611d..3320e1e24a7 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -411,9 +411,16 @@ class TOPBAR_MT_file_defaults(Menu): app_template, has_ext=False)) layout.operator("wm.save_homefile") - props = layout.operator("wm.read_factory_settings") if app_template: + display_name = bpy.path.display_name(iface_(app_template)) + props = layout.operator("wm.read_factory_settings", text="Load Factory Blender Settings") props.app_template = app_template + props = layout.operator("wm.read_factory_settings", text="Load Factory %s Settings" % display_name) + props.app_template = app_template + props.use_factory_startup_app_template_only = True + del display_name + else: + layout.operator("wm.read_factory_settings") # Include technical operators here which would otherwise have no way for users to access. diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 441babefd60..a9736feb057 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -109,7 +109,16 @@ class USERPREF_MT_save_load(Menu): sub_revert.operator("wm.read_userpref", text="Revert to Saved Preferences") layout.operator_context = 'INVOKE_AREA' - layout.operator("wm.read_factory_userpref", text="Load Factory Preferences") + + app_template = prefs.app_template + if app_template: + display_name = bpy.path.display_name(iface_(app_template)) + layout.operator("wm.read_factory_userpref", text="Load Factory Blender Preferences") + props = layout.operator("wm.read_factory_userpref", text="Load Factory %s Preferences" % display_name) + props.use_factory_startup_app_template_only = True + del display_name + else: + layout.operator("wm.read_factory_userpref", text="Load Factory Preferences") class USERPREF_PT_save_preferences(Panel): -- cgit v1.2.3