Fix unintended autosaving of preferences in a few cases
* Dirty flag was not cleared on load * Navigating tabs should not cause save * Background mode should not autosave (for e.g. render farms and tests)
This commit is contained in:
@@ -9609,6 +9609,9 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
|
||||
/* Don't read the active app template, use the default one. */
|
||||
user->app_template[0] = '\0';
|
||||
|
||||
/* Clear runtime data. */
|
||||
user->runtime.is_dirty = false;
|
||||
|
||||
/* free fd->datamap again */
|
||||
oldnewmap_free_unused(fd->datamap);
|
||||
oldnewmap_clear(fd->datamap);
|
||||
|
||||
@@ -7575,8 +7575,9 @@ static void button_activate_exit(
|
||||
}
|
||||
|
||||
/* Not very elegant, but ensures preference changes force re-save. */
|
||||
if (but->rnaprop && (but->rnapoin.data == &U)) {
|
||||
if (but->rnaprop && (but->rnapoin.data == &U) && !RNA_property_update_check(but->rnaprop)) {
|
||||
U.runtime.is_dirty = true;
|
||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -184,6 +184,13 @@ static void rna_userdef_version_get(PointerRNA *ptr, int *value)
|
||||
value[2] = userdef->subversionfile;
|
||||
}
|
||||
|
||||
static void rna_userdef_ui_update(Main *UNUSED(bmain),
|
||||
Scene *UNUSED(scene),
|
||||
PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||
}
|
||||
|
||||
static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
/* We can't use 'ptr->data' because this update function
|
||||
@@ -5591,7 +5598,7 @@ void RNA_def_userdef(BlenderRNA *brna)
|
||||
RNA_def_property_enum_items(prop, preference_section_items);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Active Section", "Active section of the preferences shown in the user interface");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_ui_update");
|
||||
|
||||
/* don't expose this directly via the UI, modify via an operator */
|
||||
prop = RNA_def_property(srna, "app_template", PROP_STRING, PROP_NONE);
|
||||
|
||||
@@ -475,7 +475,7 @@ void WM_exit_ext(bContext *C, const bool do_python)
|
||||
ED_screen_exit(C, win, WM_window_get_active_screen(win));
|
||||
}
|
||||
|
||||
if (U.runtime.is_dirty) {
|
||||
if (U.runtime.is_dirty && !G.background) {
|
||||
if (U.pref_flag & USER_PREF_FLAG_SAVE) {
|
||||
BKE_blendfile_userdef_write_all(NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user