diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-06-11 21:16:14 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-06-11 21:16:14 -0300 |
commit | 3c21827d13793684fe2d87ea208194dadea11cb1 (patch) | |
tree | c627c80b07f9a28779fc9abd25c3c73736f20eb2 /tools/editor | |
parent | e8209b9c5cd40649e0ab87515d20b4aab6c9feb0 (diff) |
make sure editor forgets removed settings, closes #5010
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/editor_settings.cpp | 22 | ||||
-rw-r--r-- | tools/editor/editor_settings.h | 6 |
2 files changed, 25 insertions, 3 deletions
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index bf01e02330..26c8826d87 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -86,6 +86,10 @@ bool EditorSettings::_set(const StringName& p_name, const Variant& p_value) { props[p_name].variant=p_value; else props[p_name]=VariantContainer(p_value,last_order++); + + if (save_changed_setting) { + props[p_name].save=true; + } } emit_signal("settings_changed"); @@ -126,6 +130,7 @@ struct _EVCSort { String name; Variant::Type type; int order; + bool save; bool operator<(const _EVCSort& p_vcs) const{ return order< p_vcs.order; } }; @@ -148,15 +153,24 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const { vc.name=*k; vc.order=v->order; vc.type=v->variant.get_type(); + vc.save=v->save; + vclist.insert(vc); } for(Set<_EVCSort>::Element *E=vclist.front();E;E=E->next()) { - int pinfo = PROPERTY_USAGE_STORAGE; - if (!E->get().name.begins_with("_")) + int pinfo = 0; + if (E->get().save) { + pinfo|=PROPERTY_USAGE_STORAGE; + } + + if (!E->get().name.begins_with("_")) { pinfo|=PROPERTY_USAGE_EDITOR; + } else { + pinfo|=PROPERTY_USAGE_STORAGE; //hiddens must always be saved + } PropertyInfo pi(E->get().type, E->get().name); pi.usage=pinfo; @@ -330,6 +344,7 @@ void EditorSettings::create() { goto fail; } + singleton->save_changed_setting=true; singleton->config_file_path=config_file_path; singleton->project_config_path=pcp; singleton->settings_path=config_path+"/"+config_dir; @@ -363,6 +378,7 @@ void EditorSettings::create() { }; singleton = Ref<EditorSettings>( memnew( EditorSettings ) ); + singleton->save_changed_setting=true; singleton->config_file_path=config_file_path; singleton->settings_path=config_path+"/"+config_dir; singleton->_load_defaults(extra_config); @@ -975,6 +991,7 @@ EditorSettings::EditorSettings() { //singleton=this; last_order=0; + save_changed_setting=true; EditorTranslationList *etl=_editor_translations; @@ -999,6 +1016,7 @@ EditorSettings::EditorSettings() { } _load_defaults(); + save_changed_setting=false; } diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h index 60333b5811..d975a7ef86 100644 --- a/tools/editor/editor_settings.h +++ b/tools/editor/editor_settings.h @@ -64,7 +64,8 @@ private: int order; Variant variant; bool hide_from_editor; - VariantContainer(){ order=0; hide_from_editor=false; } + bool save; + VariantContainer(){ order=0; hide_from_editor=false; save=false;} VariantContainer(const Variant& p_variant, int p_order) { variant=p_variant; order=p_order; hide_from_editor=false; } }; @@ -85,6 +86,9 @@ private: Ref<Resource> clipboard; + bool save_changed_setting; + + void _load_defaults(Ref<ConfigFile> p_extra_config = NULL); void _load_default_text_editor_theme(); |