diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-07-03 19:13:45 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-07-03 19:14:58 -0300 |
commit | 7e50a9a2e87582e922b06d6c0b6a03d22e7cef68 (patch) | |
tree | 9723201bf87a74ed25b052a51435096ba309c928 /tools | |
parent | ac157f8c05bf0967b65ba289b6118de807612cdf (diff) |
Avoid settings from being lost when opening project manager.
Probably fixes many issues of this kind, like missing shortcuts or other settings
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/editor_settings.cpp | 22 | ||||
-rw-r--r-- | tools/editor/editor_settings.h | 3 | ||||
-rw-r--r-- | tools/editor/project_manager.cpp | 3 |
3 files changed, 22 insertions, 6 deletions
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index b89863289a..ad615ff74a 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -104,12 +104,17 @@ bool EditorSettings::_get(const StringName& p_name,Variant &r_ret) const { for (const Map<String,Ref<ShortCut> >::Element *E=shortcuts.front();E;E=E->next()) { Ref<ShortCut> sc=E->get(); - if (!sc->has_meta("original")) - continue; //this came from settings but is not any longer used - InputEvent original = sc->get_meta("original"); - if (sc->is_shortcut(original) || (original.type==InputEvent::NONE && sc->get_shortcut().type==InputEvent::NONE)) - continue; //not changed from default, don't save + if (optimize_save) { + if (!sc->has_meta("original")) { + continue; //this came from settings but is not any longer used + } + + InputEvent original = sc->get_meta("original"); + if (sc->is_shortcut(original) || (original.type==InputEvent::NONE && sc->get_shortcut().type==InputEvent::NONE)) + continue; //not changed from default, don't save + } + arr.push_back(E->key()); arr.push_back(sc->get_shortcut()); } @@ -161,7 +166,7 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const { for(Set<_EVCSort>::Element *E=vclist.front();E;E=E->next()) { int pinfo = 0; - if (E->get().save) { + if (E->get().save || !optimize_save) { pinfo|=PROPERTY_USAGE_STORAGE; } @@ -976,6 +981,10 @@ void EditorSettings::get_shortcut_list(List<String> *r_shortcuts) { } } +void EditorSettings::set_optimize_save(bool p_optimize) { + + optimize_save=true; +} void EditorSettings::_bind_methods() { @@ -998,6 +1007,7 @@ EditorSettings::EditorSettings() { //singleton=this; last_order=0; + optimize_save=true; save_changed_setting=true; EditorTranslationList *etl=_editor_translations; diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h index d975a7ef86..937956a366 100644 --- a/tools/editor/editor_settings.h +++ b/tools/editor/editor_settings.h @@ -88,6 +88,7 @@ private: bool save_changed_setting; + bool optimize_save; //do not save stuff that came from config but was not set from engine void _load_defaults(Ref<ConfigFile> p_extra_config = NULL); void _load_default_text_editor_theme(); @@ -155,6 +156,8 @@ public: Ref<ShortCut> get_shortcut(const String&p_name) const; void get_shortcut_list(List<String> *r_shortcuts); + void set_optimize_save(bool p_optimize); + EditorSettings(); ~EditorSettings(); diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index dafec397c5..860af4888b 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -830,6 +830,9 @@ ProjectManager::ProjectManager() { if (!EditorSettings::get_singleton()) EditorSettings::create(); + + EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came + { int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode"); if (dpi_mode==0) { |