summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/canvas_item.cpp15
-rw-r--r--scene/main/http_request.cpp10
-rw-r--r--scene/main/instance_placeholder.cpp22
-rw-r--r--scene/main/node.cpp62
-rw-r--r--scene/main/scene_tree.cpp15
-rw-r--r--scene/main/viewport.cpp3
-rw-r--r--scene/main/window.cpp8
7 files changed, 65 insertions, 70 deletions
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index 5a12480577..0a76351885 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -956,8 +956,7 @@ void CanvasItem::_notify_transform(CanvasItem *p_node) {
}
}
- for (List<CanvasItem *>::Element *E = p_node->children_items.front(); E; E = E->next()) {
- CanvasItem *ci = E->get();
+ for (CanvasItem *ci : p_node->children_items) {
if (ci->top_level) {
continue;
}
@@ -1334,9 +1333,9 @@ void CanvasItem::_update_texture_filter_changed(bool p_propagate) {
update();
if (p_propagate) {
- for (List<CanvasItem *>::Element *E = children_items.front(); E; E = E->next()) {
- if (!E->get()->top_level && E->get()->texture_filter == TEXTURE_FILTER_PARENT_NODE) {
- E->get()->_update_texture_filter_changed(true);
+ for (CanvasItem *E : children_items) {
+ if (!E->top_level && E->texture_filter == TEXTURE_FILTER_PARENT_NODE) {
+ E->_update_texture_filter_changed(true);
}
}
}
@@ -1374,9 +1373,9 @@ void CanvasItem::_update_texture_repeat_changed(bool p_propagate) {
RS::get_singleton()->canvas_item_set_default_texture_repeat(get_canvas_item(), texture_repeat_cache);
update();
if (p_propagate) {
- for (List<CanvasItem *>::Element *E = children_items.front(); E; E = E->next()) {
- if (!E->get()->top_level && E->get()->texture_repeat == TEXTURE_REPEAT_PARENT_NODE) {
- E->get()->_update_texture_repeat_changed(true);
+ for (CanvasItem *E : children_items) {
+ if (!E->top_level && E->texture_repeat == TEXTURE_REPEAT_PARENT_NODE) {
+ E->_update_texture_repeat_changed(true);
}
}
}
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index f649380afa..588d4b67d5 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -220,8 +220,8 @@ bool HTTPRequest::_handle_response(bool *ret_value) {
client->get_response_headers(&rheaders);
response_headers.resize(0);
downloaded.set(0);
- for (List<String>::Element *E = rheaders.front(); E; E = E->next()) {
- response_headers.push_back(E->get());
+ for (String &E : rheaders) {
+ response_headers.push_back(E);
}
if (response_code == 301 || response_code == 302) {
@@ -235,9 +235,9 @@ bool HTTPRequest::_handle_response(bool *ret_value) {
String new_request;
- for (List<String>::Element *E = rheaders.front(); E; E = E->next()) {
- if (E->get().findn("Location: ") != -1) {
- new_request = E->get().substr(9, E->get().length()).strip_edges();
+ for (String &E : rheaders) {
+ if (E.findn("Location: ") != -1) {
+ new_request = E.substr(9, E.length()).strip_edges();
}
}
diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp
index 89dac5f5a8..b7c6723cfc 100644
--- a/scene/main/instance_placeholder.cpp
+++ b/scene/main/instance_placeholder.cpp
@@ -42,9 +42,9 @@ bool InstancePlaceholder::_set(const StringName &p_name, const Variant &p_value)
}
bool InstancePlaceholder::_get(const StringName &p_name, Variant &r_ret) const {
- for (const List<PropSet>::Element *E = stored_values.front(); E; E = E->next()) {
- if (E->get().name == p_name) {
- r_ret = E->get().value;
+ for (const PropSet &E : stored_values) {
+ if (E.name == p_name) {
+ r_ret = E.value;
return true;
}
}
@@ -52,10 +52,10 @@ bool InstancePlaceholder::_get(const StringName &p_name, Variant &r_ret) const {
}
void InstancePlaceholder::_get_property_list(List<PropertyInfo> *p_list) const {
- for (const List<PropSet>::Element *E = stored_values.front(); E; E = E->next()) {
+ for (const PropSet &E : stored_values) {
PropertyInfo pi;
- pi.name = E->get().name;
- pi.type = E->get().value.get_type();
+ pi.name = E.name;
+ pi.type = E.value.get_type();
pi.usage = PROPERTY_USAGE_STORAGE;
p_list->push_back(pi);
@@ -95,8 +95,8 @@ Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene
scene->set_name(get_name());
int pos = get_index();
- for (List<PropSet>::Element *E = stored_values.front(); E; E = E->next()) {
- scene->set(E->get().name, E->get().value);
+ for (PropSet &E : stored_values) {
+ scene->set(E.name, E.value);
}
if (p_replace) {
@@ -114,10 +114,10 @@ Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) {
Dictionary ret;
PackedStringArray order;
- for (List<PropSet>::Element *E = stored_values.front(); E; E = E->next()) {
- ret[E->get().name] = E->get().value;
+ for (PropSet &E : stored_values) {
+ ret[E.name] = E.value;
if (p_with_order) {
- order.push_back(E->get().name);
+ order.push_back(E.name);
}
};
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 0d060240de..4b496d4761 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1597,8 +1597,8 @@ Array Node::_get_groups() const {
Array groups;
List<GroupInfo> gi;
get_groups(&gi);
- for (List<GroupInfo>::Element *E = gi.front(); E; E = E->next()) {
- groups.push_back(E->get().name);
+ for (GroupInfo &E : gi) {
+ groups.push_back(E.name);
}
return groups;
@@ -1947,18 +1947,18 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
List<PropertyInfo> plist;
N->get()->get_property_list(&plist);
- for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
- if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) {
+ for (PropertyInfo &E : plist) {
+ if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
- String name = E->get().name;
+ String name = E.name;
if (name == script_property_name) {
continue;
}
Variant value = N->get()->get(name).duplicate(true);
- if (E->get().usage & PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE) {
+ if (E.usage & PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE) {
Resource *res = Object::cast_to<Resource>(value);
if (res) { // Duplicate only if it's a resource
current_node->set(name, res->duplicate());
@@ -1983,14 +1983,14 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
if (p_flags & DUPLICATE_GROUPS) {
List<GroupInfo> gi;
get_groups(&gi);
- for (List<GroupInfo>::Element *E = gi.front(); E; E = E->next()) {
+ for (GroupInfo &E : gi) {
#ifdef TOOLS_ENABLED
- if ((p_flags & DUPLICATE_FROM_EDITOR) && !E->get().persistent) {
+ if ((p_flags & DUPLICATE_FROM_EDITOR) && !E.persistent) {
continue;
}
#endif
- node->add_to_group(E->get().name, E->get().persistent);
+ node->add_to_group(E.name, E.persistent);
}
}
@@ -2014,21 +2014,21 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
}
}
- for (List<const Node *>::Element *E = hidden_roots.front(); E; E = E->next()) {
- Node *parent = node->get_node(get_path_to(E->get()->data.parent));
+ for (const Node *&E : hidden_roots) {
+ Node *parent = node->get_node(get_path_to(E->data.parent));
if (!parent) {
memdelete(node);
return nullptr;
}
- Node *dup = E->get()->_duplicate(p_flags, r_duplimap);
+ Node *dup = E->_duplicate(p_flags, r_duplimap);
if (!dup) {
memdelete(node);
return nullptr;
}
parent->add_child(dup);
- int pos = E->get()->get_index();
+ int pos = E->get_index();
if (pos < parent->get_child_count() - 1) {
parent->move_child(dup, pos);
@@ -2073,17 +2073,17 @@ void Node::remap_node_resources(Node *p_node, const Map<RES, RES> &p_resource_re
List<PropertyInfo> props;
p_node->get_property_list(&props);
- for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
- if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) {
+ for (PropertyInfo &E : props) {
+ if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
- Variant v = p_node->get(E->get().name);
+ Variant v = p_node->get(E.name);
if (v.is_ref()) {
RES res = v;
if (res.is_valid()) {
if (p_resource_remap.has(res)) {
- p_node->set(E->get().name, p_resource_remap[res]);
+ p_node->set(E.name, p_resource_remap[res]);
remap_nested_resources(res, p_resource_remap);
}
}
@@ -2099,17 +2099,17 @@ void Node::remap_nested_resources(RES p_resource, const Map<RES, RES> &p_resourc
List<PropertyInfo> props;
p_resource->get_property_list(&props);
- for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
- if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) {
+ for (PropertyInfo &E : props) {
+ if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
- Variant v = p_resource->get(E->get().name);
+ Variant v = p_resource->get(E.name);
if (v.is_ref()) {
RES res = v;
if (res.is_valid()) {
if (p_resource_remap.has(res)) {
- p_resource->set(E->get().name, p_resource_remap[res]);
+ p_resource->set(E.name, p_resource_remap[res]);
remap_nested_resources(res, p_resource_remap);
}
}
@@ -2135,13 +2135,13 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const {
List<Connection> conns;
n->get_all_signal_connections(&conns);
- for (List<Connection>::Element *E = conns.front(); E; E = E->next()) {
- if (E->get().flags & CONNECT_PERSIST) {
+ for (Connection &E : conns) {
+ if (E.flags & CONNECT_PERSIST) {
//user connected
NodePath p = p_original->get_path_to(n);
Node *copy = p_copy->get_node(p);
- Node *target = Object::cast_to<Node>(E->get().callable.get_object());
+ Node *target = Object::cast_to<Node>(E.callable.get_object());
if (!target) {
continue;
}
@@ -2158,9 +2158,9 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const {
}
if (copy && copytarget) {
- const Callable copy_callable = Callable(copytarget, E->get().callable.get_method());
- if (!copy->is_connected(E->get().signal.get_name(), copy_callable)) {
- copy->connect(E->get().signal.get_name(), copy_callable, E->get().binds, E->get().flags);
+ const Callable copy_callable = Callable(copytarget, E.callable.get_method());
+ if (!copy->is_connected(E.signal.get_name(), copy_callable)) {
+ copy->connect(E.signal.get_name(), copy_callable, E.binds, E.flags);
}
}
}
@@ -2194,8 +2194,8 @@ void Node::replace_by(Node *p_node, bool p_keep_groups) {
List<GroupInfo> groups;
get_groups(&groups);
- for (List<GroupInfo>::Element *E = groups.front(); E; E = E->next()) {
- p_node->add_to_group(E->get().name, E->get().persistent);
+ for (GroupInfo &E : groups) {
+ p_node->add_to_group(E.name, E.persistent);
}
}
@@ -2241,9 +2241,7 @@ void Node::_replace_connections_target(Node *p_new_target) {
List<Connection> cl;
get_signals_connected_to_this(&cl);
- for (List<Connection>::Element *E = cl.front(); E; E = E->next()) {
- Connection &c = E->get();
-
+ for (Connection &c : cl) {
if (c.flags & CONNECT_PERSIST) {
c.signal.get_object()->disconnect(c.signal.get_name(), Callable(this, c.callable.get_method()));
bool valid = p_new_target->has_method(c.callable.get_method()) || Ref<Script>(p_new_target->get_script()).is_null() || Ref<Script>(p_new_target->get_script())->has_method(c.callable.get_method());
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 644ce92018..8bca76a794 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -94,8 +94,7 @@ void SceneTreeTimer::release_connections() {
List<Connection> connections;
get_all_signal_connections(&connections);
- for (List<Connection>::Element *E = connections.front(); E; E = E->next()) {
- Connection const &connection = E->get();
+ for (Connection &connection : connections) {
disconnect(connection.signal.get_name(), connection.callable);
}
}
@@ -572,8 +571,8 @@ void SceneTree::finalize() {
}
// cleanup timers
- for (List<Ref<SceneTreeTimer>>::Element *E = timers.front(); E; E = E->next()) {
- E->get()->release_connections();
+ for (Ref<SceneTreeTimer> E : timers) {
+ E->release_connections();
}
timers.clear();
}
@@ -1147,8 +1146,8 @@ Array SceneTree::get_processed_tweens() {
ret.resize(tweens.size());
int i = 0;
- for (List<Ref<Tween>>::Element *E = tweens.front(); E; E = E->next()) {
- ret[i] = E->get();
+ for (Ref<Tween> E : tweens) {
+ ret[i] = E;
i++;
}
@@ -1403,11 +1402,11 @@ SceneTree::SceneTree() {
List<String> exts;
ResourceLoader::get_recognized_extensions_for_type("Environment", &exts);
String ext_hint;
- for (List<String>::Element *E = exts.front(); E; E = E->next()) {
+ for (String &E : exts) {
if (ext_hint != String()) {
ext_hint += ",";
}
- ext_hint += "*." + E->get();
+ ext_hint += "*." + E;
}
// Get path.
String env_path = GLOBAL_DEF("rendering/environment/defaults/default_environment", "");
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 34a871b993..4231072ed9 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -573,8 +573,7 @@ void Viewport::_process_picking() {
// if no mouse event exists, create a motion one. This is necessary because objects or camera may have moved.
// while this extra event is sent, it is checked if both camera and last object and last ID did not move. If nothing changed, the event is discarded to avoid flooding with unnecessary motion events every frame
bool has_mouse_event = false;
- for (List<Ref<InputEvent>>::Element *E = physics_picking_events.front(); E; E = E->next()) {
- Ref<InputEventMouse> m = E->get();
+ for (Ref<InputEvent> m : physics_picking_events) {
if (m.is_valid()) {
has_mouse_event = true;
break;
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index bf7512e8eb..4ebfe301ab 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -1356,14 +1356,14 @@ void Window::_validate_property(PropertyInfo &property) const {
Vector<StringName> unique_names;
String hint_string;
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ for (StringName &E : names) {
// Skip duplicate values.
- if (unique_names.has(E->get())) {
+ if (unique_names.has(E)) {
continue;
}
- hint_string += String(E->get()) + ",";
- unique_names.append(E->get());
+ hint_string += String(E) + ",";
+ unique_names.append(E);
}
property.hint_string = hint_string;