summaryrefslogtreecommitdiff
path: root/editor/editor_resource_picker.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-07-24 14:21:06 +0200
committerGitHub <noreply@github.com>2021-07-24 14:21:06 +0200
commit96d7bc62af25b85b8b9cc091eeea1e7a784ba624 (patch)
tree83d8a70c911fe7f8d20080a1395d195eb8370d05 /editor/editor_resource_picker.cpp
parent9ac27b58c53b50b5c7085a8fdee653e9eff159d1 (diff)
parent4e6efd1b07f1c6d53d226977ddc729333b74306a (diff)
Merge pull request #50511 from aaronfranke/iterators
Use C++ range iterators for Lists in many situations
Diffstat (limited to 'editor/editor_resource_picker.cpp')
-rw-r--r--editor/editor_resource_picker.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index 8bb6c590dc..967f2aa47b 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -221,8 +221,8 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
}
Set<String> valid_extensions;
- for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
- valid_extensions.insert(E->get());
+ for (String &E : extensions) {
+ valid_extensions.insert(E);
}
if (!file_dialog) {
@@ -260,9 +260,8 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
List<PropertyInfo> property_list;
edited_resource->get_property_list(&property_list);
List<Pair<String, Variant>> propvalues;
- for (List<PropertyInfo>::Element *E = property_list.front(); E; E = E->next()) {
+ for (PropertyInfo &pi : property_list) {
Pair<String, Variant> p;
- PropertyInfo &pi = E->get();
if (pi.usage & PROPERTY_USAGE_STORAGE) {
p.first = pi.name;
p.second = edited_resource->get(pi.name);
@@ -276,8 +275,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
Ref<Resource> unique_resource = Ref<Resource>(Object::cast_to<Resource>(inst));
ERR_FAIL_COND(unique_resource.is_null());
- for (List<Pair<String, Variant>>::Element *E = propvalues.front(); E; E = E->next()) {
- Pair<String, Variant> &p = E->get();
+ for (Pair<String, Variant> &p : propvalues) {
unique_resource->set(p.first, p.second);
}
@@ -467,13 +465,13 @@ void EditorResourcePicker::_get_allowed_types(bool p_with_convert, Set<String> *
List<StringName> inheriters;
ClassDB::get_inheriters_from_class(base, &inheriters);
- for (List<StringName>::Element *E = inheriters.front(); E; E = E->next()) {
- p_vector->insert(E->get());
+ for (StringName &E : inheriters) {
+ p_vector->insert(E);
}
- for (List<StringName>::Element *E = global_classes.front(); E; E = E->next()) {
- if (EditorNode::get_editor_data().script_class_is_parent(E->get(), base)) {
- p_vector->insert(E->get());
+ for (StringName &E : global_classes) {
+ if (EditorNode::get_editor_data().script_class_is_parent(E, base)) {
+ p_vector->insert(E);
}
}