make sure editor forgets removed settings, closes #5010
This commit is contained in:
parent
e8209b9c5c
commit
3c21827d13
|
@ -86,6 +86,10 @@ bool EditorSettings::_set(const StringName& p_name, const Variant& p_value) {
|
||||||
props[p_name].variant=p_value;
|
props[p_name].variant=p_value;
|
||||||
else
|
else
|
||||||
props[p_name]=VariantContainer(p_value,last_order++);
|
props[p_name]=VariantContainer(p_value,last_order++);
|
||||||
|
|
||||||
|
if (save_changed_setting) {
|
||||||
|
props[p_name].save=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit_signal("settings_changed");
|
emit_signal("settings_changed");
|
||||||
|
@ -126,6 +130,7 @@ struct _EVCSort {
|
||||||
String name;
|
String name;
|
||||||
Variant::Type type;
|
Variant::Type type;
|
||||||
int order;
|
int order;
|
||||||
|
bool save;
|
||||||
|
|
||||||
bool operator<(const _EVCSort& p_vcs) const{ return order< p_vcs.order; }
|
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.name=*k;
|
||||||
vc.order=v->order;
|
vc.order=v->order;
|
||||||
vc.type=v->variant.get_type();
|
vc.type=v->variant.get_type();
|
||||||
|
vc.save=v->save;
|
||||||
|
|
||||||
|
|
||||||
vclist.insert(vc);
|
vclist.insert(vc);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Set<_EVCSort>::Element *E=vclist.front();E;E=E->next()) {
|
for(Set<_EVCSort>::Element *E=vclist.front();E;E=E->next()) {
|
||||||
|
|
||||||
int pinfo = PROPERTY_USAGE_STORAGE;
|
int pinfo = 0;
|
||||||
if (!E->get().name.begins_with("_"))
|
if (E->get().save) {
|
||||||
|
pinfo|=PROPERTY_USAGE_STORAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!E->get().name.begins_with("_")) {
|
||||||
pinfo|=PROPERTY_USAGE_EDITOR;
|
pinfo|=PROPERTY_USAGE_EDITOR;
|
||||||
|
} else {
|
||||||
|
pinfo|=PROPERTY_USAGE_STORAGE; //hiddens must always be saved
|
||||||
|
}
|
||||||
|
|
||||||
PropertyInfo pi(E->get().type, E->get().name);
|
PropertyInfo pi(E->get().type, E->get().name);
|
||||||
pi.usage=pinfo;
|
pi.usage=pinfo;
|
||||||
|
@ -330,6 +344,7 @@ void EditorSettings::create() {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
singleton->save_changed_setting=true;
|
||||||
singleton->config_file_path=config_file_path;
|
singleton->config_file_path=config_file_path;
|
||||||
singleton->project_config_path=pcp;
|
singleton->project_config_path=pcp;
|
||||||
singleton->settings_path=config_path+"/"+config_dir;
|
singleton->settings_path=config_path+"/"+config_dir;
|
||||||
|
@ -363,6 +378,7 @@ void EditorSettings::create() {
|
||||||
};
|
};
|
||||||
|
|
||||||
singleton = Ref<EditorSettings>( memnew( EditorSettings ) );
|
singleton = Ref<EditorSettings>( memnew( EditorSettings ) );
|
||||||
|
singleton->save_changed_setting=true;
|
||||||
singleton->config_file_path=config_file_path;
|
singleton->config_file_path=config_file_path;
|
||||||
singleton->settings_path=config_path+"/"+config_dir;
|
singleton->settings_path=config_path+"/"+config_dir;
|
||||||
singleton->_load_defaults(extra_config);
|
singleton->_load_defaults(extra_config);
|
||||||
|
@ -975,6 +991,7 @@ EditorSettings::EditorSettings() {
|
||||||
|
|
||||||
//singleton=this;
|
//singleton=this;
|
||||||
last_order=0;
|
last_order=0;
|
||||||
|
save_changed_setting=true;
|
||||||
|
|
||||||
EditorTranslationList *etl=_editor_translations;
|
EditorTranslationList *etl=_editor_translations;
|
||||||
|
|
||||||
|
@ -999,6 +1016,7 @@ EditorSettings::EditorSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_load_defaults();
|
_load_defaults();
|
||||||
|
save_changed_setting=false;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,8 @@ private:
|
||||||
int order;
|
int order;
|
||||||
Variant variant;
|
Variant variant;
|
||||||
bool hide_from_editor;
|
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; }
|
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;
|
Ref<Resource> clipboard;
|
||||||
|
|
||||||
|
|
||||||
|
bool save_changed_setting;
|
||||||
|
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue