summaryrefslogtreecommitdiff
path: root/editor/editor_settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_settings.cpp')
-rw-r--r--editor/editor_settings.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index ef8456549a..a6746c6d25 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -569,7 +569,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/2d/bone_outline_size", 2);
_initial_set("editors/2d/viewport_border_color", Color(0.4, 0.4, 1.0, 0.4));
_initial_set("editors/2d/warped_mouse_panning", true);
- _initial_set("editors/2d/simple_spacebar_panning", false);
+ _initial_set("editors/2d/simple_panning", false);
_initial_set("editors/2d/scroll_to_pan", false);
_initial_set("editors/2d/pan_speed", 20);
@@ -699,6 +699,10 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
return false;
}
+bool EditorSettings::_is_default_text_editor_theme(String p_theme_name) {
+ return p_theme_name == "default" || p_theme_name == "adaptive" || p_theme_name == "custom";
+}
+
static Dictionary _get_builtin_script_templates() {
Dictionary templates;
@@ -1123,7 +1127,7 @@ Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_re
Variant _EDITOR_GET(const String &p_setting) {
- ERR_FAIL_COND_V(!EditorSettings::get_singleton()->has_setting(p_setting), Variant())
+ ERR_FAIL_COND_V(!EditorSettings::get_singleton()->has_setting(p_setting), Variant());
return EditorSettings::get_singleton()->get(p_setting);
}
@@ -1291,7 +1295,7 @@ void EditorSettings::list_text_editor_themes() {
d->list_dir_begin();
String file = d->get_next();
while (file != String()) {
- if (file.get_extension() == "tet" && file.get_basename().to_lower() != "default" && file.get_basename().to_lower() != "adaptive" && file.get_basename().to_lower() != "custom") {
+ if (file.get_extension() == "tet" && !_is_default_text_editor_theme(file.get_basename().to_lower())) {
custom_themes.push_back(file.get_basename());
}
file = d->get_next();
@@ -1308,14 +1312,16 @@ 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") {
- if (get("text_editor/theme/color_theme") == "Default") {
+ String p_file = get("text_editor/theme/color_theme");
+
+ if (_is_default_text_editor_theme(p_file.get_file().to_lower())) {
+ if (p_file == "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");
+ String theme_path = get_text_editor_themes_dir().plus_file(p_file + ".tet");
Ref<ConfigFile> cf = memnew(ConfigFile);
Error err = cf->load(theme_path);
@@ -1367,7 +1373,7 @@ bool EditorSettings::save_text_editor_theme() {
String p_file = get("text_editor/theme/color_theme");
- if (p_file.get_file().to_lower() == "default" || p_file.get_file().to_lower() == "adaptive" || p_file.get_file().to_lower() == "custom") {
+ if (_is_default_text_editor_theme(p_file.get_file().to_lower())) {
return false;
}
String theme_path = get_text_editor_themes_dir().plus_file(p_file + ".tet");
@@ -1379,7 +1385,7 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) {
p_file += ".tet";
}
- if (p_file.get_file().to_lower() == "default.tet" || p_file.get_file().to_lower() == "adaptive.tet" || p_file.get_file().to_lower() == "custom.tet") {
+ if (_is_default_text_editor_theme(p_file.get_file().to_lower().trim_suffix(".tet"))) {
return false;
}
if (_save_text_editor_theme(p_file)) {
@@ -1397,6 +1403,11 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) {
return false;
}
+bool EditorSettings::is_default_text_editor_theme() {
+ String p_file = get("text_editor/theme/color_theme");
+ return _is_default_text_editor_theme(p_file.get_file().to_lower());
+}
+
Vector<String> EditorSettings::get_script_templates(const String &p_extension) {
Vector<String> templates;