diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-07-25 12:52:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-25 12:52:58 +0200 |
commit | ff0b5f8fa1be4ccd5b8de1d9d49f8a4b71439f63 (patch) | |
tree | 42543cc85d27d2c8692a2ced4bac5c537e402004 /scene/resources | |
parent | 2f221e5fd507b176590bda52d08e499629ce7761 (diff) | |
parent | ac3322b0af8f23e8e2dac8111200bc69b5604c9f (diff) |
Merge pull request #50809 from akien-mga/iterators-const-references
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/curve.cpp | 4 | ||||
-rw-r--r-- | scene/resources/material.cpp | 2 | ||||
-rw-r--r-- | scene/resources/navigation_mesh.cpp | 4 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 12 | ||||
-rw-r--r-- | scene/resources/resource_format_text.cpp | 4 | ||||
-rw-r--r-- | scene/resources/sprite_frames.cpp | 2 | ||||
-rw-r--r-- | scene/resources/syntax_highlighter.cpp | 2 | ||||
-rw-r--r-- | scene/resources/theme.cpp | 2 | ||||
-rw-r--r-- | scene/resources/tile_set.cpp | 10 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 4 |
10 files changed, 23 insertions, 23 deletions
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; } |