Avoid settings from being lost when opening project manager.
Probably fixes many issues of this kind, like missing shortcuts or other settings
This commit is contained in:
parent
ac157f8c05
commit
7e50a9a2e8
@ -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()) {
|
for (const Map<String,Ref<ShortCut> >::Element *E=shortcuts.front();E;E=E->next()) {
|
||||||
|
|
||||||
Ref<ShortCut> sc=E->get();
|
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 (optimize_save) {
|
||||||
if (sc->is_shortcut(original) || (original.type==InputEvent::NONE && sc->get_shortcut().type==InputEvent::NONE))
|
if (!sc->has_meta("original")) {
|
||||||
continue; //not changed from default, don't save
|
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(E->key());
|
||||||
arr.push_back(sc->get_shortcut());
|
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()) {
|
for(Set<_EVCSort>::Element *E=vclist.front();E;E=E->next()) {
|
||||||
|
|
||||||
int pinfo = 0;
|
int pinfo = 0;
|
||||||
if (E->get().save) {
|
if (E->get().save || !optimize_save) {
|
||||||
pinfo|=PROPERTY_USAGE_STORAGE;
|
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() {
|
void EditorSettings::_bind_methods() {
|
||||||
|
|
||||||
@ -998,6 +1007,7 @@ EditorSettings::EditorSettings() {
|
|||||||
|
|
||||||
//singleton=this;
|
//singleton=this;
|
||||||
last_order=0;
|
last_order=0;
|
||||||
|
optimize_save=true;
|
||||||
save_changed_setting=true;
|
save_changed_setting=true;
|
||||||
|
|
||||||
EditorTranslationList *etl=_editor_translations;
|
EditorTranslationList *etl=_editor_translations;
|
||||||
|
@ -88,6 +88,7 @@ private:
|
|||||||
|
|
||||||
bool save_changed_setting;
|
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_defaults(Ref<ConfigFile> p_extra_config = NULL);
|
||||||
void _load_default_text_editor_theme();
|
void _load_default_text_editor_theme();
|
||||||
@ -155,6 +156,8 @@ public:
|
|||||||
Ref<ShortCut> get_shortcut(const String&p_name) const;
|
Ref<ShortCut> get_shortcut(const String&p_name) const;
|
||||||
void get_shortcut_list(List<String> *r_shortcuts);
|
void get_shortcut_list(List<String> *r_shortcuts);
|
||||||
|
|
||||||
|
void set_optimize_save(bool p_optimize);
|
||||||
|
|
||||||
EditorSettings();
|
EditorSettings();
|
||||||
~EditorSettings();
|
~EditorSettings();
|
||||||
|
|
||||||
|
@ -830,6 +830,9 @@ ProjectManager::ProjectManager() {
|
|||||||
if (!EditorSettings::get_singleton())
|
if (!EditorSettings::get_singleton())
|
||||||
EditorSettings::create();
|
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");
|
int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode");
|
||||||
if (dpi_mode==0) {
|
if (dpi_mode==0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user