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.cpp64
1 files changed, 34 insertions, 30 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index bdabff20f9..31ce31a437 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -141,7 +141,7 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
if (p_name == "shortcuts") {
Array save_array;
- const OrderedHashMap<String, List<Ref<InputEvent>>> &builtin_list = InputMap::get_singleton()->get_builtins();
+ const HashMap<String, List<Ref<InputEvent>>> &builtin_list = InputMap::get_singleton()->get_builtins();
for (const KeyValue<String, Ref<Shortcut>> &shortcut_definition : shortcuts) {
Ref<Shortcut> sc = shortcut_definition.value;
@@ -244,18 +244,17 @@ struct _EVCSort {
void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
_THREAD_SAFE_METHOD_
- const String *k = nullptr;
- Set<_EVCSort> vclist;
+ RBSet<_EVCSort> vclist;
- while ((k = props.next(k))) {
- const VariantContainer *v = props.getptr(*k);
+ for (const KeyValue<String, VariantContainer> &E : props) {
+ const VariantContainer *v = &E.value;
if (v->hide_from_editor) {
continue;
}
_EVCSort vc;
- vc.name = *k;
+ vc.name = E.key;
vc.order = v->order;
vc.type = v->variant.get_type();
vc.save = v->save;
@@ -269,25 +268,25 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
vclist.insert(vc);
}
- for (Set<_EVCSort>::Element *E = vclist.front(); E; E = E->next()) {
+ for (const _EVCSort &E : vclist) {
uint32_t pusage = PROPERTY_USAGE_NONE;
- if (E->get().save || !optimize_save) {
+ if (E.save || !optimize_save) {
pusage |= PROPERTY_USAGE_STORAGE;
}
- if (!E->get().name.begins_with("_") && !E->get().name.begins_with("projects/")) {
+ if (!E.name.begins_with("_") && !E.name.begins_with("projects/")) {
pusage |= PROPERTY_USAGE_EDITOR;
} else {
pusage |= PROPERTY_USAGE_STORAGE; //hiddens must always be saved
}
- PropertyInfo pi(E->get().type, E->get().name);
+ PropertyInfo pi(E.type, E.name);
pi.usage = pusage;
- if (hints.has(E->get().name)) {
- pi = hints[E->get().name];
+ if (hints.has(E.name)) {
+ pi = hints[E.name];
}
- if (E->get().restart_if_changed) {
+ if (E.restart_if_changed) {
pi.usage |= PROPERTY_USAGE_RESTART_IF_CHANGED;
}
@@ -447,7 +446,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "interface/inspector/max_array_dictionary_items_per_page", 20, "10,100,1")
// Theme
- EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_ENUM, "interface/theme/preset", "Default", "Default,Breeze Dark,Godot 2,Grey,Light,Solarized (Dark),Solarized (Light),Custom")
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_ENUM, "interface/theme/preset", "Default", "Default,Breeze Dark,Godot 2,Gray,Light,Solarized (Dark),Solarized (Light),Custom")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/theme/icon_and_font_color", 0, "Auto,Dark,Light")
EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "interface/theme/base_color", Color(0.2, 0.23, 0.31), "")
EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "interface/theme/accent_color", Color(0.41, 0.61, 0.91), "")
@@ -610,9 +609,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// Use a lower default FOV for the 3D camera compared to the
// Camera3D node as the 3D viewport doesn't span the whole screen.
// This means it's technically viewed from a further distance, which warrants a narrower FOV.
- EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/default_fov", 70.0, "1,179,0.1")
- EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/default_z_near", 0.05, "0.01,10,0.01,or_greater")
- EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/default_z_far", 4000.0, "0.1,4000,0.1,or_greater")
+ EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/default_fov", 70.0, "1,179,0.1,degrees")
+ EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/default_z_near", 0.05, "0.01,10,0.01,or_greater,suffix:m")
+ EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/default_z_far", 4000.0, "0.1,4000,0.1,or_greater,suffix:m")
// 3D: Navigation
_initial_set("editors/3d/navigation/invert_x_axis", false);
@@ -682,6 +681,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// Visual editors
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/visual_editors/minimap_opacity", 0.85, "0.0,1.0,0.01")
+ EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "editors/visual_editors/visualshader/port_preview_size", 160, "100,400,0.01")
/* Run */
@@ -789,7 +789,11 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
Ref<ConfigFile> cf = memnew(ConfigFile); // hex is better?
List<String> keys;
- props.get_key_list(&keys);
+
+ for (const KeyValue<String, VariantContainer> &E : props) {
+ keys.push_back(E.key);
+ }
+
keys.sort();
for (const String &key : keys) {
@@ -1396,35 +1400,35 @@ void EditorSettings::add_shortcut(const String &p_name, const Ref<Shortcut> &p_s
}
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);
+ HashMap<String, Ref<Shortcut>>::ConstIterator E = shortcuts.find(p_name);
ERR_FAIL_COND_V_MSG(!E, false, "Unknown Shortcut: " + p_name + ".");
- return E->get()->matches_event(p_event);
+ return E->value->matches_event(p_event);
}
Ref<Shortcut> EditorSettings::get_shortcut(const String &p_name) const {
- const Map<String, Ref<Shortcut>>::Element *SC = shortcuts.find(p_name);
+ HashMap<String, Ref<Shortcut>>::ConstIterator SC = shortcuts.find(p_name);
if (SC) {
- return SC->get();
+ return SC->value;
}
// If no shortcut with the provided name is found in the list, check the built-in shortcuts.
// Use the first item in the action list for the shortcut event, since a shortcut can only have 1 linked event.
Ref<Shortcut> sc;
- const Map<String, List<Ref<InputEvent>>>::Element *builtin_override = builtin_action_overrides.find(p_name);
+ HashMap<String, List<Ref<InputEvent>>>::ConstIterator builtin_override = builtin_action_overrides.find(p_name);
if (builtin_override) {
sc.instantiate();
- sc->set_events_list(&builtin_override->get());
+ sc->set_events_list(&builtin_override->value);
sc->set_name(InputMap::get_singleton()->get_builtin_display_name(p_name));
}
// If there was no override, check the default builtins to see if it has an InputEvent for the provided name.
if (sc.is_null()) {
- const OrderedHashMap<String, List<Ref<InputEvent>>>::ConstElement builtin_default = InputMap::get_singleton()->get_builtins_with_feature_overrides_applied().find(p_name);
+ HashMap<String, List<Ref<InputEvent>>>::ConstIterator builtin_default = InputMap::get_singleton()->get_builtins_with_feature_overrides_applied().find(p_name);
if (builtin_default) {
sc.instantiate();
- sc->set_events_list(&builtin_default.get());
+ sc->set_events_list(&builtin_default->value);
sc->set_name(InputMap::get_singleton()->get_builtin_display_name(p_name));
}
}
@@ -1562,9 +1566,9 @@ void EditorSettings::set_builtin_action_override(const String &p_name, const Arr
// Check if the provided event array is same as built-in. If it is, it does not need to be added to the overrides.
// Note that event order must also be the same.
bool same_as_builtin = true;
- OrderedHashMap<String, List<Ref<InputEvent>>>::ConstElement builtin_default = InputMap::get_singleton()->get_builtins_with_feature_overrides_applied().find(p_name);
+ HashMap<String, List<Ref<InputEvent>>>::ConstIterator builtin_default = InputMap::get_singleton()->get_builtins_with_feature_overrides_applied().find(p_name);
if (builtin_default) {
- List<Ref<InputEvent>> builtin_events = builtin_default.get();
+ const List<Ref<InputEvent>> &builtin_events = builtin_default->value;
// In the editor we only care about key events.
List<Ref<InputEventKey>> builtin_key_events;
@@ -1603,11 +1607,11 @@ void EditorSettings::set_builtin_action_override(const String &p_name, const Arr
}
const Array EditorSettings::get_builtin_action_overrides(const String &p_name) const {
- const Map<String, List<Ref<InputEvent>>>::Element *AO = builtin_action_overrides.find(p_name);
+ HashMap<String, List<Ref<InputEvent>>>::ConstIterator AO = builtin_action_overrides.find(p_name);
if (AO) {
Array event_array;
- List<Ref<InputEvent>> events_list = AO->get();
+ List<Ref<InputEvent>> events_list = AO->value;
for (const Ref<InputEvent> &E : events_list) {
event_array.push_back(E);
}