UI: remove button to enable auto-save after load factory preferences
Based on feedback from T66675, the current interface is confusing, leading to users accidentally overwriting their preferences. Now, once factory settings are loaded preferences are not saved and the save button is shown (as when auto-save is disabled). Tool tips note that factory settings require manual saving afterwards. Also rename preference menu items for better consistency (settings/state -> preferences).
This commit is contained in:
@@ -40,22 +40,9 @@ class USERPREF_HT_header(Header):
|
||||
|
||||
row = layout.row()
|
||||
row.menu("USERPREF_MT_save_load", text="", icon='COLLAPSEMENU')
|
||||
# Use '_is_startup' so once factory settings are loaded
|
||||
# this display option will show, since it's confusing if disabling
|
||||
# the option makes it dissapiers.
|
||||
if prefs.use_preferences_save:
|
||||
use_userpref_skip_save_on_exit = bpy.app.use_userpref_skip_save_on_exit
|
||||
if use_userpref_skip_save_on_exit or getattr(USERPREF_HT_header, "_is_startup", False):
|
||||
USERPREF_HT_header._is_startup = True
|
||||
|
||||
sub = row.row(align=True)
|
||||
sub.alignment = 'LEFT'
|
||||
props = sub.operator(
|
||||
"preferences.autosave_override_toggle",
|
||||
text="Skip Auto-Save",
|
||||
emboss=False,
|
||||
icon='CHECKBOX_HLT' if use_userpref_skip_save_on_exit else 'CHECKBOX_DEHLT',
|
||||
)
|
||||
if prefs.use_preferences_save and (not bpy.app.use_userpref_skip_save_on_exit):
|
||||
pass
|
||||
else:
|
||||
sub = row.row(align=True)
|
||||
sub.active = prefs.is_dirty
|
||||
@@ -103,13 +90,13 @@ class USERPREF_MT_save_load(Menu):
|
||||
|
||||
layout.operator_context = 'EXEC_AREA'
|
||||
if prefs.use_preferences_save:
|
||||
layout.operator("wm.save_userpref", text="Save Current State")
|
||||
layout.operator("wm.save_userpref", text="Save Preferences")
|
||||
sub_revert = layout.column(align=True)
|
||||
sub_revert.active = prefs.is_dirty
|
||||
sub_revert.operator("wm.read_userpref", text="Revert to Saved")
|
||||
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 Settings")
|
||||
layout.operator("wm.read_factory_userpref", text="Load Factory Preferences")
|
||||
|
||||
|
||||
class USERPREF_PT_save_preferences(Panel):
|
||||
|
||||
@@ -72,39 +72,7 @@ static void PREFERENCES_OT_reset_default_theme(wmOperatorType *ot)
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Toggle Auto-Save Override
|
||||
*
|
||||
* This operator only exists so there is a useful tool-tip for for adjusting the global flag.
|
||||
* \{ */
|
||||
|
||||
static int preferences_autosave_override_toggle_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
|
||||
{
|
||||
G.f ^= G_FLAG_USERPREF_NO_SAVE_ON_EXIT;
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void PREFERENCES_OT_autosave_override_toggle(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Toggle Override Auto-Save";
|
||||
ot->idname = "PREFERENCES_OT_autosave_override_toggle";
|
||||
ot->description =
|
||||
"The current session has \"Factory Preferences\" loaded "
|
||||
"which disables automatically saving.\n"
|
||||
"Disable this to auto-save the preferences";
|
||||
|
||||
/* callbacks */
|
||||
ot->exec = preferences_autosave_override_toggle_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
void ED_operatortypes_userpref(void)
|
||||
{
|
||||
WM_operatortype_append(PREFERENCES_OT_reset_default_theme);
|
||||
WM_operatortype_append(PREFERENCES_OT_autosave_override_toggle);
|
||||
}
|
||||
|
||||
@@ -1871,7 +1871,9 @@ void WM_OT_read_factory_userpref(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Load Factory Preferences";
|
||||
ot->idname = "WM_OT_read_factory_userpref";
|
||||
ot->description = "Load default preferences";
|
||||
ot->description =
|
||||
"Load factory default preferences. "
|
||||
"To make changes to preferences permanent, use \"Save Preferences\"";
|
||||
|
||||
ot->invoke = WM_operator_confirm;
|
||||
ot->exec = wm_userpref_read_exec;
|
||||
@@ -2044,7 +2046,9 @@ void WM_OT_read_factory_settings(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Load Factory Settings";
|
||||
ot->idname = "WM_OT_read_factory_settings";
|
||||
ot->description = "Load default file and preferences";
|
||||
ot->description =
|
||||
"Load factory default startup file and preferences. "
|
||||
"To make changes permanent, use \"Save Startup File\" and \"Save Preferences\"";
|
||||
|
||||
ot->invoke = WM_operator_confirm;
|
||||
ot->exec = wm_homefile_read_exec;
|
||||
|
||||
Reference in New Issue
Block a user