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.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index bdabff20f9..e251a66610 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,7 +268,7 @@ 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 (RBSet<_EVCSort>::Element *E = vclist.front(); E; E = E->next()) {
uint32_t pusage = PROPERTY_USAGE_NONE;
if (E->get().save || !optimize_save) {
pusage |= PROPERTY_USAGE_STORAGE;
@@ -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);
}