summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/physics_body_2d.cpp2
-rw-r--r--scene/2d/tile_map.cpp10
-rw-r--r--scene/3d/gpu_particles_collision_3d.cpp2
-rw-r--r--scene/3d/mesh_instance_3d.cpp2
-rw-r--r--scene/3d/physics_body_3d.cpp2
-rw-r--r--scene/3d/skeleton_3d.cpp2
-rw-r--r--scene/3d/soft_body_3d.cpp2
-rw-r--r--scene/animation/animation_blend_tree.cpp4
-rw-r--r--scene/animation/animation_node_state_machine.cpp6
-rw-r--r--scene/animation/animation_player.cpp8
-rw-r--r--scene/animation/animation_tree.cpp8
-rw-r--r--scene/debugger/scene_debugger.cpp4
-rw-r--r--scene/gui/code_edit.cpp2
-rw-r--r--scene/gui/control.cpp28
-rw-r--r--scene/gui/file_dialog.cpp2
-rw-r--r--scene/gui/graph_edit.cpp10
-rw-r--r--scene/gui/popup_menu.cpp4
-rw-r--r--scene/main/http_request.cpp4
-rw-r--r--scene/main/instance_placeholder.cpp4
-rw-r--r--scene/main/node.cpp16
-rw-r--r--scene/main/scene_tree.cpp4
-rw-r--r--scene/main/window.cpp2
-rw-r--r--scene/resources/curve.cpp4
-rw-r--r--scene/resources/material.cpp2
-rw-r--r--scene/resources/navigation_mesh.cpp4
-rw-r--r--scene/resources/packed_scene.cpp12
-rw-r--r--scene/resources/resource_format_text.cpp4
-rw-r--r--scene/resources/sprite_frames.cpp2
-rw-r--r--scene/resources/syntax_highlighter.cpp2
-rw-r--r--scene/resources/theme.cpp2
-rw-r--r--scene/resources/tile_set.cpp10
-rw-r--r--scene/resources/visual_shader.cpp4
32 files changed, 87 insertions, 87 deletions
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 8709acf7f1..561207c24c 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -145,7 +145,7 @@ TypedArray<PhysicsBody2D> PhysicsBody2D::get_collision_exceptions() {
List<RID> exceptions;
PhysicsServer2D::get_singleton()->body_get_collision_exceptions(get_rid(), &exceptions);
Array ret;
- for (RID body : exceptions) {
+ for (const RID &body : exceptions) {
ObjectID instance_id = PhysicsServer2D::get_singleton()->body_get_object_instance_id(body);
Object *obj = ObjectDB::get_instance(instance_id);
PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(obj);
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 4a15a1dc46..3932f3dc78 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -1596,7 +1596,7 @@ void TileMap::set_light_mask(int p_light_mask) {
// Occlusion: set light mask.
CanvasItem::set_light_mask(p_light_mask);
for (Map<Vector2i, TileMapQuadrant>::Element *E = quadrant_map.front(); E; E = E->next()) {
- for (RID F : E->get().canvas_items) {
+ for (const RID &F : E->get().canvas_items) {
RenderingServer::get_singleton()->canvas_item_set_light_mask(F, get_light_mask());
}
}
@@ -1609,7 +1609,7 @@ void TileMap::set_material(const Ref<Material> &p_material) {
// Update material for the whole tilemap.
for (Map<Vector2i, TileMapQuadrant>::Element *E = quadrant_map.front(); E; E = E->next()) {
TileMapQuadrant &q = E->get();
- for (RID F : q.canvas_items) {
+ for (const RID &F : q.canvas_items) {
RS::get_singleton()->canvas_item_set_use_parent_material(F, get_use_parent_material() || get_material().is_valid());
}
}
@@ -1622,7 +1622,7 @@ void TileMap::set_use_parent_material(bool p_use_parent_material) {
// Update use_parent_material for the whole tilemap.
for (Map<Vector2i, TileMapQuadrant>::Element *E = quadrant_map.front(); E; E = E->next()) {
TileMapQuadrant &q = E->get();
- for (RID F : q.canvas_items) {
+ for (const RID &F : q.canvas_items) {
RS::get_singleton()->canvas_item_set_use_parent_material(F, get_use_parent_material() || get_material().is_valid());
}
}
@@ -1633,7 +1633,7 @@ void TileMap::set_texture_filter(TextureFilter p_texture_filter) {
CanvasItem::set_texture_filter(p_texture_filter);
for (Map<Vector2i, TileMapQuadrant>::Element *F = quadrant_map.front(); F; F = F->next()) {
TileMapQuadrant &q = F->get();
- for (RID E : q.canvas_items) {
+ for (const RID &E : q.canvas_items) {
RenderingServer::get_singleton()->canvas_item_set_default_texture_filter(E, RS::CanvasItemTextureFilter(p_texture_filter));
_make_quadrant_dirty(F);
}
@@ -1645,7 +1645,7 @@ void TileMap::set_texture_repeat(CanvasItem::TextureRepeat p_texture_repeat) {
CanvasItem::set_texture_repeat(p_texture_repeat);
for (Map<Vector2i, TileMapQuadrant>::Element *F = quadrant_map.front(); F; F = F->next()) {
TileMapQuadrant &q = F->get();
- for (RID E : q.canvas_items) {
+ for (const RID &E : q.canvas_items) {
RenderingServer::get_singleton()->canvas_item_set_default_texture_repeat(E, RS::CanvasItemTextureRepeat(p_texture_repeat));
_make_quadrant_dirty(F);
}
diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp
index 97b562837a..cc1b620025 100644
--- a/scene/3d/gpu_particles_collision_3d.cpp
+++ b/scene/3d/gpu_particles_collision_3d.cpp
@@ -397,7 +397,7 @@ Ref<Image> GPUParticlesCollisionSDF::bake() {
bake_step_function(0, "Finding Meshes");
}
- for (PlotMesh &pm : plot_meshes) {
+ for (const PlotMesh &pm : plot_meshes) {
for (int i = 0; i < pm.mesh->get_surface_count(); i++) {
if (pm.mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) {
continue; //only triangles
diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp
index 93cd088418..9ca1d55d0b 100644
--- a/scene/3d/mesh_instance_3d.cpp
+++ b/scene/3d/mesh_instance_3d.cpp
@@ -94,7 +94,7 @@ void MeshInstance3D::_get_property_list(List<PropertyInfo> *p_list) const {
ls.sort();
- for (String &E : ls) {
+ for (const String &E : ls) {
p_list->push_back(PropertyInfo(Variant::FLOAT, E, PROPERTY_HINT_RANGE, "-1,1,0.00001"));
}
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 6736a4ec40..93ecb2cd3a 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -78,7 +78,7 @@ TypedArray<PhysicsBody3D> PhysicsBody3D::get_collision_exceptions() {
List<RID> exceptions;
PhysicsServer3D::get_singleton()->body_get_collision_exceptions(get_rid(), &exceptions);
Array ret;
- for (RID body : exceptions) {
+ for (const RID &body : exceptions) {
ObjectID instance_id = PhysicsServer3D::get_singleton()->body_get_object_instance_id(body);
Object *obj = ObjectDB::get_instance(instance_id);
PhysicsBody3D *physics_body = Object::cast_to<PhysicsBody3D>(obj);
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index fb5e9639c7..9ce4c37457 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -264,7 +264,7 @@ void Skeleton3D::_notification(int p_what) {
b.global_pose_override_amount = 0.0;
}
- for (ObjectID &E : b.nodes_bound) {
+ for (const ObjectID &E : b.nodes_bound) {
Object *obj = ObjectDB::get_instance(E);
ERR_CONTINUE(!obj);
Node3D *node_3d = Object::cast_to<Node3D>(obj);
diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp
index 0d00d10d32..a7ff0842d2 100644
--- a/scene/3d/soft_body_3d.cpp
+++ b/scene/3d/soft_body_3d.cpp
@@ -592,7 +592,7 @@ Array SoftBody3D::get_collision_exceptions() {
List<RID> exceptions;
PhysicsServer3D::get_singleton()->soft_body_get_collision_exceptions(physics_rid, &exceptions);
Array ret;
- for (RID body : exceptions) {
+ for (const RID &body : exceptions) {
ObjectID instance_id = PhysicsServer3D::get_singleton()->body_get_object_instance_id(body);
Object *obj = ObjectDB::get_instance(instance_id);
PhysicsBody3D *physics_body = Object::cast_to<PhysicsBody3D>(obj);
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 495f60d4c9..4bddae3b14 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -1089,7 +1089,7 @@ bool AnimationNodeBlendTree::_get(const StringName &p_name, Variant &r_ret) cons
conns.resize(nc.size() * 3);
int idx = 0;
- for (NodeConnection &E : nc) {
+ for (const NodeConnection &E : nc) {
conns[idx * 3 + 0] = E.input_node;
conns[idx * 3 + 1] = E.input_index;
conns[idx * 3 + 2] = E.output_node;
@@ -1110,7 +1110,7 @@ void AnimationNodeBlendTree::_get_property_list(List<PropertyInfo> *p_list) cons
}
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
String name = E;
if (name != "output") {
p_list->push_back(PropertyInfo(Variant::OBJECT, "nodes/" + name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationNode", PROPERTY_USAGE_NOEDITOR));
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 383d92d37f..bf53b554bf 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -512,7 +512,7 @@ void AnimationNodeStateMachine::get_parameter_list(List<PropertyInfo> *r_list) c
}
advance_conditions.sort_custom<StringName::AlphCompare>();
- for (StringName &E : advance_conditions) {
+ for (const StringName &E : advance_conditions) {
r_list->push_back(PropertyInfo(Variant::BOOL, E));
}
}
@@ -679,7 +679,7 @@ void AnimationNodeStateMachine::get_node_list(List<StringName> *r_nodes) const {
}
nodes.sort_custom<StringName::AlphCompare>();
- for (StringName &E : nodes) {
+ for (const StringName &E : nodes) {
r_nodes->push_back(E);
}
}
@@ -902,7 +902,7 @@ void AnimationNodeStateMachine::_get_property_list(List<PropertyInfo> *p_list) c
}
names.sort_custom<StringName::AlphCompare>();
- for (StringName &name : names) {
+ for (const StringName &name : names) {
p_list->push_back(PropertyInfo(Variant::OBJECT, "states/" + name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationNode", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::VECTOR2, "states/" + name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
}
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 0f557519b2..67b6205a65 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -176,7 +176,7 @@ void AnimationPlayer::_get_property_list(List<PropertyInfo> *p_list) const {
anim_names.sort();
- for (PropertyInfo &E : anim_names) {
+ for (const PropertyInfo &E : anim_names) {
p_list->push_back(E);
}
@@ -1076,7 +1076,7 @@ void AnimationPlayer::get_animation_list(List<StringName> *p_animations) const {
anims.sort();
- for (String &E : anims) {
+ for (const String &E : anims) {
p_animations->push_back(E);
}
}
@@ -1118,7 +1118,7 @@ void AnimationPlayer::queue(const StringName &p_name) {
Vector<String> AnimationPlayer::get_queue() {
Vector<String> ret;
- for (StringName &E : queued) {
+ for (const StringName &E : queued) {
ret.push_back(E);
}
@@ -1502,7 +1502,7 @@ void AnimationPlayer::get_argument_options(const StringName &p_function, int p_i
if (p_idx == 0 && (p_function == "play" || p_function == "play_backwards" || p_function == "remove_animation" || p_function == "has_animation" || p_function == "queue")) {
List<StringName> al;
get_animation_list(&al);
- for (StringName &E : al) {
+ for (const StringName &E : al) {
r_options->push_back(quote_style + String(E) + quote_style);
}
}
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index d277808e1f..00b847168d 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -76,7 +76,7 @@ void AnimationNode::get_child_nodes(List<ChildNode> *r_child_nodes) {
Dictionary cn = get_script_instance()->call("_get_child_nodes");
List<Variant> keys;
cn.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
ChildNode child;
child.name = E;
child.node = cn[E];
@@ -536,7 +536,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) {
List<StringName> sname;
player->get_animation_list(&sname);
- for (StringName &E : sname) {
+ for (const StringName &E : sname) {
Ref<Animation> anim = player->get_animation(E);
for (int i = 0; i < anim->get_track_count(); i++) {
NodePath path = anim->track_get_path(i);
@@ -816,7 +816,7 @@ void AnimationTree::_process_graph(float p_delta) {
{
bool can_call = is_inside_tree() && !Engine::get_singleton()->is_editor_hint();
- for (AnimationNode::AnimationState &as : state.animation_states) {
+ for (const AnimationNode::AnimationState &as : state.animation_states) {
Ref<Animation> a = as.animation;
float time = as.time;
float delta = as.delta;
@@ -1369,7 +1369,7 @@ void AnimationTree::_update_properties_for_node(const String &p_base_path, Ref<A
List<AnimationNode::ChildNode> children;
node->get_child_nodes(&children);
- for (AnimationNode::ChildNode &E : children) {
+ for (const AnimationNode::ChildNode &E : children) {
_update_properties_for_node(p_base_path + E.name + "/", E.node);
}
}
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp
index 5012aed99a..ce2b320c96 100644
--- a/scene/debugger/scene_debugger.cpp
+++ b/scene/debugger/scene_debugger.cpp
@@ -292,7 +292,7 @@ SceneDebuggerObject::SceneDebuggerObject(ObjectID p_id) {
// Add base object properties.
List<PropertyInfo> pinfo;
obj->get_property_list(&pinfo, true);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.usage & (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CATEGORY)) {
properties.push_back(SceneDebuggerProperty(E, obj->get(E.name)));
}
@@ -452,7 +452,7 @@ SceneDebuggerTree::SceneDebuggerTree(Node *p_root) {
}
void SceneDebuggerTree::serialize(Array &p_arr) {
- for (RemoteNode &n : nodes) {
+ for (const RemoteNode &n : nodes) {
p_arr.push_back(n.child_count);
p_arr.push_back(n.name);
p_arr.push_back(n.type_name);
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 7276c2086e..be5e0bf4e5 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -2288,7 +2288,7 @@ void CodeEdit::_filter_code_completion_candidates() {
TypedArray<Dictionary> completion_options_sources;
completion_options_sources.resize(code_completion_option_sources.size());
int i = 0;
- for (ScriptCodeCompletionOption &E : code_completion_option_sources) {
+ for (const ScriptCodeCompletionOption &E : code_completion_option_sources) {
Dictionary option;
option["kind"] = E.kind;
option["display_text"] = E.display;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 8d8c3986ba..5bff1abf9d 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -343,7 +343,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_icon_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.icon_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -355,7 +355,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_stylebox_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.style_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -367,7 +367,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_font_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.font_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -379,7 +379,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_font_size_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.font_size_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -391,7 +391,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_color_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.color_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -403,7 +403,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_constant_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.constant_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -428,7 +428,7 @@ void Control::_validate_property(PropertyInfo &property) const {
Vector<StringName> unique_names;
String hint_string;
- for (StringName &E : names) {
+ for (const StringName &E : names) {
// Skip duplicate values.
if (unique_names.has(E)) {
continue;
@@ -793,7 +793,7 @@ T Control::get_theme_item_in_types(Control *p_theme_owner, Window *p_theme_owner
Window *theme_owner_window = p_theme_owner_window;
while (theme_owner || theme_owner_window) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (theme_owner && theme_owner->data.theme->has_theme_item(p_data_type, p_name, E)) {
return theme_owner->data.theme->get_theme_item(p_data_type, p_name, E);
}
@@ -822,7 +822,7 @@ T Control::get_theme_item_in_types(Control *p_theme_owner, Window *p_theme_owner
// Secondly, check the project-defined Theme resource.
if (Theme::get_project_default().is_valid()) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_project_default()->has_theme_item(p_data_type, p_name, E)) {
return Theme::get_project_default()->get_theme_item(p_data_type, p_name, E);
}
@@ -830,7 +830,7 @@ T Control::get_theme_item_in_types(Control *p_theme_owner, Window *p_theme_owner
}
// Lastly, fall back on the items defined in the default Theme, if they exist.
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_default()->has_theme_item(p_data_type, p_name, E)) {
return Theme::get_default()->get_theme_item(p_data_type, p_name, E);
}
@@ -848,7 +848,7 @@ bool Control::has_theme_item_in_types(Control *p_theme_owner, Window *p_theme_ow
Window *theme_owner_window = p_theme_owner_window;
while (theme_owner || theme_owner_window) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (theme_owner && theme_owner->data.theme->has_theme_item(p_data_type, p_name, E)) {
return true;
}
@@ -877,7 +877,7 @@ bool Control::has_theme_item_in_types(Control *p_theme_owner, Window *p_theme_ow
// Secondly, check the project-defined Theme resource.
if (Theme::get_project_default().is_valid()) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_project_default()->has_theme_item(p_data_type, p_name, E)) {
return true;
}
@@ -885,7 +885,7 @@ bool Control::has_theme_item_in_types(Control *p_theme_owner, Window *p_theme_ow
}
// Lastly, fall back on the items defined in the default Theme, if they exist.
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_default()->has_theme_item(p_data_type, p_name, E)) {
return true;
}
@@ -2580,7 +2580,7 @@ void Control::get_argument_options(const StringName &p_function, int p_idx, List
}
sn.sort_custom<StringName::AlphCompare>();
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
r_options->push_back(quote_style + E + quote_style);
}
}
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 67cb6f04a7..2e4204e171 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -552,7 +552,7 @@ void FileDialog::update_file_list() {
bool match = patterns.is_empty();
String match_str;
- for (String &E : patterns) {
+ for (const String &E : patterns) {
if (files.front()->get().matchn(E)) {
match_str = E;
match = true;
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 8ad4d04b7f..1fac2b9129 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -217,7 +217,7 @@ Error GraphEdit::connect_node(const StringName &p_from, int p_from_port, const S
}
bool GraphEdit::is_node_connected(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port) {
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
if (E.from == p_from && E.from_port == p_from_port && E.to == p_to && E.to_port == p_to_port) {
return true;
}
@@ -561,7 +561,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
if (is_in_hot_zone(pos / zoom, click_pos)) {
if (valid_left_disconnect_types.has(gn->get_connection_output_type(j))) {
//check disconnect
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
if (E.from == gn->get_name() && E.from_port == j) {
Node *to = get_node(String(E.to));
if (Object::cast_to<GraphNode>(to)) {
@@ -603,7 +603,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
if (is_in_hot_zone(pos / zoom, click_pos)) {
if (right_disconnects || valid_right_disconnect_types.has(gn->get_connection_input_type(j))) {
//check disconnect
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
if (E.to == gn->get_name() && E.to_port == j) {
Node *fr = get_node(String(E.from));
if (Object::cast_to<GraphNode>(fr)) {
@@ -1001,7 +1001,7 @@ void GraphEdit::_minimap_draw() {
// Draw node connections.
Color activity_color = get_theme_color(SNAME("activity"));
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
NodePath fromnp(E.from);
Node *from = get_node(fromnp);
@@ -1500,7 +1500,7 @@ Array GraphEdit::_get_connection_list() const {
List<Connection> conns;
get_connection_list(&conns);
Array arr;
- for (Connection &E : conns) {
+ for (const Connection &E : conns) {
Dictionary d;
d["from"] = E.from;
d["from_port"] = E.from_port;
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index ae3db4a983..7790a0970c 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -397,7 +397,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseMotion> m = p_event;
if (m.is_valid()) {
- for (Rect2 &E : autohide_areas) {
+ for (const Rect2 &E : autohide_areas) {
if (!Rect2(Point2(), get_size()).has_point(m->get_position()) && E.has_point(m->get_position())) {
_close_pressed();
return;
@@ -751,7 +751,7 @@ void PopupMenu::_notification(int p_what) {
Point2 mouse_pos = DisplayServer::get_singleton()->mouse_get_position();
mouse_pos -= get_position();
- for (Rect2 &E : autohide_areas) {
+ for (const Rect2 &E : autohide_areas) {
if (!Rect2(Point2(), get_size()).has_point(mouse_pos) && E.has_point(mouse_pos)) {
_close_pressed();
return;
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 588d4b67d5..2c6cefa771 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -220,7 +220,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) {
client->get_response_headers(&rheaders);
response_headers.resize(0);
downloaded.set(0);
- for (String &E : rheaders) {
+ for (const String &E : rheaders) {
response_headers.push_back(E);
}
@@ -235,7 +235,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) {
String new_request;
- for (String &E : rheaders) {
+ for (const 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 b7c6723cfc..b5ba1899ec 100644
--- a/scene/main/instance_placeholder.cpp
+++ b/scene/main/instance_placeholder.cpp
@@ -95,7 +95,7 @@ Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene
scene->set_name(get_name());
int pos = get_index();
- for (PropSet &E : stored_values) {
+ for (const PropSet &E : stored_values) {
scene->set(E.name, E.value);
}
@@ -114,7 +114,7 @@ Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) {
Dictionary ret;
PackedStringArray order;
- for (PropSet &E : stored_values) {
+ for (const PropSet &E : stored_values) {
ret[E.name] = E.value;
if (p_with_order) {
order.push_back(E.name);
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 4b496d4761..f1e5574351 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1597,7 +1597,7 @@ Array Node::_get_groups() const {
Array groups;
List<GroupInfo> gi;
get_groups(&gi);
- for (GroupInfo &E : gi) {
+ for (const GroupInfo &E : gi) {
groups.push_back(E.name);
}
@@ -1947,7 +1947,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
List<PropertyInfo> plist;
N->get()->get_property_list(&plist);
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -1983,7 +1983,7 @@ 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 (GroupInfo &E : gi) {
+ for (const GroupInfo &E : gi) {
#ifdef TOOLS_ENABLED
if ((p_flags & DUPLICATE_FROM_EDITOR) && !E.persistent) {
continue;
@@ -2073,7 +2073,7 @@ 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 (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -2099,7 +2099,7 @@ void Node::remap_nested_resources(RES p_resource, const Map<RES, RES> &p_resourc
List<PropertyInfo> props;
p_resource->get_property_list(&props);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -2135,7 +2135,7 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const {
List<Connection> conns;
n->get_all_signal_connections(&conns);
- for (Connection &E : conns) {
+ for (const Connection &E : conns) {
if (E.flags & CONNECT_PERSIST) {
//user connected
NodePath p = p_original->get_path_to(n);
@@ -2194,7 +2194,7 @@ void Node::replace_by(Node *p_node, bool p_keep_groups) {
List<GroupInfo> groups;
get_groups(&groups);
- for (GroupInfo &E : groups) {
+ for (const GroupInfo &E : groups) {
p_node->add_to_group(E.name, E.persistent);
}
}
@@ -2241,7 +2241,7 @@ void Node::_replace_connections_target(Node *p_new_target) {
List<Connection> cl;
get_signals_connected_to_this(&cl);
- for (Connection &c : cl) {
+ for (const 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 8bca76a794..adba7f1a31 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -94,7 +94,7 @@ void SceneTreeTimer::release_connections() {
List<Connection> connections;
get_all_signal_connections(&connections);
- for (Connection &connection : connections) {
+ for (const Connection &connection : connections) {
disconnect(connection.signal.get_name(), connection.callable);
}
}
@@ -1402,7 +1402,7 @@ SceneTree::SceneTree() {
List<String> exts;
ResourceLoader::get_recognized_extensions_for_type("Environment", &exts);
String ext_hint;
- for (String &E : exts) {
+ for (const String &E : exts) {
if (ext_hint != String()) {
ext_hint += ",";
}
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 4ebfe301ab..ab1846660b 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -1356,7 +1356,7 @@ void Window::_validate_property(PropertyInfo &property) const {
Vector<StringName> unique_names;
String hint_string;
- for (StringName &E : names) {
+ for (const StringName &E : names) {
// Skip duplicate values.
if (unique_names.has(E)) {
continue;
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index 71b4542970..c13db83d6d 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -729,7 +729,7 @@ void Curve2D::_bake() const {
Vector2 *w = baked_point_cache.ptrw();
int idx = 0;
- for (Vector2 &E : pointlist) {
+ for (const Vector2 &E : pointlist) {
w[idx] = E;
idx++;
}
@@ -1239,7 +1239,7 @@ void Curve3D::_bake() const {
Vector3 prev_up = Vector3(0, 1, 0);
Vector3 prev_forward = Vector3(0, 0, 1);
- for (Plane &E : pointlist) {
+ for (const Plane &E : pointlist) {
w[idx] = E.normal;
wt[idx] = E.d;
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index fbeb331f13..08f7274ff6 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -278,7 +278,7 @@ void ShaderMaterial::get_argument_options(const StringName &p_function, int p_id
if (shader.is_valid()) {
List<PropertyInfo> pl;
shader->get_param_list(&pl);
- for (PropertyInfo &E : pl) {
+ for (const PropertyInfo &E : pl) {
r_options->push_back(quote_style + E.name.replace_first("shader_param/", "") + quote_style);
}
}
diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp
index d679a17c15..ddc50c0490 100644
--- a/scene/resources/navigation_mesh.cpp
+++ b/scene/resources/navigation_mesh.cpp
@@ -329,7 +329,7 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
Vector3 *tw = tmeshfaces.ptrw();
int tidx = 0;
- for (Face3 &f : faces) {
+ for (const Face3 &f : faces) {
for (int j = 0; j < 3; j++) {
tw[tidx++] = f.vertex[j];
_EdgeKey ek;
@@ -364,7 +364,7 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
{
Vector3 *w = varr.ptrw();
int idx = 0;
- for (Vector3 &E : lines) {
+ for (const Vector3 &E : lines) {
w[idx++] = E;
}
}
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 8018ce3a9b..eddbb9a842 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -206,7 +206,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
node->set(snames[nprops[j].name], props[nprops[j].value], &valid);
//restore old state for new script, if exists
- for (Pair<StringName, Variant> &E : old_state) {
+ for (const Pair<StringName, Variant> &E : old_state) {
node->set(E.first, E.second);
}
} else {
@@ -477,7 +477,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
script->update_exports();
}
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -565,7 +565,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
List<Node::GroupInfo> groups;
p_node->get_groups(&groups);
- for (Node::GroupInfo &gi : groups) {
+ for (const Node::GroupInfo &gi : groups) {
if (!gi.persistent) {
continue;
}
@@ -575,7 +575,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
*/
bool skip = false;
- for (PackState &F : pack_state_stack) {
+ for (const PackState &F : pack_state_stack) {
//check all levels of pack to see if the group was added somewhere
const PackState &ps = F;
if (ps.state->is_node_in_group(ps.node, gi.name)) {
@@ -677,13 +677,13 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName
//ERR_FAIL_COND_V( !node_map.has(p_node), ERR_BUG);
//NodeData &nd = nodes[node_map[p_node]];
- for (MethodInfo &E : _signals) {
+ for (const MethodInfo &E : _signals) {
List<Node::Connection> conns;
p_node->get_signal_connection_list(E.name, &conns);
conns.sort();
- for (Node::Connection &F : conns) {
+ for (const Node::Connection &F : conns) {
const Node::Connection &c = F;
if (!(c.flags & CONNECT_PERSIST)) { //only persistent connections get saved
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index f0001a045b..3f6e926aa7 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -1221,7 +1221,7 @@ Error ResourceLoaderText::save_as_binary(FileAccess *p_f, const String &p_path)
int prop_count = 0;
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
@@ -1581,7 +1581,7 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant,
Dictionary d = p_variant;
List<Variant> keys;
d.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
Variant v = d[E];
_find_resources(v);
}
diff --git a/scene/resources/sprite_frames.cpp b/scene/resources/sprite_frames.cpp
index 5fdabb6f0f..e9adf67559 100644
--- a/scene/resources/sprite_frames.cpp
+++ b/scene/resources/sprite_frames.cpp
@@ -100,7 +100,7 @@ Vector<String> SpriteFrames::_get_animation_list() const {
Vector<String> ret;
List<StringName> al;
get_animation_list(&al);
- for (StringName &E : al) {
+ for (const StringName &E : al) {
ret.push_back(E);
}
diff --git a/scene/resources/syntax_highlighter.cpp b/scene/resources/syntax_highlighter.cpp
index ac6bffb20b..173ce2adce 100644
--- a/scene/resources/syntax_highlighter.cpp
+++ b/scene/resources/syntax_highlighter.cpp
@@ -529,7 +529,7 @@ void CodeHighlighter::set_color_regions(const Dictionary &p_color_regions) {
List<Variant> keys;
p_color_regions.get_key_list(&keys);
- for (Variant &E : keys) {
+ for (const Variant &E : keys) {
String key = E;
String start_key = key.get_slice(" ", 0);
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 5eb35ce3ff..e4a731c7f7 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -447,7 +447,7 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const {
// Sort and store properties.
list.sort();
- for (PropertyInfo &E : list) {
+ for (const PropertyInfo &E : list) {
p_list->push_back(E);
}
}
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index d235054338..737b47ed95 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -4357,13 +4357,13 @@ void TileSetPluginAtlasRendering::update_dirty_quadrants(TileMap *p_tile_map, Se
RenderingServer *rs = RenderingServer::get_singleton();
// Free the canvas items.
- for (RID E : q.canvas_items) {
+ for (const RID &E : q.canvas_items) {
rs->free(E);
}
q.canvas_items.clear();
// Free the occluders.
- for (RID E : q.occluders) {
+ for (const RID &E : q.occluders) {
rs->free(E);
}
q.occluders.clear();
@@ -4473,7 +4473,7 @@ void TileSetPluginAtlasRendering::update_dirty_quadrants(TileMap *p_tile_map, Se
// Sort the quadrants
for (Map<Vector2i, Vector2i, TileMapQuadrant::CoordsWorldComparator>::Element *E = world_to_map.front(); E; E = E->next()) {
TileMapQuadrant &q = quadrant_map[E->value()];
- for (RID F : q.canvas_items) {
+ for (const RID &F : q.canvas_items) {
RS::get_singleton()->canvas_item_set_draw_index(F, index++);
}
}
@@ -4491,13 +4491,13 @@ void TileSetPluginAtlasRendering::create_quadrant(TileMap *p_tile_map, TileMapQu
void TileSetPluginAtlasRendering::cleanup_quadrant(TileMap *p_tile_map, TileMapQuadrant *p_quadrant) {
// Free the canvas items.
- for (RID E : p_quadrant->canvas_items) {
+ for (const RID &E : p_quadrant->canvas_items) {
RenderingServer::get_singleton()->free(E);
}
p_quadrant->canvas_items.clear();
// Free the occluders.
- for (RID E : p_quadrant->occluders) {
+ for (const RID &E : p_quadrant->occluders) {
RenderingServer::get_singleton()->free(E);
}
p_quadrant->occluders.clear();
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 752c026aa6..7292728251 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -739,7 +739,7 @@ Error VisualShader::connect_nodes(Type p_type, int p_from_node, int p_from_port,
ERR_FAIL_COND_V_MSG(!is_port_types_compatible(from_port_type, to_port_type), ERR_INVALID_PARAMETER, "Incompatible port types (scalar/vec/bool) with transform.");
- for (Connection &E : g->connections) {
+ for (const Connection &E : g->connections) {
if (E.from_node == p_from_node && E.from_port == p_from_port && E.to_node == p_to_node && E.to_port == p_to_port) {
ERR_FAIL_V(ERR_ALREADY_EXISTS);
}
@@ -2586,7 +2586,7 @@ void VisualShaderNodeUniformRef::clear_uniforms() {
}
bool VisualShaderNodeUniformRef::has_uniform(const String &p_name) {
- for (VisualShaderNodeUniformRef::Uniform &E : uniforms) {
+ for (const VisualShaderNodeUniformRef::Uniform &E : uniforms) {
if (E.name == p_name) {
return true;
}