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.cpp38
1 files changed, 23 insertions, 15 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 0a46acddb2..858c38c796 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -65,7 +65,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
for (int i = 0; i < arr.size(); i += 2) {
String name = arr[i];
- InputEvent shortcut = arr[i + 1];
+ Ref<InputEvent> shortcut = arr[i + 1];
Ref<ShortCut> sc;
sc.instance();
@@ -109,8 +109,8 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
continue; //this came from settings but is not any longer used
}
- InputEvent original = sc->get_meta("original");
- if (sc->is_shortcut(original) || (original.type == InputEvent::NONE && sc->get_shortcut().type == InputEvent::NONE))
+ Ref<InputEvent> original = sc->get_meta("original");
+ if (sc->is_shortcut(original) || (original.is_null() && sc->get_shortcut().is_null()))
continue; //not changed from default, don't save
}
@@ -503,8 +503,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["interface/source_font_size"] = PropertyInfo(Variant::INT, "interface/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
set("interface/custom_font", "");
hints["interface/custom_font"] = PropertyInfo(Variant::STRING, "interface/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.fnt", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/custom_theme", "");
- hints["interface/custom_theme"] = PropertyInfo(Variant::STRING, "interface/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
set("interface/dim_editor_on_dialog_popup", true);
set("interface/dim_amount", 0.6f);
hints["interface/dim_amount"] = PropertyInfo(Variant::REAL, "interface/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT);
@@ -513,6 +511,15 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("interface/separate_distraction_mode", false);
+ set("interface/theme/base_color", Color(0.3, 0.3, 0.3, 1));
+ hints["interface/theme/highlight_color"] = PropertyInfo(Variant::COLOR, "interface/theme/highlight_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ set("interface/theme/highlight_color", Color(0.5, 0.5, 0.6, 1));
+ hints["interface/theme/base_color"] = PropertyInfo(Variant::COLOR, "interface/theme/base_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ set("interface/theme/contrast", 0.2);
+ hints["interface/theme/contrast"] = PropertyInfo(Variant::REAL, "interface/theme/contrast", PROPERTY_HINT_RANGE, "0.01, 1, 0.01");
+ set("interface/theme/custom_theme", "");
+ hints["interface/theme/custom_theme"] = PropertyInfo(Variant::STRING, "interface/theme/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+
set("filesystem/directories/autoscan_project_path", "");
hints["filesystem/directories/autoscan_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/autoscan_project_path", PROPERTY_HINT_GLOBAL_DIR);
set("filesystem/directories/default_project_path", "");
@@ -572,7 +579,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("editors/grid_map/pick_distance", 5000.0);
- set("editors/3d/grid_color", Color(1, 1, 1, 0.2));
+ set("editors/3d/grid_color", Color(0, 1, 0, 0.2));
hints["editors/3d/grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/grid_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
set("editors/3d/default_fov", 45.0);
@@ -979,7 +986,7 @@ void EditorSettings::add_shortcut(const String &p_name, Ref<ShortCut> &p_shortcu
shortcuts[p_name] = p_shortcut;
}
-bool EditorSettings::is_shortcut(const String &p_name, const InputEvent &p_event) const {
+bool EditorSettings::is_shortcut(const String &p_name, const Ref<InputEvent> &p_event) const {
const Map<String, Ref<ShortCut> >::Element *E = shortcuts.find(p_name);
if (!E) {
@@ -1096,15 +1103,16 @@ Ref<ShortCut> ED_GET_SHORTCUT(const String &p_path) {
Ref<ShortCut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode) {
- InputEvent ie;
+ Ref<InputEventKey> ie;
if (p_keycode) {
- ie.type = InputEvent::KEY;
- ie.key.unicode = p_keycode & KEY_CODE_MASK;
- ie.key.scancode = p_keycode & KEY_CODE_MASK;
- ie.key.mod.shift = bool(p_keycode & KEY_MASK_SHIFT);
- ie.key.mod.alt = bool(p_keycode & KEY_MASK_ALT);
- ie.key.mod.control = bool(p_keycode & KEY_MASK_CTRL);
- ie.key.mod.meta = bool(p_keycode & KEY_MASK_META);
+ ie.instance();
+
+ ie->set_unicode(p_keycode & KEY_CODE_MASK);
+ ie->set_scancode(p_keycode & KEY_CODE_MASK);
+ ie->set_shift(bool(p_keycode & KEY_MASK_SHIFT));
+ ie->set_alt(bool(p_keycode & KEY_MASK_ALT));
+ ie->set_control(bool(p_keycode & KEY_MASK_CTRL));
+ ie->set_metakey(bool(p_keycode & KEY_MASK_META));
}
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);