1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-06 19:41:11 +00:00

Fix editor settings weird behavior

This commit is contained in:
volzhs
2018-01-06 20:40:43 +09:00
parent 8e8240450e
commit 6ad43757ad
3 changed files with 58 additions and 72 deletions

View File

@@ -54,7 +54,18 @@ Ref<EditorSettings> EditorSettings::singleton = NULL;
// Properties
bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool p_emit_signal) {
bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
_THREAD_SAFE_METHOD_
bool changed = _set_only(p_name, p_value);
if (changed) {
emit_signal("settings_changed");
}
return true;
}
bool EditorSettings::_set_only(const StringName &p_name, const Variant &p_value) {
_THREAD_SAFE_METHOD_
@@ -73,7 +84,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool
add_shortcut(name, sc);
}
return true;
return false;
}
bool changed = false;
@@ -102,10 +113,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool
}
}
if (changed && p_emit_signal) {
emit_signal("settings_changed");
}
return true;
return changed;
}
bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
@@ -370,6 +378,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/theme/font", "");
hints["text_editor/theme/font"] = PropertyInfo(Variant::STRING, "text_editor/theme/font", PROPERTY_HINT_GLOBAL_FILE, "*.font,*.tres,*.res");
_initial_set("text_editor/completion/auto_brace_complete", false);
_initial_set("text_editor/completion/put_callhint_tooltip_below_current_line", true);
_initial_set("text_editor/completion/callhint_tooltip_offset", Vector2());
_initial_set("text_editor/files/restore_scripts_on_load", true);
_initial_set("text_editor/completion/complete_file_paths", true);
_initial_set("text_editor/files/maximum_recent_files", 20);
@@ -988,8 +998,7 @@ void EditorSettings::set_initial_value(const StringName &p_setting, const Varian
if (!props.has(p_setting))
return;
props[p_setting].initial = p_value;
props[p_setting].has_default_value = true;
_initial_set(p_setting, p_value);
}
Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default) {
@@ -1174,8 +1183,10 @@ void EditorSettings::list_text_editor_themes() {
void EditorSettings::load_text_editor_theme() {
if (get("text_editor/theme/color_theme") == "Default" || get("text_editor/theme/color_theme") == "Adaptive" || get("text_editor/theme/color_theme") == "Custom") {
_load_default_text_editor_theme(); // sorry for "Settings changed" console spam
return;
if (get("text_editor/theme/color_theme") == "Default") {
_load_default_text_editor_theme();
}
return; // sorry for "Settings changed" console spam
}
String theme_path = get_text_editor_themes_dir().plus_file((String)get("text_editor/theme/color_theme") + ".tet");