summaryrefslogtreecommitdiff
path: root/tools/editor/editor_settings.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-11 21:16:14 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-11 21:16:14 -0300
commit3c21827d13793684fe2d87ea208194dadea11cb1 (patch)
treec627c80b07f9a28779fc9abd25c3c73736f20eb2 /tools/editor/editor_settings.cpp
parente8209b9c5cd40649e0ab87515d20b4aab6c9feb0 (diff)
make sure editor forgets removed settings, closes #5010
Diffstat (limited to 'tools/editor/editor_settings.cpp')
-rw-r--r--tools/editor/editor_settings.cpp22
1 files changed, 20 insertions, 2 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;
}