summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-05-19 13:26:15 +0200
committerGitHub <noreply@github.com>2022-05-19 13:26:15 +0200
commitd8093dd27363384c7196dbff7e485f0df2b11894 (patch)
treeb6bf869a55440a666f4bcc17d5e9cd93ff26dbdc
parent71c40ff4da85a4770958533cdc65f2c9f7ddeaff (diff)
parent900c676b0282bed83d00834e3c280ac89c2bc94d (diff)
Merge pull request #61173 from LightningAA/update-set-iterators
-rw-r--r--core/config/project_settings.cpp16
-rw-r--r--core/io/file_access_pack.cpp4
-rw-r--r--core/io/resource.cpp4
-rw-r--r--core/io/resource_loader.cpp4
-rw-r--r--core/math/a_star.cpp6
-rw-r--r--core/multiplayer/multiplayer_api.cpp4
-rw-r--r--core/string/translation.cpp12
-rw-r--r--drivers/gles3/storage/material_storage.cpp24
-rw-r--r--drivers/gles3/storage/mesh_storage.cpp12
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp42
-rw-r--r--editor/animation_bezier_editor.cpp8
-rw-r--r--editor/create_dialog.cpp4
-rw-r--r--editor/debugger/editor_debugger_inspector.cpp4
-rw-r--r--editor/debugger/editor_debugger_node.cpp4
-rw-r--r--editor/debugger/editor_profiler.cpp24
-rw-r--r--editor/editor_asset_installer.cpp6
-rw-r--r--editor/editor_export.cpp14
-rw-r--r--editor/editor_feature_profile.cpp12
-rw-r--r--editor/editor_file_system.cpp4
-rw-r--r--editor/editor_folding.cpp8
-rw-r--r--editor/editor_node.cpp34
-rw-r--r--editor/editor_resource_picker.cpp16
-rw-r--r--editor/editor_settings.cpp14
-rw-r--r--editor/editor_translation_parser.cpp4
-rw-r--r--editor/import/editor_import_collada.cpp14
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp4
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp8
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp4
-rw-r--r--editor/plugins/script_text_editor.cpp4
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp8
-rw-r--r--editor/plugins/tiles/tile_data_editors.cpp30
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp86
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp114
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp4
-rw-r--r--editor/pot_generator.cpp8
-rw-r--r--editor/project_manager.cpp12
-rw-r--r--editor/project_settings_editor.cpp4
-rw-r--r--editor/property_editor.cpp8
-rw-r--r--main/main.cpp8
-rw-r--r--modules/gdscript/gdscript.cpp12
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.cpp4
-rw-r--r--modules/gridmap/grid_map.cpp12
-rw-r--r--modules/raycast/lightmap_raycaster.cpp8
-rw-r--r--modules/raycast/raycast_occlusion_cull.cpp6
-rw-r--r--modules/raycast/static_raycaster.cpp8
-rw-r--r--modules/visual_script/editor/visual_script_editor.cpp52
-rw-r--r--modules/visual_script/visual_script.cpp118
-rw-r--r--platform/iphone/export/export_plugin.cpp4
-rw-r--r--scene/2d/tile_map.cpp84
-rw-r--r--scene/3d/collision_object_3d.cpp6
-rw-r--r--scene/3d/skeleton_3d.cpp40
-rw-r--r--scene/animation/animation_player.cpp10
-rw-r--r--scene/animation/animation_tree.cpp6
-rw-r--r--scene/debugger/scene_debugger.cpp30
-rw-r--r--scene/gui/base_button.cpp20
-rw-r--r--scene/gui/code_edit.cpp8
-rw-r--r--scene/gui/graph_edit.cpp68
-rw-r--r--scene/gui/grid_container.cpp16
-rw-r--r--scene/gui/range.cpp8
-rw-r--r--scene/main/resource_preloader.cpp6
-rw-r--r--scene/main/viewport.cpp40
-rw-r--r--scene/main/window.cpp12
-rw-r--r--scene/multiplayer/scene_cache_interface.cpp10
-rw-r--r--scene/resources/concave_polygon_shape_3d.cpp6
-rw-r--r--scene/resources/polygon_path_finder.cpp70
-rw-r--r--scene/resources/theme.cpp4
-rw-r--r--scene/resources/tile_set.cpp18
-rw-r--r--scene/resources/visual_shader.cpp4
-rw-r--r--servers/physics_2d/godot_physics_server_2d.cpp18
-rw-r--r--servers/physics_2d/godot_step_2d.cpp4
-rw-r--r--servers/physics_3d/godot_physics_server_3d.cpp18
-rw-r--r--servers/physics_3d/godot_step_3d.cpp8
-rw-r--r--servers/physics_server_2d.cpp12
-rw-r--r--servers/physics_server_3d.cpp12
-rw-r--r--servers/rendering/renderer_canvas_cull.cpp16
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.cpp4
-rw-r--r--servers/rendering/renderer_rd/storage_rd/material_storage.cpp24
-rw-r--r--servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp12
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.cpp4
-rw-r--r--servers/rendering/renderer_scene_cull.cpp68
-rw-r--r--servers/rendering/renderer_storage.h8
-rw-r--r--servers/rendering/renderer_viewport.cpp46
-rw-r--r--servers/rendering/shader_compiler.cpp4
-rw-r--r--servers/rendering/shader_language.cpp20
84 files changed, 784 insertions, 784 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 4638d70e59..ff5ff83bf8 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -360,8 +360,8 @@ void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const {
vclist.insert(vc);
}
- for (RBSet<_VCSort>::Element *E = vclist.front(); E; E = E->next()) {
- String prop_info_name = E->get().name;
+ for (const _VCSort &E : vclist) {
+ String prop_info_name = E.name;
int dot = prop_info_name.find(".");
if (dot != -1 && !custom_prop_info.has(prop_info_name)) {
prop_info_name = prop_info_name.substr(0, dot);
@@ -369,11 +369,11 @@ void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const {
if (custom_prop_info.has(prop_info_name)) {
PropertyInfo pi = custom_prop_info[prop_info_name];
- pi.name = E->get().name;
- pi.usage = E->get().flags;
+ pi.name = E.name;
+ pi.usage = E.flags;
p_list->push_back(pi);
} else {
- p_list->push_back(PropertyInfo(E->get().type, E->get().name, PROPERTY_HINT_NONE, "", E->get().flags));
+ p_list->push_back(PropertyInfo(E.type, E.name, PROPERTY_HINT_NONE, "", E.flags));
}
}
}
@@ -959,9 +959,9 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
RBMap<String, List<String>> props;
- for (RBSet<_VCSort>::Element *E = vclist.front(); E; E = E->next()) {
- String category = E->get().name;
- String name = E->get().name;
+ for (const _VCSort &E : vclist) {
+ String category = E.name;
+ String name = E.name;
int div = category.find("/");
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index 89efdc4938..595a6e9873 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -406,8 +406,8 @@ Error DirAccessPack::list_dir_begin() {
list_dirs.push_back(E.key);
}
- for (RBSet<String>::Element *E = current->files.front(); E; E = E->next()) {
- list_files.push_back(E->get());
+ for (const String &E : current->files) {
+ list_files.push_back(E);
}
return OK;
diff --git a/core/io/resource.cpp b/core/io/resource.cpp
index 4a94c17132..ad01eb1083 100644
--- a/core/io/resource.cpp
+++ b/core/io/resource.cpp
@@ -317,8 +317,8 @@ void Resource::unregister_owner(Object *p_owner) {
}
void Resource::notify_change_to_owners() {
- for (RBSet<ObjectID>::Element *E = owners.front(); E; E = E->next()) {
- Object *obj = ObjectDB::get_instance(E->get());
+ for (const ObjectID &E : owners) {
+ Object *obj = ObjectDB::get_instance(E);
ERR_CONTINUE_MSG(!obj, "Object was deleted, while still owning a resource."); //wtf
//TODO store string
obj->call("resource_changed", Ref<Resource>(this));
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 9e6330f34b..fb21db1a19 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -391,8 +391,8 @@ float ResourceLoader::_dependency_get_progress(const String &p_path) {
int dep_count = load_task.sub_tasks.size();
if (dep_count > 0) {
float dep_progress = 0;
- for (RBSet<String>::Element *E = load_task.sub_tasks.front(); E; E = E->next()) {
- dep_progress += _dependency_get_progress(E->get());
+ for (const String &E : load_task.sub_tasks) {
+ dep_progress += _dependency_get_progress(E);
}
dep_progress /= float(dep_count);
dep_progress *= 0.5;
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index a3ee259030..29aa959e54 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -293,10 +293,10 @@ Vector3 AStar3D::get_closest_position_in_segment(const Vector3 &p_point) const {
real_t closest_dist = 1e20;
Vector3 closest_point;
- for (const RBSet<Segment>::Element *E = segments.front(); E; E = E->next()) {
+ for (const Segment &E : segments) {
Point *from_point = nullptr, *to_point = nullptr;
- points.lookup(E->get().u, from_point);
- points.lookup(E->get().v, to_point);
+ points.lookup(E.u, from_point);
+ points.lookup(E.v, to_point);
if (!(from_point->enabled && to_point->enabled)) {
continue;
diff --git a/core/multiplayer/multiplayer_api.cpp b/core/multiplayer/multiplayer_api.cpp
index e18c3dd2e4..9605647b3f 100644
--- a/core/multiplayer/multiplayer_api.cpp
+++ b/core/multiplayer/multiplayer_api.cpp
@@ -494,8 +494,8 @@ Vector<int> MultiplayerAPI::get_peer_ids() const {
ERR_FAIL_COND_V_MSG(!multiplayer_peer.is_valid(), Vector<int>(), "No multiplayer peer is assigned. Assume no peers are connected.");
Vector<int> ret;
- for (RBSet<int>::Element *E = connected_peers.front(); E; E = E->next()) {
- ret.push_back(E->get());
+ for (const int &E : connected_peers) {
+ ret.push_back(E);
}
return ret;
diff --git a/core/string/translation.cpp b/core/string/translation.cpp
index c64f815563..cba2f09022 100644
--- a/core/string/translation.cpp
+++ b/core/string/translation.cpp
@@ -507,8 +507,8 @@ String TranslationServer::get_locale() const {
Array TranslationServer::get_loaded_locales() const {
Array locales;
- for (const RBSet<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) {
- const Ref<Translation> &t = E->get();
+ for (const Ref<Translation> &E : translations) {
+ const Ref<Translation> &t = E;
ERR_FAIL_COND_V(t.is_null(), Array());
String l = t->get_locale();
@@ -530,8 +530,8 @@ Ref<Translation> TranslationServer::get_translation_object(const String &p_local
Ref<Translation> res;
int best_score = 0;
- for (const RBSet<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) {
- const Ref<Translation> &t = E->get();
+ for (const Ref<Translation> &E : translations) {
+ const Ref<Translation> &t = E;
ERR_FAIL_COND_V(t.is_null(), nullptr);
String l = t->get_locale();
@@ -599,8 +599,8 @@ StringName TranslationServer::_get_message_from_translations(const StringName &p
StringName res;
int best_score = 0;
- for (const RBSet<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) {
- const Ref<Translation> &t = E->get();
+ for (const Ref<Translation> &E : translations) {
+ const Ref<Translation> &t = E;
ERR_FAIL_COND_V(t.is_null(), p_message);
String l = t->get_locale();
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp
index e93c503396..7b18376a2a 100644
--- a/drivers/gles3/storage/material_storage.cpp
+++ b/drivers/gles3/storage/material_storage.cpp
@@ -2091,8 +2091,8 @@ void MaterialStorage::global_variable_set(const StringName &p_name, const Varian
} else {
//texture
MaterialStorage *material_storage = MaterialStorage::get_singleton();
- for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) {
- Material *material = material_storage->get_material(E->get());
+ for (const RID &E : gv.texture_materials) {
+ Material *material = material_storage->get_material(E);
ERR_CONTINUE(!material);
material_storage->_material_queue_update(material, false, true);
}
@@ -2123,8 +2123,8 @@ void MaterialStorage::global_variable_set_override(const StringName &p_name, con
} else {
//texture
MaterialStorage *material_storage = MaterialStorage::get_singleton();
- for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) {
- Material *material = material_storage->get_material(E->get());
+ for (const RID &E : gv.texture_materials) {
+ Material *material = material_storage->get_material(E);
ERR_CONTINUE(!material);
material_storage->_material_queue_update(material, false, true);
}
@@ -2421,8 +2421,8 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
shader->data = nullptr;
}
- for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
- Material *material = E->get();
+ for (Material *E : shader->owners) {
+ Material *material = E;
material->shader_mode = new_mode;
if (material->data) {
memdelete(material->data);
@@ -2438,8 +2438,8 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
shader->mode = RS::SHADER_MAX; //invalid
}
- for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
- Material *material = E->get();
+ for (Material *E : shader->owners) {
+ Material *material = E;
if (shader->data) {
material->data = material_data_request_func[new_mode](shader->data);
material->data->self = material->self;
@@ -2462,8 +2462,8 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
shader->data->set_code(p_code);
}
- for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
- Material *material = E->get();
+ for (Material *E : shader->owners) {
+ Material *material = E;
material->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MATERIAL);
_material_queue_update(material, true, true);
}
@@ -2504,8 +2504,8 @@ void MaterialStorage::shader_set_default_texture_param(RID p_shader, const Strin
if (shader->data) {
shader->data->set_default_texture_param(p_name, p_texture, p_index);
}
- for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
- Material *material = E->get();
+ for (Material *E : shader->owners) {
+ Material *material = E;
_material_queue_update(material, false, true);
}
}
diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp
index 5739a63cac..3be1792868 100644
--- a/drivers/gles3/storage/mesh_storage.cpp
+++ b/drivers/gles3/storage/mesh_storage.cpp
@@ -68,8 +68,8 @@ void MeshStorage::mesh_free(RID p_rid) {
ERR_PRINT("deleting mesh with active instances");
}
if (mesh->shadow_owners.size()) {
- for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
- Mesh *shadow_owner = E->get();
+ for (Mesh *E : mesh->shadow_owners) {
+ Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
}
@@ -268,8 +268,8 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
- for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
- Mesh *shadow_owner = E->get();
+ for (Mesh *E : mesh->shadow_owners) {
+ Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
}
@@ -610,8 +610,8 @@ void MeshStorage::mesh_clear(RID p_mesh) {
mesh->has_bone_weights = false;
mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
- for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
- Mesh *shadow_owner = E->get();
+ for (Mesh *E : mesh->shadow_owners) {
+ Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
}
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index 23c2d764b8..1a60ca0647 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -159,8 +159,8 @@ void RenderingDeviceVulkan::_free_dependencies(RID p_id) {
E = reverse_dependency_map.find(p_id);
if (E) {
- for (RBSet<RID>::Element *F = E->value.front(); F; F = F->next()) {
- HashMap<RID, RBSet<RID>>::Iterator G = dependency_map.find(F->get());
+ for (const RID &F : E->value) {
+ HashMap<RID, RBSet<RID>>::Iterator G = dependency_map.find(F);
ERR_CONTINUE(!G);
ERR_CONTINUE(!G->value.has(p_id));
G->value.erase(p_id);
@@ -5473,9 +5473,9 @@ RenderingDeviceVulkan::DescriptorPool *RenderingDeviceVulkan::_descriptor_pool_a
DescriptorPool *pool = nullptr;
- for (RBSet<DescriptorPool *>::Element *E = descriptor_pools[p_key].front(); E; E = E->next()) {
- if (E->get()->usage < max_descriptors_per_pool) {
- pool = E->get();
+ for (DescriptorPool *E : descriptor_pools[p_key]) {
+ if (E->usage < max_descriptors_per_pool) {
+ pool = E;
break;
}
}
@@ -8349,31 +8349,31 @@ void RenderingDeviceVulkan::compute_list_end(uint32_t p_post_barrier) {
uint32_t barrier_idx = 0;
- for (RBSet<Texture *>::Element *E = compute_list->state.textures_to_sampled_layout.front(); E; E = E->next()) {
+ for (Texture *E : compute_list->state.textures_to_sampled_layout) {
VkImageMemoryBarrier &image_memory_barrier = image_barriers[barrier_idx++];
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
image_memory_barrier.dstAccessMask = access_flags;
- image_memory_barrier.oldLayout = E->get()->layout;
+ image_memory_barrier.oldLayout = E->layout;
image_memory_barrier.newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
image_memory_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
image_memory_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- image_memory_barrier.image = E->get()->image;
- image_memory_barrier.subresourceRange.aspectMask = E->get()->read_aspect_mask;
- image_memory_barrier.subresourceRange.baseMipLevel = E->get()->base_mipmap;
- image_memory_barrier.subresourceRange.levelCount = E->get()->mipmaps;
- image_memory_barrier.subresourceRange.baseArrayLayer = E->get()->base_layer;
- image_memory_barrier.subresourceRange.layerCount = E->get()->layers;
-
- E->get()->layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
-
- if (E->get()->used_in_frame != frames_drawn) {
- E->get()->used_in_transfer = false;
- E->get()->used_in_raster = false;
- E->get()->used_in_compute = false;
- E->get()->used_in_frame = frames_drawn;
+ image_memory_barrier.image = E->image;
+ image_memory_barrier.subresourceRange.aspectMask = E->read_aspect_mask;
+ image_memory_barrier.subresourceRange.baseMipLevel = E->base_mipmap;
+ image_memory_barrier.subresourceRange.levelCount = E->mipmaps;
+ image_memory_barrier.subresourceRange.baseArrayLayer = E->base_layer;
+ image_memory_barrier.subresourceRange.layerCount = E->layers;
+
+ E->layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
+
+ if (E->used_in_frame != frames_drawn) {
+ E->used_in_transfer = false;
+ E->used_in_raster = false;
+ E->used_in_compute = false;
+ E->used_in_frame = frames_drawn;
}
}
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index ff8b72274c..c5f800b17a 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -747,8 +747,8 @@ void AnimationBezierTrackEdit::_update_locked_tracks_after(int p_track) {
}
Vector<int> updated_locked_tracks;
- for (RBSet<int>::Element *E = locked_tracks.front(); E; E = E->next()) {
- updated_locked_tracks.push_back(E->get());
+ for (const int &E : locked_tracks) {
+ updated_locked_tracks.push_back(E);
}
locked_tracks.clear();
for (int i = 0; i < updated_locked_tracks.size(); ++i) {
@@ -766,8 +766,8 @@ void AnimationBezierTrackEdit::_update_hidden_tracks_after(int p_track) {
}
Vector<int> updated_hidden_tracks;
- for (RBSet<int>::Element *E = hidden_tracks.front(); E; E = E->next()) {
- updated_hidden_tracks.push_back(E->get());
+ for (const int &E : hidden_tracks) {
+ updated_hidden_tracks.push_back(E);
}
hidden_tracks.clear();
for (int i = 0; i < updated_hidden_tracks.size(); ++i) {
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index fb908ea573..3469e96a0a 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -138,8 +138,8 @@ bool CreateDialog::_should_hide_type(const String &p_type) const {
return true; // Wrong inheritance.
}
- for (RBSet<StringName>::Element *E = type_blacklist.front(); E; E = E->next()) {
- if (ClassDB::is_parent_class(p_type, E->get())) {
+ for (const StringName &E : type_blacklist) {
+ if (ClassDB::is_parent_class(p_type, E)) {
return true; // Parent type is blacklisted.
}
}
diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp
index 6d7f3f4ae2..0dd7b44b68 100644
--- a/editor/debugger/editor_debugger_inspector.cpp
+++ b/editor/debugger/editor_debugger_inspector.cpp
@@ -193,8 +193,8 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) {
if (old_prop_size == debugObj->prop_list.size() && new_props_added == 0) {
//only some may have changed, if so, then update those, if exist
- for (RBSet<String>::Element *E = changed.front(); E; E = E->next()) {
- emit_signal(SNAME("object_property_updated"), debugObj->remote_object_id, E->get());
+ for (const String &E : changed) {
+ emit_signal(SNAME("object_property_updated"), debugObj->remote_object_id, E);
}
} else {
//full update, because props were added or removed
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index de26b56ab6..bc28b11a71 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -118,8 +118,8 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() {
}
if (!debugger_plugins.is_empty()) {
- for (RBSet<Ref<Script>>::Element *i = debugger_plugins.front(); i; i = i->next()) {
- node->add_debugger_plugin(i->get());
+ for (const Ref<Script> &i : debugger_plugins) {
+ node->add_debugger_plugin(i);
}
}
diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp
index 55c3c7af78..9899e91c5a 100644
--- a/editor/debugger/editor_profiler.cpp
+++ b/editor/debugger/editor_profiler.cpp
@@ -198,13 +198,13 @@ void EditorProfiler::_update_plot() {
for (int i = 0; i < total_metrics; i++) {
const Metric &m = _get_frame_metric(i);
- for (RBSet<StringName>::Element *E = plot_sigs.front(); E; E = E->next()) {
- HashMap<StringName, Metric::Category *>::ConstIterator F = m.category_ptrs.find(E->get());
+ for (const StringName &E : plot_sigs) {
+ HashMap<StringName, Metric::Category *>::ConstIterator F = m.category_ptrs.find(E);
if (F) {
highest = MAX(F->value->total_time, highest);
}
- HashMap<StringName, Metric::Category::Item *>::ConstIterator G = m.item_ptrs.find(E->get());
+ HashMap<StringName, Metric::Category::Item *>::ConstIterator G = m.item_ptrs.find(E);
if (G) {
if (use_self) {
highest = MAX(G->value->self, highest);
@@ -234,17 +234,17 @@ void EditorProfiler::_update_plot() {
int current = i * frame_metrics.size() / w;
- for (RBSet<StringName>::Element *E = plot_sigs.front(); E; E = E->next()) {
+ for (const StringName &E : plot_sigs) {
const Metric &m = _get_frame_metric(current);
float value = 0;
- HashMap<StringName, Metric::Category *>::ConstIterator F = m.category_ptrs.find(E->get());
+ HashMap<StringName, Metric::Category *>::ConstIterator F = m.category_ptrs.find(E);
if (F) {
value = F->value->total_time;
}
- HashMap<StringName, Metric::Category::Item *>::ConstIterator G = m.item_ptrs.find(E->get());
+ HashMap<StringName, Metric::Category::Item *>::ConstIterator G = m.item_ptrs.find(E);
if (G) {
if (use_self) {
value = G->value->self;
@@ -256,12 +256,12 @@ void EditorProfiler::_update_plot() {
int plot_pos = CLAMP(int(value * h / highest), 0, h - 1);
int prev_plot = plot_pos;
- HashMap<StringName, int>::Iterator H = prev_plots.find(E->get());
+ HashMap<StringName, int>::Iterator H = prev_plots.find(E);
if (H) {
prev_plot = H->value;
H->value = plot_pos;
} else {
- prev_plots[E->get()] = plot_pos;
+ prev_plots[E] = plot_pos;
}
plot_pos = h - plot_pos - 1;
@@ -271,7 +271,7 @@ void EditorProfiler::_update_plot() {
SWAP(prev_plot, plot_pos);
}
- Color col = _get_color_from_signature(E->get());
+ Color col = _get_color_from_signature(E);
for (int j = prev_plot; j <= plot_pos; j++) {
column[j * 4 + 0] += Math::fast_ftoi(CLAMP(col.r * 255, 0, 255));
@@ -534,9 +534,9 @@ Vector<Vector<String>> EditorProfiler::get_data_as_csv() const {
Vector<String> signatures;
signatures.resize(possible_signatures.size());
int sig_index = 0;
- for (const RBSet<StringName>::Element *E = possible_signatures.front(); E; E = E->next()) {
- signatures.write[sig_index] = E->get();
- sig_map[E->get()] = sig_index;
+ for (const StringName &E : possible_signatures) {
+ signatures.write[sig_index] = E;
+ sig_map[E] = sig_index;
sig_index++;
}
res.push_back(signatures);
diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp
index 93b155bcd2..b696bc3ac6 100644
--- a/editor/editor_asset_installer.cpp
+++ b/editor/editor_asset_installer.cpp
@@ -154,8 +154,8 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
int num_file_conflicts = 0;
- for (RBSet<String>::Element *E = files_sorted.front(); E; E = E->next()) {
- String path = E->get();
+ for (const String &E : files_sorted) {
+ String path = E;
int depth = p_depth;
bool skip = false;
while (depth > 0) {
@@ -224,7 +224,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
ti->set_metadata(0, res_path);
}
- status_map[E->get()] = ti;
+ status_map[E] = ti;
}
if (num_file_conflicts >= 1) {
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index f0eea50d3a..586ffa418c 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -95,9 +95,9 @@ Ref<EditorExportPlatform> EditorExportPreset::get_platform() const {
void EditorExportPreset::update_files_to_export() {
Vector<String> to_remove;
- for (RBSet<String>::Element *E = selected_files.front(); E; E = E->next()) {
- if (!FileAccess::exists(E->get())) {
- to_remove.push_back(E->get());
+ for (const String &E : selected_files) {
+ if (!FileAccess::exists(E)) {
+ to_remove.push_back(E);
}
}
for (int i = 0; i < to_remove.size(); ++i) {
@@ -107,8 +107,8 @@ void EditorExportPreset::update_files_to_export() {
Vector<String> EditorExportPreset::get_files_to_export() const {
Vector<String> files;
- for (RBSet<String>::Element *E = selected_files.front(); E; E = E->next()) {
- files.push_back(E->get());
+ for (const String &E : selected_files) {
+ files.push_back(E);
}
return files;
}
@@ -879,8 +879,8 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
int idx = 0;
int total = paths.size();
- for (RBSet<String>::Element *E = paths.front(); E; E = E->next()) {
- String path = E->get();
+ for (const String &E : paths) {
+ String path = E;
String type = ResourceLoader::get_resource_type(path);
if (FileAccess::exists(path + ".import")) {
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index 7eb5aec5d0..670f193326 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -166,15 +166,15 @@ Error EditorFeatureProfile::save_to_file(const String &p_path) {
Dictionary data;
data["type"] = "feature_profile";
Array dis_classes;
- for (RBSet<StringName>::Element *E = disabled_classes.front(); E; E = E->next()) {
- dis_classes.push_back(String(E->get()));
+ for (const StringName &E : disabled_classes) {
+ dis_classes.push_back(String(E));
}
dis_classes.sort();
data["disabled_classes"] = dis_classes;
Array dis_editors;
- for (RBSet<StringName>::Element *E = disabled_editors.front(); E; E = E->next()) {
- dis_editors.push_back(String(E->get()));
+ for (const StringName &E : disabled_editors) {
+ dis_editors.push_back(String(E));
}
dis_editors.sort();
data["disabled_editors"] = dis_editors;
@@ -182,8 +182,8 @@ Error EditorFeatureProfile::save_to_file(const String &p_path) {
Array dis_props;
for (KeyValue<StringName, RBSet<StringName>> &E : disabled_properties) {
- for (RBSet<StringName>::Element *F = E.value.front(); F; F = F->next()) {
- dis_props.push_back(String(E.key) + ":" + String(F->get()));
+ for (const StringName &F : E.value) {
+ dis_props.push_back(String(E.key) + ":" + String(F));
}
}
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 56edb03184..e37bfa32bc 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -1458,8 +1458,8 @@ void EditorFileSystem::_save_late_updated_files() {
String fscache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file("filesystem_update4");
Ref<FileAccess> f = FileAccess::open(fscache, FileAccess::WRITE);
ERR_FAIL_COND_MSG(f.is_null(), "Cannot create file '" + fscache + "'. Check user write permissions.");
- for (RBSet<String>::Element *E = late_update_files.front(); E; E = E->next()) {
- f->store_line(E->get());
+ for (const String &E : late_update_files) {
+ f->store_line(E);
}
}
diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp
index 39dc253429..ad8aaf324c 100644
--- a/editor/editor_folding.cpp
+++ b/editor/editor_folding.cpp
@@ -40,8 +40,8 @@ Vector<String> EditorFolding::_get_unfolds(const Object *p_object) {
if (sections.size()) {
String *w = sections.ptrw();
int idx = 0;
- for (const RBSet<String>::Element *E = p_object->editor_get_section_folding().front(); E; E = E->next()) {
- w[idx++] = E->get();
+ for (const String &E : p_object->editor_get_section_folding()) {
+ w[idx++] = E;
}
}
@@ -270,8 +270,8 @@ void EditorFolding::_do_object_unfolds(Object *p_object, RBSet<Ref<Resource>> &r
}
}
- for (RBSet<String>::Element *E = unfold_group.front(); E; E = E->next()) {
- p_object->editor_set_section_unfold(E->get(), true);
+ for (const String &E : unfold_group) {
+ p_object->editor_set_section_unfold(E, true);
}
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 0b96900053..f2baaf8b5c 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -231,8 +231,8 @@ void EditorNode::disambiguate_filenames(const Vector<String> p_full_paths, Vecto
RBSet<int> iset = index_sets[i];
while (iset.size() > 1) {
// Append the parent folder to each scene name.
- for (RBSet<int>::Element *E = iset.front(); E; E = E->next()) {
- int set_idx = E->get();
+ for (const int &E : iset) {
+ int set_idx = E;
String scene_name = r_filenames[set_idx];
String full_path = p_full_paths[set_idx];
@@ -270,11 +270,11 @@ void EditorNode::disambiguate_filenames(const Vector<String> p_full_paths, Vecto
while (E) {
String scene_name = r_filenames[E->get()];
bool duplicate_found = false;
- for (RBSet<int>::Element *F = iset.front(); F; F = F->next()) {
- if (E->get() == F->get()) {
+ for (const int &F : iset) {
+ if (E->get() == F) {
continue;
}
- String other_scene_name = r_filenames[F->get()];
+ String other_scene_name = r_filenames[F];
if (other_scene_name == scene_name) {
duplicate_found = true;
break;
@@ -907,12 +907,12 @@ void EditorNode::_resources_changed(const Vector<String> &p_resources) {
}
void EditorNode::_fs_changed() {
- for (RBSet<FileDialog *>::Element *E = file_dialogs.front(); E; E = E->next()) {
- E->get()->invalidate();
+ for (FileDialog *E : file_dialogs) {
+ E->invalidate();
}
- for (RBSet<EditorFileDialog *>::Element *E = editor_file_dialogs.front(); E; E = E->next()) {
- E->get()->invalidate();
+ for (EditorFileDialog *E : editor_file_dialogs) {
+ E->invalidate();
}
_mark_unsaved_scenes();
@@ -1185,8 +1185,8 @@ Error EditorNode::load_resource(const String &p_resource, bool p_ignore_broken_d
if (!p_ignore_broken_deps && dependency_errors.has(p_resource)) {
Vector<String> errors;
- for (RBSet<String>::Element *E = dependency_errors[p_resource].front(); E; E = E->next()) {
- errors.push_back(E->get());
+ for (const String &E : dependency_errors[p_resource]) {
+ errors.push_back(E);
}
dependency_error->show(DependencyErrorDialog::MODE_RESOURCE, p_resource, errors);
dependency_errors.erase(p_resource);
@@ -1677,8 +1677,8 @@ int EditorNode::_save_external_resources() {
// Clear later, because user may have put the same subresource in two different resources,
// which will be shared until the next reload.
- for (RBSet<Ref<Resource>>::Element *E = edited_subresources.front(); E; E = E->next()) {
- Ref<Resource> res = E->get();
+ for (const Ref<Resource> &E : edited_subresources) {
+ Ref<Resource> res = E;
res->set_edited(false);
}
@@ -3663,8 +3663,8 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
if (!p_ignore_broken_deps && dependency_errors.has(lpath)) {
current_menu_option = -1;
Vector<String> errors;
- for (RBSet<String>::Element *E = dependency_errors[lpath].front(); E; E = E->next()) {
- errors.push_back(E->get());
+ for (const String &E : dependency_errors[lpath]) {
+ errors.push_back(E);
}
dependency_error->show(DependencyErrorDialog::MODE_SCENE, lpath, errors);
opening_prev = false;
@@ -3680,8 +3680,8 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
for (KeyValue<String, RBSet<String>> &E : dependency_errors) {
String txt = vformat(TTR("Scene '%s' has broken dependencies:"), E.key) + "\n";
- for (RBSet<String>::Element *F = E.value.front(); F; F = F->next()) {
- txt += "\t" + F->get() + "\n";
+ for (const String &F : E.value) {
+ txt += "\t" + F + "\n";
}
add_io_error(txt);
}
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index 41d769ad1f..cb3000ee88 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -253,8 +253,8 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
}
file_dialog->clear_filters();
- for (RBSet<String>::Element *E = valid_extensions.front(); E; E = E->next()) {
- file_dialog->add_filter("*." + E->get() + " ; " + E->get().to_upper());
+ for (const String &E : valid_extensions) {
+ file_dialog->add_filter("*." + E + " ; " + E.to_upper());
}
file_dialog->popup_file_dialog();
@@ -417,8 +417,8 @@ void EditorResourcePicker::set_create_options(Object *p_menu_node) {
custom_resources = EditorNode::get_editor_data().get_custom_types()["Resource"];
}
- for (RBSet<String>::Element *E = allowed_types.front(); E; E = E->next()) {
- const String &t = E->get();
+ for (const String &E : allowed_types) {
+ const String &t = E;
bool is_custom_resource = false;
Ref<Texture2D> icon;
@@ -599,8 +599,8 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const {
}
bool EditorResourcePicker::_is_type_valid(const String p_type_name, RBSet<String> p_allowed_types) const {
- for (RBSet<String>::Element *E = p_allowed_types.front(); E; E = E->next()) {
- String at = E->get().strip_edges();
+ for (const String &E : p_allowed_types) {
+ String at = E.strip_edges();
if (p_type_name == at || ClassDB::is_parent_class(p_type_name, at) || EditorNode::get_editor_data().script_class_is_parent(p_type_name, at)) {
return true;
}
@@ -651,8 +651,8 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_
// If the accepted dropped resource is from the extended list, it requires conversion.
if (!_is_type_valid(dropped_resource->get_class(), allowed_types)) {
- for (RBSet<String>::Element *E = allowed_types.front(); E; E = E->next()) {
- String at = E->get().strip_edges();
+ for (const String &E : allowed_types) {
+ String at = E.strip_edges();
if (at == "BaseMaterial3D" && Ref<Texture2D>(dropped_resource).is_valid()) {
// Use existing resource if possible and only replace its data.
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index e251a66610..5160492e51 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -268,25 +268,25 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
vclist.insert(vc);
}
- for (RBSet<_EVCSort>::Element *E = vclist.front(); E; E = E->next()) {
+ for (const _EVCSort &E : vclist) {
uint32_t pusage = PROPERTY_USAGE_NONE;
- if (E->get().save || !optimize_save) {
+ if (E.save || !optimize_save) {
pusage |= PROPERTY_USAGE_STORAGE;
}
- if (!E->get().name.begins_with("_") && !E->get().name.begins_with("projects/")) {
+ if (!E.name.begins_with("_") && !E.name.begins_with("projects/")) {
pusage |= PROPERTY_USAGE_EDITOR;
} else {
pusage |= PROPERTY_USAGE_STORAGE; //hiddens must always be saved
}
- PropertyInfo pi(E->get().type, E->get().name);
+ PropertyInfo pi(E.type, E.name);
pi.usage = pusage;
- if (hints.has(E->get().name)) {
- pi = hints[E->get().name];
+ if (hints.has(E.name)) {
+ pi = hints[E.name];
}
- if (E->get().restart_if_changed) {
+ if (E.restart_if_changed) {
pi.usage |= PROPERTY_USAGE_RESTART_IF_CHANGED;
}
diff --git a/editor/editor_translation_parser.cpp b/editor/editor_translation_parser.cpp
index 13dff08c14..ddb084e19b 100644
--- a/editor/editor_translation_parser.cpp
+++ b/editor/editor_translation_parser.cpp
@@ -96,8 +96,8 @@ void EditorTranslationParser::get_recognized_extensions(List<String> *r_extensio
for (int i = 0; i < temp.size(); i++) {
extensions.insert(temp[i]);
}
- for (RBSet<String>::Element *E = extensions.front(); E; E = E->next()) {
- r_extensions->push_back(E->get());
+ for (const String &E : extensions) {
+ r_extensions->push_back(E);
}
}
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 8ee47cb6f4..03fda0a1c3 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -875,8 +875,8 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
Vector<Collada::Vertex> vertex_array; //there we go, vertex array
vertex_array.resize(vertex_set.size());
- for (RBSet<Collada::Vertex>::Element *F = vertex_set.front(); F; F = F->next()) {
- vertex_array.write[F->get().idx] = F->get();
+ for (Collada::Vertex &F : vertex_set) {
+ vertex_array.write[F.idx] = F;
}
if (has_weights) {
@@ -1507,14 +1507,14 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
bool tracks_found = false;
- for (RBSet<String>::Element *E = valid_animated_nodes.front(); E; E = E->next()) {
+ for (const String &E : valid_animated_nodes) {
// take snapshots
- if (!collada.state.scene_map.has(E->get())) {
+ if (!collada.state.scene_map.has(E)) {
continue;
}
- NodeMap &nm = node_map[E->get()];
+ NodeMap &nm = node_map[E];
String path = scene->get_path_to(nm.node);
if (nm.bone >= 0) {
@@ -1525,7 +1525,7 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
bool found_anim = false;
- Collada::Node *cn = collada.state.scene_map[E->get()];
+ Collada::Node *cn = collada.state.scene_map[E];
if (cn->ignore_anim) {
continue;
}
@@ -1665,7 +1665,7 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
if (nm.bone >= 0) {
if (found_anim) {
- bones_with_animation[E->get()] = true;
+ bones_with_animation[E] = true;
}
}
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 08df704f44..715b1725e0 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -603,8 +603,8 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
HashMap<String, TreeItem *> parenthood;
- for (RBSet<String>::Element *E = paths.front(); E; E = E->next()) {
- NodePath path = E->get();
+ for (const String &E : paths) {
+ NodePath path = E;
TreeItem *ti = nullptr;
String accum;
for (int i = 0; i < path.get_name_count(); i++) {
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 1d85e80331..10c63afa02 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -6710,8 +6710,8 @@ RBSet<RID> _get_physics_bodies_rid(Node *node) {
rids.insert(pb->get_rid());
}
RBSet<PhysicsBody3D *> child_nodes = _get_child_nodes<PhysicsBody3D>(node);
- for (RBSet<PhysicsBody3D *>::Element *I = child_nodes.front(); I; I = I->next()) {
- rids.insert(I->get()->get_rid());
+ for (const PhysicsBody3D *I : child_nodes) {
+ rids.insert(I->get_rid());
}
return rids;
@@ -6755,8 +6755,8 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
}
if (!found_valid_shape && vi.size()) {
AABB aabb = vi.front()->get()->get_transformed_aabb();
- for (RBSet<VisualInstance3D *>::Element *I = vi.front(); I; I = I->next()) {
- aabb.merge_with(I->get()->get_transformed_aabb());
+ for (const VisualInstance3D *I : vi) {
+ aabb.merge_with(I->get_transformed_aabb());
}
Vector3 size = aabb.size * Vector3(0.5, 0.0, 0.5);
from = aabb.position + size;
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index b632b0d641..bebc0e9d54 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -83,8 +83,8 @@ void EditorPropertyRootMotion::_node_assign() {
HashMap<String, TreeItem *> parenthood;
- for (RBSet<String>::Element *E = paths.front(); E; E = E->next()) {
- NodePath path = E->get();
+ for (const String &E : paths) {
+ NodePath path = E;
TreeItem *ti = nullptr;
String accum;
for (int i = 0; i < path.get_name_count(); i++) {
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 9df99dcce4..f666ac0649 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -693,8 +693,8 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
_find_changed_scripts_for_external_editor(base, base, scripts);
}
- for (RBSet<Ref<Script>>::Element *E = scripts.front(); E; E = E->next()) {
- Ref<Script> script = E->get();
+ for (const Ref<Script> &E : scripts) {
+ Ref<Script> script = E;
if (p_for_script.is_valid() && p_for_script != script) {
continue;
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index cb8d59dfe4..8a40ffbe38 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -125,8 +125,8 @@ void SpriteFramesEditor::_sheet_preview_draw() {
Color accent = get_theme_color("accent_color", "Editor");
- for (RBSet<int>::Element *E = frames_selected.front(); E; E = E->next()) {
- const int idx = E->get();
+ for (const int &E : frames_selected) {
+ const int idx = E;
const int x = idx % frame_count.x;
const int y = idx / frame_count.x;
const Point2 pos = draw_offset + Point2(x, y) * (draw_frame_size + draw_sep);
@@ -248,8 +248,8 @@ void SpriteFramesEditor::_sheet_add_frames() {
int fc = frames->get_frame_count(edited_anim);
- for (RBSet<int>::Element *E = frames_selected.front(); E; E = E->next()) {
- int idx = E->get();
+ for (const int &E : frames_selected) {
+ int idx = E;
const Point2 frame_coords(idx % frame_count.x, idx / frame_count.x);
Ref<AtlasTexture> at;
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp
index eda05b1005..244c718ebe 100644
--- a/editor/plugins/tiles/tile_data_editors.cpp
+++ b/editor/plugins/tiles/tile_data_editors.cpp
@@ -897,8 +897,8 @@ void TileDataDefaultEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_
}
}
- for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
- Vector2i coords = E->get().get_atlas_coords();
+ for (const TileMapCell &E : edited) {
+ Vector2i coords = E.get_atlas_coords();
p_canvas_item->draw_rect(p_tile_set_atlas_source->get_tile_texture_region(coords), selection_color, false);
}
p_canvas_item->draw_set_transform_matrix(Transform2D());
@@ -1755,8 +1755,8 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
}
}
- for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
- Vector2i coords = E->get().get_atlas_coords();
+ for (const TileMapCell &E : edited) {
+ Vector2i coords = E.get_atlas_coords();
p_canvas_item->draw_rect(p_tile_set_atlas_source->get_tile_texture_region(coords), selection_color, false);
}
p_canvas_item->draw_set_transform_matrix(Transform2D());
@@ -1800,8 +1800,8 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
p_canvas_item->draw_set_transform_matrix(p_transform);
- for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
- Vector2i coords = E->get().get_atlas_coords();
+ for (const TileMapCell &E : edited) {
+ Vector2i coords = E.get_atlas_coords();
Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords);
Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0);
@@ -2133,15 +2133,15 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
}
}
undo_redo->create_action(TTR("Painting Terrain Set"));
- for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
- Vector2i coords = E->get().get_atlas_coords();
+ for (const TileMapCell &E : edited) {
+ Vector2i coords = E.get_atlas_coords();
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0);
- undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E->get().alternative_tile), tile_data->get_terrain_set());
- undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E->get().alternative_tile), drag_painted_value);
+ undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.alternative_tile), tile_data->get_terrain_set());
+ undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.alternative_tile), drag_painted_value);
for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
if (tile_data->is_valid_peering_bit_terrain(bit)) {
- undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E->get().alternative_tile), tile_data->get_peering_bit_terrain(bit));
+ undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.alternative_tile), tile_data->get_peering_bit_terrain(bit));
}
}
}
@@ -2220,8 +2220,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
mouse_pos_rect_polygon.push_back(Vector2(drag_start_pos.x, mb->get_position().y));
undo_redo->create_action(TTR("Painting Terrain"));
- for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
- Vector2i coords = E->get().get_atlas_coords();
+ for (const TileMapCell &E : edited) {
+ Vector2i coords = E.get_atlas_coords();
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0);
for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
@@ -2236,8 +2236,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
}
if (!Geometry2D::intersect_polygons(polygon, mouse_pos_rect_polygon).is_empty()) {
// Draw bit.
- undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E->get().alternative_tile), terrain);
- undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E->get().alternative_tile), tile_data->get_peering_bit_terrain(bit));
+ undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.alternative_tile), terrain);
+ undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.alternative_tile), tile_data->get_peering_bit_terrain(bit));
}
}
}
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index 12e1f10750..6c39244f80 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -501,8 +501,8 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
if (!tile_map_selection.is_empty()) {
tile_map_clipboard.instantiate();
TypedArray<Vector2i> coords_array;
- for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
- coords_array.push_back(E->get());
+ for (const Vector2i &E : tile_map_selection) {
+ coords_array.push_back(E);
}
tile_map_clipboard = tile_map->get_pattern(tile_map_layer, coords_array);
}
@@ -511,9 +511,9 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
// Delete selected tiles.
if (!tile_map_selection.is_empty()) {
undo_redo->create_action(TTR("Delete tiles"));
- for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
- undo_redo->add_do_method(tile_map, "set_cell", tile_map_layer, E->get(), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
- undo_redo->add_undo_method(tile_map, "set_cell", tile_map_layer, E->get(), tile_map->get_cell_source_id(tile_map_layer, E->get()), tile_map->get_cell_atlas_coords(tile_map_layer, E->get()), tile_map->get_cell_alternative_tile(tile_map_layer, E->get()));
+ for (const Vector2i &E : tile_map_selection) {
+ undo_redo->add_do_method(tile_map, "set_cell", tile_map_layer, E, TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
+ undo_redo->add_undo_method(tile_map, "set_cell", tile_map_layer, E, tile_map->get_cell_source_id(tile_map_layer, E), tile_map->get_cell_atlas_coords(tile_map_layer, E), tile_map->get_cell_alternative_tile(tile_map_layer, E));
}
undo_redo->add_undo_method(this, "_set_tile_map_selection", _get_tile_map_selection());
tile_map_selection.clear();
@@ -542,9 +542,9 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
// Delete selected tiles.
if (!tile_map_selection.is_empty()) {
undo_redo->create_action(TTR("Delete tiles"));
- for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
- undo_redo->add_do_method(tile_map, "set_cell", tile_map_layer, E->get(), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
- undo_redo->add_undo_method(tile_map, "set_cell", tile_map_layer, E->get(), tile_map->get_cell_source_id(tile_map_layer, E->get()), tile_map->get_cell_atlas_coords(tile_map_layer, E->get()), tile_map->get_cell_alternative_tile(tile_map_layer, E->get()));
+ for (const Vector2i &E : tile_map_selection) {
+ undo_redo->add_do_method(tile_map, "set_cell", tile_map_layer, E, TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
+ undo_redo->add_undo_method(tile_map, "set_cell", tile_map_layer, E, tile_map->get_cell_source_id(tile_map_layer, E), tile_map->get_cell_atlas_coords(tile_map_layer, E), tile_map->get_cell_alternative_tile(tile_map_layer, E));
}
undo_redo->add_undo_method(this, "_set_tile_map_selection", _get_tile_map_selection());
tile_map_selection.clear();
@@ -628,8 +628,8 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
_update_selection_pattern_from_tilemap_selection(); // Make sure the pattern is up to date before moving.
drag_type = DRAG_TYPE_MOVE;
drag_modified.clear();
- for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
- Vector2i coords = E->get();
+ for (const Vector2i &E : tile_map_selection) {
+ Vector2i coords = E;
drag_modified.insert(coords, tile_map->get_cell(tile_map_layer, coords));
tile_map->set_cell(tile_map_layer, coords, TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
}
@@ -785,8 +785,8 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
if (!tile_map_selection.is_empty()) {
top_left = tile_map_selection.front()->get();
}
- for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
- top_left = top_left.min(E->get());
+ for (const Vector2i &E : tile_map_selection) {
+ top_left = top_left.min(E);
}
Vector2i offset = drag_start_mouse_pos - tile_map->map_to_world(top_left);
offset = tile_map->world_to_map(drag_last_mouse_pos - offset) - tile_map->world_to_map(drag_start_mouse_pos - offset);
@@ -1278,8 +1278,8 @@ void TileMapEditorTilesPlugin::_stop_dragging() {
if (!tile_map_selection.is_empty()) {
top_left = tile_map_selection.front()->get();
}
- for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
- top_left = top_left.min(E->get());
+ for (const Vector2i &E : tile_map_selection) {
+ top_left = top_left.min(E);
}
// Get the offset from the mouse.
@@ -1534,8 +1534,8 @@ void TileMapEditorTilesPlugin::_update_selection_pattern_from_tilemap_selection(
selection_pattern.instantiate();
TypedArray<Vector2i> coords_array;
- for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
- coords_array.push_back(E->get());
+ for (const Vector2i &E : tile_map_selection) {
+ coords_array.push_back(E);
}
selection_pattern = tile_map->get_pattern(tile_map_layer, coords_array);
}
@@ -1559,8 +1559,8 @@ void TileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_tiles_sele
// Group per source.
HashMap<int, List<const TileMapCell *>> per_source;
- for (RBSet<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
- per_source[E->get().source_id].push_back(&(E->get()));
+ for (const TileMapCell &E : tile_set_selection) {
+ per_source[E.source_id].push_back(&(E));
}
int vertical_offset = 0;
@@ -1680,14 +1680,14 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_draw() {
// Draw the selection.
Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
- for (RBSet<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
- if (E->get().source_id == source_id && E->get().alternative_tile == 0) {
- for (int frame = 0; frame < atlas->get_tile_animation_frames_count(E->get().get_atlas_coords()); frame++) {
+ for (const TileMapCell &E : tile_set_selection) {
+ if (E.source_id == source_id && E.alternative_tile == 0) {
+ for (int frame = 0; frame < atlas->get_tile_animation_frames_count(E.get_atlas_coords()); frame++) {
Color color = selection_color;
if (frame > 0) {
color.a *= 0.3;
}
- tile_atlas_control->draw_rect(atlas->get_tile_texture_region(E->get().get_atlas_coords(), frame), color, false);
+ tile_atlas_control->draw_rect(atlas->get_tile_texture_region(E.get_atlas_coords(), frame), color, false);
}
}
}
@@ -1721,8 +1721,8 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_draw() {
}
}
Color selection_rect_color = selection_color.lightened(0.2);
- for (RBSet<Vector2i>::Element *E = to_draw.front(); E; E = E->next()) {
- tile_atlas_control->draw_rect(atlas->get_tile_texture_region(E->get()), selection_rect_color, false);
+ for (const Vector2i &E : to_draw) {
+ tile_atlas_control->draw_rect(atlas->get_tile_texture_region(E), selection_rect_color, false);
}
}
}
@@ -1868,9 +1868,9 @@ void TileMapEditorTilesPlugin::_tile_alternatives_control_draw() {
}
// Draw the selection.
- for (RBSet<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
- if (E->get().source_id == source_id && E->get().get_atlas_coords() != TileSetSource::INVALID_ATLAS_COORDS && E->get().alternative_tile > 0) {
- Rect2i rect = tile_atlas_view->get_alternative_tile_rect(E->get().get_atlas_coords(), E->get().alternative_tile);
+ for (const TileMapCell &E : tile_set_selection) {
+ if (E.source_id == source_id && E.get_atlas_coords() != TileSetSource::INVALID_ATLAS_COORDS && E.alternative_tile > 0) {
+ Rect2i rect = tile_atlas_view->get_alternative_tile_rect(E.get_atlas_coords(), E.alternative_tile);
if (rect != Rect2i()) {
alternative_tiles_control->draw_rect(rect, Color(0.2, 0.2, 1.0), false);
}
@@ -1972,8 +1972,8 @@ void TileMapEditorTilesPlugin::_set_tile_map_selection(const TypedArray<Vector2i
TypedArray<Vector2i> TileMapEditorTilesPlugin::_get_tile_map_selection() const {
TypedArray<Vector2i> output;
- for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
- output.push_back(E->get());
+ for (const Vector2i &E : tile_map_selection) {
+ output.push_back(E);
}
return output;
}
@@ -2341,8 +2341,8 @@ HashMap<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const
TileSet::TerrainsPattern terrains_pattern = E_to_paint.value;
RBSet<TileMap::TerrainConstraint> cell_constraints = tile_map->get_terrain_constraints_from_added_tile(coords, p_terrain_set, terrains_pattern);
- for (RBSet<TileMap::TerrainConstraint>::Element *E = cell_constraints.front(); E; E = E->next()) {
- added_tiles_constraints_set.insert(E->get());
+ for (const TileMap::TerrainConstraint &E : cell_constraints) {
+ added_tiles_constraints_set.insert(E);
}
}
@@ -2377,18 +2377,18 @@ HashMap<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const
// Filter the sources to make sure they are in the potential_to_replace.
RBMap<TileMap::TerrainConstraint, RBSet<Vector2i>> per_constraint_tiles;
- for (RBSet<TileMap::TerrainConstraint>::Element *E = removed_cells_constraints_set.front(); E; E = E->next()) {
- HashMap<Vector2i, TileSet::CellNeighbor> sources_of_constraint = E->get().get_overlapping_coords_and_peering_bits();
+ for (const TileMap::TerrainConstraint &E : removed_cells_constraints_set) {
+ HashMap<Vector2i, TileSet::CellNeighbor> sources_of_constraint = E.get_overlapping_coords_and_peering_bits();
for (const KeyValue<Vector2i, TileSet::CellNeighbor> &E_source_tile_of_constraint : sources_of_constraint) {
if (potential_to_replace.has(E_source_tile_of_constraint.key)) {
- per_constraint_tiles[E->get()].insert(E_source_tile_of_constraint.key);
+ per_constraint_tiles[E].insert(E_source_tile_of_constraint.key);
}
}
}
to_replace_modified = false;
- for (RBSet<TileMap::TerrainConstraint>::Element *E = added_tiles_constraints_set.front(); E; E = E->next()) {
- TileMap::TerrainConstraint c = E->get();
+ for (const TileMap::TerrainConstraint &E : added_tiles_constraints_set) {
+ TileMap::TerrainConstraint c = E;
// Check if we have a conflict in constraints.
if (removed_cells_constraints_set.has(c) && removed_cells_constraints_set.find(c)->get().get_terrain() != c.get_terrain()) {
// If we do, we search for a neighbor to remove.
@@ -2409,8 +2409,8 @@ HashMap<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const
// Combine all constraints together.
RBSet<TileMap::TerrainConstraint> constraints = removed_cells_constraints_set;
- for (RBSet<TileMap::TerrainConstraint>::Element *E = added_tiles_constraints_set.front(); E; E = E->next()) {
- constraints.insert(E->get());
+ for (const TileMap::TerrainConstraint &E : added_tiles_constraints_set) {
+ constraints.insert(E);
}
// Remove the central tiles from the ones to replace.
@@ -3194,22 +3194,22 @@ void TileMapEditorTerrainsPlugin::_update_tiles_list() {
// Sort the items in a map by the number of corresponding terrains.
RBMap<int, RBSet<TileSet::TerrainsPattern>> sorted;
- for (RBSet<TileSet::TerrainsPattern>::Element *E = per_terrain_terrains_patterns[selected_terrain_set][selected_terrain_id].front(); E; E = E->next()) {
+ for (const TileSet::TerrainsPattern &E : per_terrain_terrains_patterns[selected_terrain_set][selected_terrain_id]) {
// Count the number of matching sides/terrains.
int count = 0;
for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
- if (tile_set->is_valid_peering_bit_terrain(selected_terrain_set, bit) && E->get().get_terrain(bit) == selected_terrain_id) {
+ if (tile_set->is_valid_peering_bit_terrain(selected_terrain_set, bit) && E.get_terrain(bit) == selected_terrain_id) {
count++;
}
}
- sorted[count].insert(E->get());
+ sorted[count].insert(E);
}
for (RBMap<int, RBSet<TileSet::TerrainsPattern>>::Element *E_set = sorted.back(); E_set; E_set = E_set->prev()) {
- for (RBSet<TileSet::TerrainsPattern>::Element *E = E_set->get().front(); E; E = E->next()) {
- TileSet::TerrainsPattern terrains_pattern = E->get();
+ for (const TileSet::TerrainsPattern &E : E_set->get()) {
+ TileSet::TerrainsPattern terrains_pattern = E;
// Get the icon.
Ref<Texture2D> icon;
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index dc3fa87565..b87aedcf60 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -270,9 +270,9 @@ bool TileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_na
// Other properties.
bool any_valid = false;
- for (RBSet<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
- const Vector2i &coords = E->get().tile;
- const int &alternative = E->get().alternative;
+ for (const TileSelection &E : tiles) {
+ const Vector2i &coords = E.tile;
+ const int &alternative = E.alternative;
bool valid = false;
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
@@ -354,11 +354,11 @@ bool TileSetAtlasSourceEditor::AtlasTileProxyObject::_get(const StringName &p_na
}
}
- for (RBSet<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
+ for (const TileSelection &E : tiles) {
// Return the first tile with a property matching the name.
// Note: It's a little bit annoying, but the behavior is the same the one in MultiNodeEdit.
- const Vector2i &coords = E->get().tile;
- const int &alternative = E->get().alternative;
+ const Vector2i &coords = E.tile;
+ const int &alternative = E.alternative;
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
ERR_FAIL_COND_V(!tile_data, false);
@@ -429,9 +429,9 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
RBMap<PropertyId, PLData> usage;
List<PLData *> data_list;
- for (RBSet<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
- const Vector2i &coords = E->get().tile;
- const int &alternative = E->get().alternative;
+ for (const TileSelection &E : tiles) {
+ const Vector2i &coords = E.tile;
+ const int &alternative = E.alternative;
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
ERR_FAIL_COND(!tile_data);
@@ -476,15 +476,15 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
void TileSetAtlasSourceEditor::AtlasTileProxyObject::edit(TileSetAtlasSource *p_tile_set_atlas_source, RBSet<TileSelection> p_tiles) {
ERR_FAIL_COND(!p_tile_set_atlas_source);
ERR_FAIL_COND(p_tiles.is_empty());
- for (RBSet<TileSelection>::Element *E = p_tiles.front(); E; E = E->next()) {
- ERR_FAIL_COND(E->get().tile == TileSetSource::INVALID_ATLAS_COORDS);
- ERR_FAIL_COND(E->get().alternative < 0);
+ for (const TileSelection &E : p_tiles) {
+ ERR_FAIL_COND(E.tile == TileSetSource::INVALID_ATLAS_COORDS);
+ ERR_FAIL_COND(E.alternative < 0);
}
// Disconnect to changes.
- for (RBSet<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
- const Vector2i &coords = E->get().tile;
- const int &alternative = E->get().alternative;
+ for (const TileSelection &E : tiles) {
+ const Vector2i &coords = E.tile;
+ const int &alternative = E.alternative;
if (tile_set_atlas_source && tile_set_atlas_source->has_tile(coords) && tile_set_atlas_source->has_alternative_tile(coords, alternative)) {
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
@@ -498,9 +498,9 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::edit(TileSetAtlasSource *p_
tiles = RBSet<TileSelection>(p_tiles);
// Connect to changes.
- for (RBSet<TileSelection>::Element *E = p_tiles.front(); E; E = E->next()) {
- const Vector2i &coords = E->get().tile;
- const int &alternative = E->get().alternative;
+ for (const TileSelection &E : p_tiles) {
+ const Vector2i &coords = E.tile;
+ const int &alternative = E.alternative;
if (tile_set_atlas_source->has_tile(coords) && tile_set_atlas_source->has_alternative_tile(coords, alternative)) {
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
@@ -1313,9 +1313,9 @@ void TileSetAtlasSourceEditor::_end_dragging() {
switch (drag_type) {
case DRAG_TYPE_CREATE_TILES:
undo_redo->create_action(TTR("Create tiles"));
- for (RBSet<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) {
- undo_redo->add_do_method(tile_set_atlas_source, "create_tile", E->get());
- undo_redo->add_undo_method(tile_set_atlas_source, "remove_tile", E->get());
+ for (const Vector2i &E : drag_modified_tiles) {
+ undo_redo->add_do_method(tile_set_atlas_source, "create_tile", E);
+ undo_redo->add_undo_method(tile_set_atlas_source, "remove_tile", E);
}
undo_redo->commit_action(false);
break;
@@ -1330,8 +1330,8 @@ void TileSetAtlasSourceEditor::_end_dragging() {
tile_set_atlas_source->get_property_list(&list);
HashMap<Vector2i, List<const PropertyInfo *>> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source);
undo_redo->create_action(TTR("Remove tiles"));
- for (RBSet<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) {
- Vector2i coords = E->get();
+ for (const Vector2i &E : drag_modified_tiles) {
+ Vector2i coords = E;
undo_redo->add_do_method(tile_set_atlas_source, "remove_tile", coords);
undo_redo->add_undo_method(tile_set_atlas_source, "create_tile", coords);
if (per_tile.has(coords)) {
@@ -1384,8 +1384,8 @@ void TileSetAtlasSourceEditor::_end_dragging() {
undo_redo->create_action(TTR("Remove tiles"));
undo_redo->add_do_method(this, "_set_selection_from_array", Array());
- for (RBSet<Vector2i>::Element *E = to_delete.front(); E; E = E->next()) {
- Vector2i coords = E->get();
+ for (const Vector2i &E : to_delete) {
+ Vector2i coords = E;
undo_redo->add_do_method(tile_set_atlas_source, "remove_tile", coords);
undo_redo->add_undo_method(tile_set_atlas_source, "create_tile", coords);
if (per_tile.has(coords)) {
@@ -1549,8 +1549,8 @@ void TileSetAtlasSourceEditor::_menu_option(int p_option) {
// Remove tiles
RBSet<Vector2i> removed;
- for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
- TileSelection selected = E->get();
+ for (const TileSelection &E : selection) {
+ TileSelection selected = E;
if (selected.alternative == 0) {
// Remove a tile.
undo_redo->add_do_method(tile_set_atlas_source, "remove_tile", selected.tile);
@@ -1569,8 +1569,8 @@ void TileSetAtlasSourceEditor::_menu_option(int p_option) {
}
// Remove alternatives
- for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
- TileSelection selected = E->get();
+ for (const TileSelection &E : selection) {
+ TileSelection selected = E;
if (selected.alternative > 0 && !removed.has(selected.tile)) {
// Remove an alternative tile.
undo_redo->add_do_method(tile_set_atlas_source, "remove_alternative_tile", selected.tile, selected.alternative);
@@ -1608,13 +1608,13 @@ void TileSetAtlasSourceEditor::_menu_option(int p_option) {
case TILE_CREATE_ALTERNATIVE: {
undo_redo->create_action(TTR("Create tile alternatives"));
Array array;
- for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
- if (E->get().alternative == 0) {
- int next_id = tile_set_atlas_source->get_next_alternative_tile_id(E->get().tile);
- undo_redo->add_do_method(tile_set_atlas_source, "create_alternative_tile", E->get().tile, next_id);
- array.push_back(E->get().tile);
+ for (const TileSelection &E : selection) {
+ if (E.alternative == 0) {
+ int next_id = tile_set_atlas_source->get_next_alternative_tile_id(E.tile);
+ undo_redo->add_do_method(tile_set_atlas_source, "create_alternative_tile", E.tile, next_id);
+ array.push_back(E.tile);
array.push_back(next_id);
- undo_redo->add_undo_method(tile_set_atlas_source, "remove_alternative_tile", E->get().tile, next_id);
+ undo_redo->add_undo_method(tile_set_atlas_source, "remove_alternative_tile", E.tile, next_id);
}
}
undo_redo->add_do_method(this, "_set_selection_from_array", array);
@@ -1658,9 +1658,9 @@ void TileSetAtlasSourceEditor::_set_selection_from_array(Array p_selection) {
Array TileSetAtlasSourceEditor::_get_selection_as_array() {
Array output;
- for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
- output.push_back(E->get().tile);
- output.push_back(E->get().alternative);
+ for (const TileSelection &E : selection) {
+ output.push_back(E.tile);
+ output.push_back(E.alternative);
}
return output;
}
@@ -1672,8 +1672,8 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() {
// Draw the selected tile.
if (tools_button_group->get_pressed_button() == tool_select_button) {
- for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
- TileSelection selected = E->get();
+ for (const TileSelection &E : selection) {
+ TileSelection selected = E;
if (selected.alternative == 0) {
// Draw the rect.
for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(selected.tile); frame++) {
@@ -1722,9 +1722,9 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() {
if (drag_type == DRAG_TYPE_REMOVE_TILES) {
// Draw the tiles to be removed.
- for (RBSet<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) {
- for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(E->get()); frame++) {
- tile_atlas_control->draw_rect(tile_set_atlas_source->get_tile_texture_region(E->get(), frame), Color(0.0, 0.0, 0.0), false);
+ for (const Vector2i &E : drag_modified_tiles) {
+ for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(E); frame++) {
+ tile_atlas_control->draw_rect(tile_set_atlas_source->get_tile_texture_region(E, frame), Color(0.0, 0.0, 0.0), false);
}
}
} else if (drag_type == DRAG_TYPE_RECT_SELECT || drag_type == DRAG_TYPE_REMOVE_TILES_USING_RECT) {
@@ -1749,8 +1749,8 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() {
}
}
- for (RBSet<Vector2i>::Element *E = to_paint.front(); E; E = E->next()) {
- Vector2i coords = E->get();
+ for (const Vector2i &E : to_paint) {
+ Vector2i coords = E;
tile_atlas_control->draw_rect(tile_set_atlas_source->get_tile_texture_region(coords), color, false);
}
} else if (drag_type == DRAG_TYPE_CREATE_TILES_USING_RECT) {
@@ -1837,19 +1837,19 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_unscaled_draw() {
// Draw the selection on top of other.
if (tools_button_group->get_pressed_button() == tool_select_button) {
- for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
- if (E->get().alternative != 0) {
+ for (const TileSelection &E : selection) {
+ if (E.alternative != 0) {
continue;
}
- Rect2i texture_region = tile_set_atlas_source->get_tile_texture_region(E->get().tile);
- Vector2i position = texture_region.get_center() + tile_set_atlas_source->get_tile_effective_texture_offset(E->get().tile, 0);
+ Rect2i texture_region = tile_set_atlas_source->get_tile_texture_region(E.tile);
+ Vector2i position = texture_region.get_center() + tile_set_atlas_source->get_tile_effective_texture_offset(E.tile, 0);
Transform2D xform = tile_atlas_control->get_parent_control()->get_transform();
xform.translate(position);
TileMapCell cell;
cell.source_id = tile_set_atlas_source_id;
- cell.set_atlas_coords(E->get().tile);
+ cell.set_atlas_coords(E.tile);
cell.alternative_tile = 0;
current_tile_data_editor->draw_over_tile(tile_atlas_control_unscaled, xform, cell, true);
}
@@ -1962,8 +1962,8 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_draw() {
}
// Draw selected tile.
- for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
- TileSelection selected = E->get();
+ for (const TileSelection &E : selection) {
+ TileSelection selected = E;
if (selected.alternative >= 1) {
Rect2i rect = tile_atlas_view->get_alternative_tile_rect(selected.tile, selected.alternative);
if (rect != Rect2i()) {
@@ -2005,11 +2005,11 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_unscaled_draw() {
// Draw the selection on top of other.
if (tools_button_group->get_pressed_button() == tool_select_button) {
- for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
- if (E->get().alternative == 0) {
+ for (const TileSelection &E : selection) {
+ if (E.alternative == 0) {
continue;
}
- Rect2i rect = tile_atlas_view->get_alternative_tile_rect(E->get().tile, E->get().alternative);
+ Rect2i rect = tile_atlas_view->get_alternative_tile_rect(E.tile, E.alternative);
Vector2 position = rect.get_center();
Transform2D xform = alternative_tiles_control->get_parent_control()->get_transform();
@@ -2017,8 +2017,8 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_unscaled_draw() {
TileMapCell cell;
cell.source_id = tile_set_atlas_source_id;
- cell.set_atlas_coords(E->get().tile);
- cell.alternative_tile = E->get().alternative;
+ cell.set_atlas_coords(E.tile);
+ cell.alternative_tile = E.alternative;
current_tile_data_editor->draw_over_tile(alternative_tiles_control_unscaled, xform, cell, true);
}
}
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index c5669f3eda..0595357926 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -3215,8 +3215,8 @@ void VisualShaderEditor::_convert_constants_to_uniforms(bool p_vice_versa) {
const RBSet<int> &current_set = p_vice_versa ? selected_uniforms : selected_constants;
RBSet<String> deleted_names;
- for (RBSet<int>::Element *E = current_set.front(); E; E = E->next()) {
- int node_id = E->get();
+ for (const int &E : current_set) {
+ int node_id = E;
Ref<VisualShaderNode> node = visual_shader->get_node(type_id, node_id);
bool caught = false;
Variant var;
diff --git a/editor/pot_generator.cpp b/editor/pot_generator.cpp
index c46a4f5a86..bfc58db2ad 100644
--- a/editor/pot_generator.cpp
+++ b/editor/pot_generator.cpp
@@ -46,8 +46,8 @@ void POTGenerator::_print_all_translation_strings() {
print_line("msgid: " + E.key());
print_line("context: " + v_md[i].ctx);
print_line("msgid_plural: " + v_md[i].plural);
- for (RBSet<String>::Element *F = v_md[i].locations.front(); F; F = F->next()) {
- print_line("location: " + F->get());
+ for (const String &F : v_md[i].locations) {
+ print_line("location: " + F);
}
}
}
@@ -133,8 +133,8 @@ void POTGenerator::_write_to_pot(const String &p_file) {
file->store_line("");
// Write file locations.
- for (RBSet<String>::Element *E = locations.front(); E; E = E->next()) {
- file->store_line("#: " + E->get().trim_prefix("res://"));
+ for (const String &E : locations) {
+ file->store_line("#: " + E.trim_prefix("res://"));
}
// Write context.
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index d74cfe4ec0..967cb5a932 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -2099,8 +2099,8 @@ void ProjectManager::_open_selected_projects() {
const RBSet<String> &selected_list = _project_list->get_selected_project_keys();
- for (const RBSet<String>::Element *E = selected_list.front(); E; E = E->next()) {
- const String &selected = E->get();
+ for (const String &E : selected_list) {
+ const String &selected = E;
String path = EditorSettings::get_singleton()->get("projects/" + selected);
String conf = path.plus_file("project.godot");
@@ -2327,8 +2327,8 @@ void ProjectManager::_rename_project() {
return;
}
- for (RBSet<String>::Element *E = selected_list.front(); E; E = E->next()) {
- const String &selected = E->get();
+ for (const String &E : selected_list) {
+ const String &selected = E;
String path = EditorSettings::get_singleton()->get("projects/" + selected);
npdialog->set_project_path(path);
npdialog->set_mode(ProjectDialog::MODE_RENAME);
@@ -2412,8 +2412,8 @@ void ProjectManager::_files_dropped(PackedStringArray p_files) {
}
if (folders_set.size() > 0) {
PackedStringArray folders;
- for (RBSet<String>::Element *E = folders_set.front(); E; E = E->next()) {
- folders.push_back(E->get());
+ for (const String &E : folders_set) {
+ folders.push_back(E);
}
bool confirm = true;
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index bd0affbcc3..5367306f1a 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -292,8 +292,8 @@ void ProjectSettingsEditor::_add_feature_overrides() {
feature_box->clear();
feature_box->add_item(TTR("(All)"), 0); // So it is always on top.
int id = 1;
- for (RBSet<String>::Element *E = presets.front(); E; E = E->next()) {
- feature_box->add_item(E->get(), id++);
+ for (const String &E : presets) {
+ feature_box->add_item(E, id++);
}
}
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 71cdcc2580..d541b26cc9 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -143,8 +143,8 @@ void CustomPropertyEditor::_menu_option(int p_which) {
}
file->clear_filters();
- for (RBSet<String>::Element *E = valid_extensions.front(); E; E = E->next()) {
- file->add_filter("*." + E->get() + " ; " + E->get().to_upper());
+ for (const String &E : valid_extensions) {
+ file->add_filter("*." + E + " ; " + E.to_upper());
}
file->popup_file_dialog();
@@ -890,8 +890,8 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
E = E->next();
}
- for (RBSet<String>::Element *j = valid_inheritors.front(); j; j = j->next()) {
- const String &t = j->get();
+ for (const String &j : valid_inheritors) {
+ const String &t = j;
bool is_custom_resource = false;
Ref<Texture2D> icon;
diff --git a/main/main.cpp b/main/main.cpp
index 191f4d684f..4d4173b2ee 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2189,10 +2189,10 @@ bool Main::start() {
print_line("Merging docs...");
doc.merge_from(docsrc);
- for (RBSet<String>::Element *E = checked_paths.front(); E; E = E->next()) {
- print_line("Erasing old docs at: " + E->get());
- err = DocTools::erase_classes(E->get());
- ERR_FAIL_COND_V_MSG(err != OK, false, "Error erasing old docs at: " + E->get() + ": " + itos(err));
+ for (const String &E : checked_paths) {
+ print_line("Erasing old docs at: " + E);
+ err = DocTools::erase_classes(E);
+ ERR_FAIL_COND_V_MSG(err != OK, false, "Error erasing old docs at: " + E + ": " + itos(err));
}
print_line("Generating new docs...");
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index e400d0bf94..25f4823d92 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -764,8 +764,8 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
_update_exports_values(values, propnames);
if (changed) {
- for (RBSet<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
- E->get()->update(propnames, values);
+ for (PlaceHolderScriptInstance *E : placeholders) {
+ E->update(propnames, values);
}
} else {
p_instance_to_update->update(propnames, values);
@@ -790,8 +790,8 @@ void GDScript::update_exports() {
RBSet<ObjectID> copy = inheriters_cache; //might get modified
- for (RBSet<ObjectID>::Element *E = copy.front(); E; E = E->next()) {
- Object *id = ObjectDB::get_instance(E->get());
+ for (const ObjectID &E : copy) {
+ Object *id = ObjectDB::get_instance(E);
GDScript *s = Object::cast_to<GDScript>(id);
if (!s) {
continue;
@@ -939,8 +939,8 @@ void GDScript::get_constants(HashMap<StringName, Variant> *p_constants) {
void GDScript::get_members(RBSet<StringName> *p_members) {
if (p_members) {
- for (RBSet<StringName>::Element *E = members.front(); E; E = E->next()) {
- p_members->insert(E->get());
+ for (const StringName &E : members) {
+ p_members->insert(E);
}
}
}
diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp
index d9de112bb0..ffd3cfa907 100644
--- a/modules/gdscript/language_server/gdscript_workspace.cpp
+++ b/modules/gdscript/language_server/gdscript_workspace.cpp
@@ -794,7 +794,7 @@ GDScriptWorkspace::~GDScriptWorkspace() {
cached_parsers.insert(E.key);
}
- for (RBSet<String>::Element *E = cached_parsers.front(); E; E = E->next()) {
- remove_cache_parser(E->get());
+ for (const String &E : cached_parsers) {
+ remove_cache_parser(E);
}
}
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 9da137f9d5..c70a8121e8 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -483,15 +483,15 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
HashMap<int, List<Pair<Transform3D, IndexKey>>> multimesh_items;
- for (RBSet<IndexKey>::Element *E = g.cells.front(); E; E = E->next()) {
- ERR_CONTINUE(!cell_map.has(E->get()));
- const Cell &c = cell_map[E->get()];
+ for (const IndexKey &E : g.cells) {
+ ERR_CONTINUE(!cell_map.has(E));
+ const Cell &c = cell_map[E];
if (!mesh_library.is_valid() || !mesh_library->has_item(c.item)) {
continue;
}
- Vector3 cellpos = Vector3(E->get().x, E->get().y, E->get().z);
+ Vector3 cellpos = Vector3(E.x, E.y, E.z);
Vector3 ofs = _get_offset();
Transform3D xform;
@@ -507,7 +507,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
Pair<Transform3D, IndexKey> p;
p.first = xform * mesh_library->get_item_mesh_transform(c.item);
- p.second = E->get();
+ p.second = E;
multimesh_items[c.item].push_back(p);
}
}
@@ -540,7 +540,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
nm.region = region;
}
- g.navmesh_ids[E->get()] = nm;
+ g.navmesh_ids[E] = nm;
}
}
diff --git a/modules/raycast/lightmap_raycaster.cpp b/modules/raycast/lightmap_raycaster.cpp
index 7e7c3f9067..fc9ac416b7 100644
--- a/modules/raycast/lightmap_raycaster.cpp
+++ b/modules/raycast/lightmap_raycaster.cpp
@@ -153,16 +153,16 @@ void LightmapRaycasterEmbree::commit() {
}
void LightmapRaycasterEmbree::set_mesh_filter(const RBSet<int> &p_mesh_ids) {
- for (RBSet<int>::Element *E = p_mesh_ids.front(); E; E = E->next()) {
- rtcDisableGeometry(rtcGetGeometry(embree_scene, E->get()));
+ for (const int &E : p_mesh_ids) {
+ rtcDisableGeometry(rtcGetGeometry(embree_scene, E));
}
rtcCommitScene(embree_scene);
filter_meshes = p_mesh_ids;
}
void LightmapRaycasterEmbree::clear_mesh_filter() {
- for (RBSet<int>::Element *E = filter_meshes.front(); E; E = E->next()) {
- rtcEnableGeometry(rtcGetGeometry(embree_scene, E->get()));
+ for (const int &E : filter_meshes) {
+ rtcEnableGeometry(rtcGetGeometry(embree_scene, E));
}
rtcCommitScene(embree_scene);
filter_meshes.clear();
diff --git a/modules/raycast/raycast_occlusion_cull.cpp b/modules/raycast/raycast_occlusion_cull.cpp
index c165354c7b..89e75f774e 100644
--- a/modules/raycast/raycast_occlusion_cull.cpp
+++ b/modules/raycast/raycast_occlusion_cull.cpp
@@ -223,9 +223,9 @@ void RaycastOcclusionCull::occluder_set_mesh(RID p_occluder, const PackedVector3
occluder->vertices = p_vertices;
occluder->indices = p_indices;
- for (RBSet<InstanceID>::Element *E = occluder->users.front(); E; E = E->next()) {
- RID scenario_rid = E->get().scenario;
- RID instance_rid = E->get().instance;
+ for (const InstanceID &E : occluder->users) {
+ RID scenario_rid = E.scenario;
+ RID instance_rid = E.instance;
ERR_CONTINUE(!scenarios.has(scenario_rid));
Scenario &scenario = scenarios[scenario_rid];
ERR_CONTINUE(!scenario.instances.has(instance_rid));
diff --git a/modules/raycast/static_raycaster.cpp b/modules/raycast/static_raycaster.cpp
index f2e944a82d..5d2dedf1a4 100644
--- a/modules/raycast/static_raycaster.cpp
+++ b/modules/raycast/static_raycaster.cpp
@@ -95,16 +95,16 @@ void StaticRaycasterEmbree::commit() {
}
void StaticRaycasterEmbree::set_mesh_filter(const RBSet<int> &p_mesh_ids) {
- for (RBSet<int>::Element *E = p_mesh_ids.front(); E; E = E->next()) {
- rtcDisableGeometry(rtcGetGeometry(embree_scene, E->get()));
+ for (const int &E : p_mesh_ids) {
+ rtcDisableGeometry(rtcGetGeometry(embree_scene, E));
}
rtcCommitScene(embree_scene);
filter_meshes = p_mesh_ids;
}
void StaticRaycasterEmbree::clear_mesh_filter() {
- for (RBSet<int>::Element *E = filter_meshes.front(); E; E = E->next()) {
- rtcEnableGeometry(rtcGetGeometry(embree_scene, E->get()));
+ for (const int &E : filter_meshes) {
+ rtcEnableGeometry(rtcGetGeometry(embree_scene, E));
}
rtcCommitScene(embree_scene);
filter_meshes.clear();
diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp
index 4847b24f61..012e0229f3 100644
--- a/modules/visual_script/editor/visual_script_editor.cpp
+++ b/modules/visual_script/editor/visual_script_editor.cpp
@@ -1625,8 +1625,8 @@ void VisualScriptEditor::_remove_output_port(int p_id, int p_port) {
undo_redo->add_do_method(this, "_update_graph", p_id);
for (const KeyValue<int, RBSet<int>> &E : conn_map) {
- for (const RBSet<int>::Element *F = E.value.front(); F; F = F->next()) {
- undo_redo->add_undo_method(script.ptr(), "data_connect", p_id, p_port, E.key, F->get());
+ for (const int &F : E.value) {
+ undo_redo->add_undo_method(script.ptr(), "data_connect", p_id, p_port, E.key, F);
}
}
@@ -1813,14 +1813,14 @@ void VisualScriptEditor::_on_nodes_paste() {
undo_redo->add_undo_method(script.ptr(), "remove_node", new_id);
}
- for (RBSet<VisualScript::SequenceConnection>::Element *E = clipboard->sequence_connections.front(); E; E = E->next()) {
- undo_redo->add_do_method(script.ptr(), "sequence_connect", remap[E->get().from_node], E->get().from_output, remap[E->get().to_node]);
- undo_redo->add_undo_method(script.ptr(), "sequence_disconnect", remap[E->get().from_node], E->get().from_output, remap[E->get().to_node]);
+ for (const VisualScript::SequenceConnection &E : clipboard->sequence_connections) {
+ undo_redo->add_do_method(script.ptr(), "sequence_connect", remap[E.from_node], E.from_output, remap[E.to_node]);
+ undo_redo->add_undo_method(script.ptr(), "sequence_disconnect", remap[E.from_node], E.from_output, remap[E.to_node]);
}
- for (RBSet<VisualScript::DataConnection>::Element *E = clipboard->data_connections.front(); E; E = E->next()) {
- undo_redo->add_do_method(script.ptr(), "data_connect", remap[E->get().from_node], E->get().from_port, remap[E->get().to_node], E->get().to_port);
- undo_redo->add_undo_method(script.ptr(), "data_disconnect", remap[E->get().from_node], E->get().from_port, remap[E->get().to_node], E->get().to_port);
+ for (const VisualScript::DataConnection &E : clipboard->data_connections) {
+ undo_redo->add_do_method(script.ptr(), "data_connect", remap[E.from_node], E.from_port, remap[E.to_node], E.to_port);
+ undo_redo->add_undo_method(script.ptr(), "data_disconnect", remap[E.from_node], E.from_port, remap[E.to_node], E.to_port);
}
undo_redo->add_do_method(this, "_update_graph");
@@ -1910,17 +1910,17 @@ void VisualScriptEditor::_on_nodes_duplicate() {
RBSet<int> to_select;
HashMap<int, int> remap;
- for (RBSet<int>::Element *F = to_duplicate.front(); F; F = F->next()) {
+ for (const int &F : to_duplicate) {
// Duplicate from the specific function but place it into the default func as it would lack the connections.
- Ref<VisualScriptNode> node = script->get_node(F->get());
+ Ref<VisualScriptNode> node = script->get_node(F);
Ref<VisualScriptNode> dupe = node->duplicate(true);
int new_id = idc++;
- remap.insert(F->get(), new_id);
+ remap.insert(F, new_id);
to_select.insert(new_id);
- undo_redo->add_do_method(script.ptr(), "add_node", new_id, dupe, script->get_node_position(F->get()) + Vector2(20, 20));
+ undo_redo->add_do_method(script.ptr(), "add_node", new_id, dupe, script->get_node_position(F) + Vector2(20, 20));
undo_redo->add_undo_method(script.ptr(), "remove_node", new_id);
}
@@ -4201,9 +4201,9 @@ void VisualScriptEditor::_menu_option(int p_what) {
// If we still don't have a start node then,
// run through the nodes and select the first tree node,
// i.e. node without any input sequence but output sequence.
- for (RBSet<int>::Element *E = nodes_from.front(); E; E = E->next()) {
- if (!nodes_to.has(E->get())) {
- start_node = E->get();
+ for (const int &E : nodes_from) {
+ if (!nodes_to.has(E)) {
+ start_node = E;
}
}
}
@@ -4272,13 +4272,13 @@ void VisualScriptEditor::_menu_option(int p_what) {
// Move the nodes.
// Handles reconnection of sequence connections on undo, start here in case of issues.
- for (RBSet<VisualScript::SequenceConnection>::Element *E = seqext.front(); E; E = E->next()) {
- undo_redo->add_do_method(script.ptr(), "sequence_disconnect", E->get().from_node, E->get().from_output, E->get().to_node);
- undo_redo->add_undo_method(script.ptr(), "sequence_connect", E->get().from_node, E->get().from_output, E->get().to_node);
+ for (const VisualScript::SequenceConnection &E : seqext) {
+ undo_redo->add_do_method(script.ptr(), "sequence_disconnect", E.from_node, E.from_output, E.to_node);
+ undo_redo->add_undo_method(script.ptr(), "sequence_connect", E.from_node, E.from_output, E.to_node);
}
- for (RBSet<VisualScript::DataConnection>::Element *E = dataext.front(); E; E = E->next()) {
- undo_redo->add_do_method(script.ptr(), "data_disconnect", E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_undo_method(script.ptr(), "data_connect", E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
+ for (const VisualScript::DataConnection &E : dataext) {
+ undo_redo->add_do_method(script.ptr(), "data_disconnect", E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_undo_method(script.ptr(), "data_connect", E.from_node, E.from_port, E.to_node, E.to_port);
}
// I don't really think we need support for non sequenced functions at this moment.
@@ -4286,24 +4286,24 @@ void VisualScriptEditor::_menu_option(int p_what) {
// Could fail with the new changes, start here when searching for bugs in create function shortcut.
int m = 1;
- for (RBSet<int>::Element *G = end_nodes.front(); G; G = G->next()) {
+ for (const int &G : end_nodes) {
Ref<VisualScriptReturn> ret_node;
ret_node.instantiate();
int ret_id = fn_id + (m++);
selections.insert(ret_id);
- Vector2 posi = _get_available_pos(false, script->get_node_position(G->get()) + Vector2(80, -100));
+ Vector2 posi = _get_available_pos(false, script->get_node_position(G) + Vector2(80, -100));
undo_redo->add_do_method(script.ptr(), "add_node", ret_id, ret_node, posi);
undo_redo->add_undo_method(script.ptr(), "remove_node", ret_id);
- undo_redo->add_do_method(script.ptr(), "sequence_connect", G->get(), 0, ret_id);
+ undo_redo->add_do_method(script.ptr(), "sequence_connect", G, 0, ret_id);
// Add data outputs from each of the end_nodes.
- Ref<VisualScriptNode> vsn = script->get_node(G->get());
+ Ref<VisualScriptNode> vsn = script->get_node(G);
if (vsn.is_valid() && vsn->get_output_value_port_count() > 0) {
ret_node->set_enable_return_value(true);
// Use the zeroth data port cause that's the likely one that is planned to be used.
ret_node->set_return_type(vsn->get_output_value_port_info(0).type);
- undo_redo->add_do_method(script.ptr(), "data_connect", G->get(), 0, ret_id, 0);
+ undo_redo->add_do_method(script.ptr(), "data_connect", G, 0, ret_id, 0);
}
}
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index a287b8e69f..7c15651fa2 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -230,12 +230,12 @@ void VisualScript::_node_ports_changed(int p_id) {
{
List<SequenceConnection> to_remove;
- for (RBSet<SequenceConnection>::Element *E = sequence_connections.front(); E; E = E->next()) {
- if (E->get().from_node == p_id && E->get().from_output >= vsn->get_output_sequence_port_count()) {
- to_remove.push_back(E->get());
+ for (const SequenceConnection &E : sequence_connections) {
+ if (E.from_node == p_id && E.from_output >= vsn->get_output_sequence_port_count()) {
+ to_remove.push_back(E);
}
- if (E->get().to_node == p_id && !vsn->has_input_sequence_port()) {
- to_remove.push_back(E->get());
+ if (E.to_node == p_id && !vsn->has_input_sequence_port()) {
+ to_remove.push_back(E);
}
}
@@ -248,12 +248,12 @@ void VisualScript::_node_ports_changed(int p_id) {
{
List<DataConnection> to_remove;
- for (RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) {
- if (E->get().from_node == p_id && E->get().from_port >= vsn->get_output_value_port_count()) {
- to_remove.push_back(E->get());
+ for (const DataConnection &E : data_connections) {
+ if (E.from_node == p_id && E.from_port >= vsn->get_output_value_port_count()) {
+ to_remove.push_back(E);
}
- if (E->get().to_node == p_id && E->get().to_port >= vsn->get_input_value_port_count()) {
- to_remove.push_back(E->get());
+ if (E.to_node == p_id && E.to_port >= vsn->get_input_value_port_count()) {
+ to_remove.push_back(E);
}
}
@@ -292,9 +292,9 @@ void VisualScript::remove_node(int p_id) {
{
List<SequenceConnection> to_remove;
- for (RBSet<SequenceConnection>::Element *E = sequence_connections.front(); E; E = E->next()) {
- if (E->get().from_node == p_id || E->get().to_node == p_id) {
- to_remove.push_back(E->get());
+ for (const SequenceConnection &E : sequence_connections) {
+ if (E.from_node == p_id || E.to_node == p_id) {
+ to_remove.push_back(E);
}
}
@@ -307,9 +307,9 @@ void VisualScript::remove_node(int p_id) {
{
List<DataConnection> to_remove;
- for (RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) {
- if (E->get().from_node == p_id || E->get().to_node == p_id) {
- to_remove.push_back(E->get());
+ for (const DataConnection &E : data_connections) {
+ if (E.from_node == p_id || E.to_node == p_id) {
+ to_remove.push_back(E);
}
}
@@ -384,8 +384,8 @@ bool VisualScript::has_sequence_connection(int p_from_node, int p_from_output, i
}
void VisualScript::get_sequence_connection_list(List<SequenceConnection> *r_connection) const {
- for (const RBSet<SequenceConnection>::Element *E = sequence_connections.front(); E; E = E->next()) {
- r_connection->push_back(E->get());
+ for (const SequenceConnection &E : sequence_connections) {
+ r_connection->push_back(E);
}
}
@@ -426,8 +426,8 @@ bool VisualScript::has_data_connection(int p_from_node, int p_from_port, int p_t
}
bool VisualScript::is_input_value_port_connected(int p_node, int p_port) const {
- for (const RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) {
- if (E->get().to_node == p_node && E->get().to_port == p_port) {
+ for (const DataConnection &E : data_connections) {
+ if (E.to_node == p_node && E.to_port == p_port) {
return true;
}
}
@@ -435,10 +435,10 @@ bool VisualScript::is_input_value_port_connected(int p_node, int p_port) const {
}
bool VisualScript::get_input_value_port_connection_source(int p_node, int p_port, int *r_node, int *r_port) const {
- for (const RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) {
- if (E->get().to_node == p_node && E->get().to_port == p_port) {
- *r_node = E->get().from_node;
- *r_port = E->get().from_port;
+ for (const DataConnection &E : data_connections) {
+ if (E.to_node == p_node && E.to_port == p_port) {
+ *r_node = E.from_node;
+ *r_port = E.from_port;
return true;
}
}
@@ -446,8 +446,8 @@ bool VisualScript::get_input_value_port_connection_source(int p_node, int p_port
}
void VisualScript::get_data_connection_list(List<DataConnection> *r_connection) const {
- for (const RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) {
- r_connection->push_back(E->get());
+ for (const DataConnection &E : data_connections) {
+ r_connection->push_back(E);
}
}
@@ -764,8 +764,8 @@ void VisualScript::_update_placeholders() {
values[p.name] = variables[E.key].default_value;
}
- for (RBSet<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
- E->get()->update(pinfo, values);
+ for (PlaceHolderScriptInstance *E : placeholders) {
+ E->update(pinfo, values);
}
}
@@ -1078,19 +1078,19 @@ Dictionary VisualScript::_get_data() const {
d["nodes"] = nds;
Array seqconns;
- for (const RBSet<SequenceConnection>::Element *F = sequence_connections.front(); F; F = F->next()) {
- seqconns.push_back(F->get().from_node);
- seqconns.push_back(F->get().from_output);
- seqconns.push_back(F->get().to_node);
+ for (const SequenceConnection &F : sequence_connections) {
+ seqconns.push_back(F.from_node);
+ seqconns.push_back(F.from_output);
+ seqconns.push_back(F.to_node);
}
d["sequence_connections"] = seqconns;
Array dataconns;
- for (const RBSet<DataConnection>::Element *F = data_connections.front(); F; F = F->next()) {
- dataconns.push_back(F->get().from_node);
- dataconns.push_back(F->get().from_port);
- dataconns.push_back(F->get().to_node);
- dataconns.push_back(F->get().to_port);
+ for (const DataConnection &F : data_connections) {
+ dataconns.push_back(F.from_node);
+ dataconns.push_back(F.from_port);
+ dataconns.push_back(F.to_node);
+ dataconns.push_back(F.to_port);
}
d["data_connections"] = dataconns;
@@ -1869,23 +1869,23 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
List<int> nd_queue;
nd_queue.push_back(function.node);
while (!nd_queue.is_empty()) {
- for (const RBSet<VisualScript::SequenceConnection>::Element *F = script->sequence_connections.front(); F; F = F->next()) {
- if (nd_queue.front()->get() == F->get().from_node && !node_ids.has(F->get().to_node)) {
- nd_queue.push_back(F->get().to_node);
- node_ids.insert(F->get().to_node);
+ for (const VisualScript::SequenceConnection &F : script->sequence_connections) {
+ if (nd_queue.front()->get() == F.from_node && !node_ids.has(F.to_node)) {
+ nd_queue.push_back(F.to_node);
+ node_ids.insert(F.to_node);
}
- if (nd_queue.front()->get() == F->get().from_node && !seqconns.has(F->get())) {
- seqconns.insert(F->get());
+ if (nd_queue.front()->get() == F.from_node && !seqconns.has(F)) {
+ seqconns.insert(F);
}
}
nd_queue.pop_front();
}
HashMap<int, HashMap<int, Pair<int, int>>> dc_lut; // :: to -> to_port -> (from, from_port)
- for (const RBSet<VisualScript::DataConnection>::Element *F = script->data_connections.front(); F; F = F->next()) {
- dc_lut[F->get().to_node][F->get().to_port] = Pair<int, int>(F->get().from_node, F->get().from_port);
+ for (const VisualScript::DataConnection &F : script->data_connections) {
+ dc_lut[F.to_node][F.to_port] = Pair<int, int>(F.from_node, F.from_port);
}
- for (const RBSet<int>::Element *F = node_ids.front(); F; F = F->next()) {
- nd_queue.push_back(F->get());
+ for (const int &F : node_ids) {
+ nd_queue.push_back(F);
}
List<int> dc_keys;
while (!nd_queue.is_empty()) {
@@ -1907,15 +1907,15 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
//Multiple passes are required to set up this complex thing..
//First create the nodes.
- for (const RBSet<int>::Element *F = node_ids.front(); F; F = F->next()) {
- Ref<VisualScriptNode> node = script->nodes[F->get()].node;
+ for (const int &F : node_ids) {
+ Ref<VisualScriptNode> node = script->nodes[F].node;
VisualScriptNodeInstance *instance = node->instantiate(this); // Create instance.
ERR_FAIL_COND(!instance);
instance->base = node.ptr();
- instance->id = F->get();
+ instance->id = F;
instance->input_port_count = node->get_input_value_port_count();
instance->input_ports = nullptr;
instance->output_port_count = node->get_output_value_port_count();
@@ -1975,14 +1975,14 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
max_input_args = MAX(max_input_args, instance->input_port_count);
max_output_args = MAX(max_output_args, instance->output_port_count);
- instances[F->get()] = instance;
+ instances[F] = instance;
}
function.trash_pos = function.max_stack++; // create pos for trash
// Second pass, do data connections.
- for (const RBSet<VisualScript::DataConnection>::Element *F = dataconns.front(); F; F = F->next()) {
- VisualScript::DataConnection dc = F->get();
+ for (const VisualScript::DataConnection &F : dataconns) {
+ VisualScript::DataConnection dc = F;
ERR_CONTINUE(!instances.has(dc.from_node));
VisualScriptNodeInstance *from = instances[dc.from_node];
ERR_CONTINUE(!instances.has(dc.to_node));
@@ -2008,8 +2008,8 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
}
// Third pass, do sequence connections.
- for (const RBSet<VisualScript::SequenceConnection>::Element *F = seqconns.front(); F; F = F->next()) {
- VisualScript::SequenceConnection sc = F->get();
+ for (const VisualScript::SequenceConnection &F : seqconns) {
+ VisualScript::SequenceConnection sc = F;
ERR_CONTINUE(!instances.has(sc.from_node));
VisualScriptNodeInstance *from = instances[sc.from_node];
ERR_CONTINUE(!instances.has(sc.to_node));
@@ -2022,11 +2022,11 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
//fourth pass:
// 1) unassigned input ports to default values
// 2) connect unassigned output ports to trash
- for (const RBSet<int>::Element *F = node_ids.front(); F; F = F->next()) {
- ERR_CONTINUE(!instances.has(F->get()));
+ for (const int &F : node_ids) {
+ ERR_CONTINUE(!instances.has(F));
- Ref<VisualScriptNode> node = script->nodes[F->get()].node;
- VisualScriptNodeInstance *instance = instances[F->get()];
+ Ref<VisualScriptNode> node = script->nodes[F].node;
+ VisualScriptNodeInstance *instance = instances[F];
// Connect to default values.
for (int i = 0; i < instance->input_port_count; i++) {
diff --git a/platform/iphone/export/export_plugin.cpp b/platform/iphone/export/export_plugin.cpp
index 5456cee4c5..f28d014c07 100644
--- a/platform/iphone/export/export_plugin.cpp
+++ b/platform/iphone/export/export_plugin.cpp
@@ -1350,8 +1350,8 @@ Error EditorExportPlatformIOS::_export_ios_plugins(const Ref<EditorExportPreset>
// Update Linker Flag Values
{
String result_linker_flags = " ";
- for (RBSet<String>::Element *E = plugin_linker_flags.front(); E; E = E->next()) {
- const String &flag = E->get();
+ for (const String &E : plugin_linker_flags) {
+ const String &flag = E;
if (flag.length() == 0) {
continue;
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 19c341c1e1..c4b923ff34 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -810,8 +810,8 @@ void TileMap::_update_dirty_quadrants() {
for (SelfList<TileMapQuadrant> *q = dirty_quadrant_list.first(); q; q = q->next()) {
q->self()->map_to_world.clear();
q->self()->world_to_map.clear();
- for (RBSet<Vector2i>::Element *E = q->self()->cells.front(); E; E = E->next()) {
- Vector2i pk = E->get();
+ for (const Vector2i &E : q->self()->cells) {
+ Vector2i pk = E;
Vector2i pk_world_coords = map_to_world(pk);
q->self()->map_to_world[pk] = pk_world_coords;
q->self()->world_to_map[pk_world_coords] = pk;
@@ -1250,8 +1250,8 @@ void TileMap::_rendering_draw_quadrant_debug(TileMapQuadrant *p_quadrant) {
// Draw a placeholder for scenes needing one.
RenderingServer *rs = RenderingServer::get_singleton();
Vector2 quadrant_pos = map_to_world(p_quadrant->coords * get_effective_quadrant_size(p_quadrant->layer));
- for (RBSet<Vector2i>::Element *E_cell = p_quadrant->cells.front(); E_cell; E_cell = E_cell->next()) {
- const TileMapCell &c = get_cell(p_quadrant->layer, E_cell->get(), true);
+ for (const Vector2i &E_cell : p_quadrant->cells) {
+ const TileMapCell &c = get_cell(p_quadrant->layer, E_cell, true);
TileSetSource *source;
if (tile_set->has_source(c.source_id)) {
@@ -1281,7 +1281,7 @@ void TileMap::_rendering_draw_quadrant_debug(TileMapQuadrant *p_quadrant) {
// Draw a placeholder tile.
Transform2D xform;
- xform.set_origin(map_to_world(E_cell->get()) - quadrant_pos);
+ xform.set_origin(map_to_world(E_cell) - quadrant_pos);
rs->canvas_item_add_set_transform(p_quadrant->debug_canvas_item, xform);
rs->canvas_item_add_circle(p_quadrant->debug_canvas_item, Vector2(), MIN(tile_set->get_tile_size().x, tile_set->get_tile_size().y) / 4.0, color);
}
@@ -1464,8 +1464,8 @@ void TileMap::_physics_update_dirty_quadrants(SelfList<TileMapQuadrant>::List &r
q.bodies.clear();
// Recreate bodies and shapes.
- for (RBSet<Vector2i>::Element *E_cell = q.cells.front(); E_cell; E_cell = E_cell->next()) {
- TileMapCell c = get_cell(q.layer, E_cell->get(), true);
+ for (const Vector2i &E_cell : q.cells) {
+ TileMapCell c = get_cell(q.layer, E_cell, true);
TileSetSource *source;
if (tile_set->has_source(c.source_id)) {
@@ -1478,8 +1478,8 @@ void TileMap::_physics_update_dirty_quadrants(SelfList<TileMapQuadrant>::List &r
TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
if (atlas_source) {
const TileData *tile_data;
- if (q.runtime_tile_data_cache.has(E_cell->get())) {
- tile_data = q.runtime_tile_data_cache[E_cell->get()];
+ if (q.runtime_tile_data_cache.has(E_cell)) {
+ tile_data = q.runtime_tile_data_cache[E_cell];
} else {
tile_data = atlas_source->get_tile_data(c.get_atlas_coords(), c.alternative_tile);
}
@@ -1490,12 +1490,12 @@ void TileMap::_physics_update_dirty_quadrants(SelfList<TileMapQuadrant>::List &r
// Create the body.
RID body = ps->body_create();
- bodies_coords[body] = E_cell->get();
+ bodies_coords[body] = E_cell;
ps->body_set_mode(body, collision_animatable ? PhysicsServer2D::BODY_MODE_KINEMATIC : PhysicsServer2D::BODY_MODE_STATIC);
ps->body_set_space(body, space);
Transform2D xform;
- xform.set_origin(map_to_world(E_cell->get()));
+ xform.set_origin(map_to_world(E_cell));
xform = global_transform * xform;
ps->body_set_state(body, PhysicsServer2D::BODY_STATE_TRANSFORM, xform);
@@ -1661,8 +1661,8 @@ void TileMap::_navigation_update_dirty_quadrants(SelfList<TileMapQuadrant>::List
q.navigation_regions.clear();
// Get the navigation polygons and create regions.
- for (RBSet<Vector2i>::Element *E_cell = q.cells.front(); E_cell; E_cell = E_cell->next()) {
- TileMapCell c = get_cell(q.layer, E_cell->get(), true);
+ for (const Vector2i &E_cell : q.cells) {
+ TileMapCell c = get_cell(q.layer, E_cell, true);
TileSetSource *source;
if (tile_set->has_source(c.source_id)) {
@@ -1675,12 +1675,12 @@ void TileMap::_navigation_update_dirty_quadrants(SelfList<TileMapQuadrant>::List
TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
if (atlas_source) {
const TileData *tile_data;
- if (q.runtime_tile_data_cache.has(E_cell->get())) {
- tile_data = q.runtime_tile_data_cache[E_cell->get()];
+ if (q.runtime_tile_data_cache.has(E_cell)) {
+ tile_data = q.runtime_tile_data_cache[E_cell];
} else {
tile_data = atlas_source->get_tile_data(c.get_atlas_coords(), c.alternative_tile);
}
- q.navigation_regions[E_cell->get()].resize(tile_set->get_navigation_layers_count());
+ q.navigation_regions[E_cell].resize(tile_set->get_navigation_layers_count());
for (int layer_index = 0; layer_index < tile_set->get_navigation_layers_count(); layer_index++) {
Ref<NavigationPolygon> navpoly;
@@ -1688,13 +1688,13 @@ void TileMap::_navigation_update_dirty_quadrants(SelfList<TileMapQuadrant>::List
if (navpoly.is_valid()) {
Transform2D tile_transform;
- tile_transform.set_origin(map_to_world(E_cell->get()));
+ tile_transform.set_origin(map_to_world(E_cell));
RID region = NavigationServer2D::get_singleton()->region_create();
NavigationServer2D::get_singleton()->region_set_map(region, get_world_2d()->get_navigation_map());
NavigationServer2D::get_singleton()->region_set_transform(region, tilemap_xform * tile_transform);
NavigationServer2D::get_singleton()->region_set_navpoly(region, navpoly);
- q.navigation_regions[E_cell->get()].write[layer_index] = region;
+ q.navigation_regions[E_cell].write[layer_index] = region;
}
}
}
@@ -1750,8 +1750,8 @@ void TileMap::_navigation_draw_quadrant_debug(TileMapQuadrant *p_quadrant) {
Vector2 quadrant_pos = map_to_world(p_quadrant->coords * get_effective_quadrant_size(p_quadrant->layer));
- for (RBSet<Vector2i>::Element *E_cell = p_quadrant->cells.front(); E_cell; E_cell = E_cell->next()) {
- TileMapCell c = get_cell(p_quadrant->layer, E_cell->get(), true);
+ for (const Vector2i &E_cell : p_quadrant->cells) {
+ TileMapCell c = get_cell(p_quadrant->layer, E_cell, true);
TileSetSource *source;
if (tile_set->has_source(c.source_id)) {
@@ -1764,14 +1764,14 @@ void TileMap::_navigation_draw_quadrant_debug(TileMapQuadrant *p_quadrant) {
TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
if (atlas_source) {
const TileData *tile_data;
- if (p_quadrant->runtime_tile_data_cache.has(E_cell->get())) {
- tile_data = p_quadrant->runtime_tile_data_cache[E_cell->get()];
+ if (p_quadrant->runtime_tile_data_cache.has(E_cell)) {
+ tile_data = p_quadrant->runtime_tile_data_cache[E_cell];
} else {
tile_data = atlas_source->get_tile_data(c.get_atlas_coords(), c.alternative_tile);
}
Transform2D xform;
- xform.set_origin(map_to_world(E_cell->get()) - quadrant_pos);
+ xform.set_origin(map_to_world(E_cell) - quadrant_pos);
rs->canvas_item_add_set_transform(p_quadrant->debug_canvas_item, xform);
for (int layer_index = 0; layer_index < tile_set->get_navigation_layers_count(); layer_index++) {
@@ -1825,8 +1825,8 @@ void TileMap::_scenes_update_dirty_quadrants(SelfList<TileMapQuadrant>::List &r_
q.scenes.clear();
// Recreate the scenes.
- for (RBSet<Vector2i>::Element *E_cell = q.cells.front(); E_cell; E_cell = E_cell->next()) {
- const TileMapCell &c = get_cell(q.layer, E_cell->get(), true);
+ for (const Vector2i &E_cell : q.cells) {
+ const TileMapCell &c = get_cell(q.layer, E_cell, true);
TileSetSource *source;
if (tile_set->has_source(c.source_id)) {
@@ -1845,13 +1845,13 @@ void TileMap::_scenes_update_dirty_quadrants(SelfList<TileMapQuadrant>::List &r_
Control *scene_as_control = Object::cast_to<Control>(scene);
Node2D *scene_as_node2d = Object::cast_to<Node2D>(scene);
if (scene_as_control) {
- scene_as_control->set_position(map_to_world(E_cell->get()) + scene_as_control->get_position());
+ scene_as_control->set_position(map_to_world(E_cell) + scene_as_control->get_position());
} else if (scene_as_node2d) {
Transform2D xform;
- xform.set_origin(map_to_world(E_cell->get()));
+ xform.set_origin(map_to_world(E_cell));
scene_as_node2d->set_transform(xform * scene_as_node2d->get_transform());
}
- q.scenes[E_cell->get()] = scene->get_name();
+ q.scenes[E_cell] = scene->get_name();
}
}
}
@@ -1883,8 +1883,8 @@ void TileMap::_scenes_draw_quadrant_debug(TileMapQuadrant *p_quadrant) {
// Draw a placeholder for scenes needing one.
RenderingServer *rs = RenderingServer::get_singleton();
Vector2 quadrant_pos = map_to_world(p_quadrant->coords * get_effective_quadrant_size(p_quadrant->layer));
- for (RBSet<Vector2i>::Element *E_cell = p_quadrant->cells.front(); E_cell; E_cell = E_cell->next()) {
- const TileMapCell &c = get_cell(p_quadrant->layer, E_cell->get(), true);
+ for (const Vector2i &E_cell : p_quadrant->cells) {
+ const TileMapCell &c = get_cell(p_quadrant->layer, E_cell, true);
TileSetSource *source;
if (tile_set->has_source(c.source_id)) {
@@ -1912,7 +1912,7 @@ void TileMap::_scenes_draw_quadrant_debug(TileMapQuadrant *p_quadrant) {
// Draw a placeholder tile.
Transform2D xform;
- xform.set_origin(map_to_world(E_cell->get()) - quadrant_pos);
+ xform.set_origin(map_to_world(E_cell) - quadrant_pos);
rs->canvas_item_add_set_transform(p_quadrant->debug_canvas_item, xform);
rs->canvas_item_add_circle(p_quadrant->debug_canvas_item, Vector2(), MIN(tile_set->get_tile_size().x, tile_set->get_tile_size().y) / 4.0, color);
}
@@ -2189,19 +2189,19 @@ RBSet<TileMap::TerrainConstraint> TileMap::get_terrain_constraints_from_removed_
// Build a set of dummy constraints get the constrained points.
RBSet<TerrainConstraint> dummy_constraints;
- for (RBSet<Vector2i>::Element *E = p_to_replace.front(); E; E = E->next()) {
+ for (const Vector2i &E : p_to_replace) {
for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { // Iterates over sides.
TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
if (tile_set->is_valid_peering_bit_terrain(p_terrain_set, bit)) {
- dummy_constraints.insert(TerrainConstraint(this, E->get(), bit, -1));
+ dummy_constraints.insert(TerrainConstraint(this, E, bit, -1));
}
}
}
// For each constrained point, we get all overlapping tiles, and select the most adequate terrain for it.
RBSet<TerrainConstraint> constraints;
- for (RBSet<TerrainConstraint>::Element *E = dummy_constraints.front(); E; E = E->next()) {
- TerrainConstraint c = E->get();
+ for (const TerrainConstraint &E : dummy_constraints) {
+ TerrainConstraint c = E;
HashMap<int, int> terrain_count;
@@ -2348,8 +2348,8 @@ HashMap<Vector2i, TileSet::TerrainsPattern> TileMap::terrain_wave_function_colla
// Add the new constraints from the added tiles.
RBSet<TerrainConstraint> new_constraints = get_terrain_constraints_from_added_tile(selected_cell_to_replace, p_terrain_set, selected_terrain_tile_pattern);
- for (RBSet<TerrainConstraint>::Element *E_constraint = new_constraints.front(); E_constraint; E_constraint = E_constraint->next()) {
- constraints.insert(E_constraint->get());
+ for (const TerrainConstraint &E_constraint : new_constraints) {
+ constraints.insert(E_constraint);
}
// Compute valid tiles again for neighbors.
@@ -2425,8 +2425,8 @@ void TileMap::fix_invalid_tiles() {
coords.insert(E.key);
}
}
- for (RBSet<Vector2i>::Element *E = coords.front(); E; E = E->next()) {
- set_cell(i, E->get(), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
+ for (const Vector2i &E : coords) {
+ set_cell(i, E, TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
}
}
}
@@ -3524,11 +3524,11 @@ void TileMap::draw_cells_outline(Control *p_control, RBSet<Vector2i> p_cells, Co
Vector<Vector2> polygon = tile_set->get_tile_shape_polygon();
TileSet::TileShape shape = tile_set->get_tile_shape();
- for (RBSet<Vector2i>::Element *E = p_cells.front(); E; E = E->next()) {
- Vector2 center = map_to_world(E->get());
+ for (const Vector2i &E : p_cells) {
+ Vector2 center = map_to_world(E);
#define DRAW_SIDE_IF_NEEDED(side, polygon_index_from, polygon_index_to) \
- if (!p_cells.has(get_neighbor_cell(E->get(), side))) { \
+ if (!p_cells.has(get_neighbor_cell(E, side))) { \
Vector2 from = p_transform.xform(center + polygon[polygon_index_from] * tile_size); \
Vector2 to = p_transform.xform(center + polygon[polygon_index_to] * tile_size); \
p_control->draw_line(from, to, p_color); \
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp
index 70cab77eda..a36357555a 100644
--- a/scene/3d/collision_object_3d.cpp
+++ b/scene/3d/collision_object_3d.cpp
@@ -345,9 +345,9 @@ void CollisionObject3D::_update_debug_shapes() {
return;
}
- for (RBSet<uint32_t>::Element *shapedata_idx = debug_shapes_to_update.front(); shapedata_idx; shapedata_idx = shapedata_idx->next()) {
- if (shapes.has(shapedata_idx->get())) {
- ShapeData &shapedata = shapes[shapedata_idx->get()];
+ for (const uint32_t &shapedata_idx : debug_shapes_to_update) {
+ if (shapes.has(shapedata_idx)) {
+ ShapeData &shapedata = shapes[shapedata_idx];
ShapeData::ShapeBase *shapes = shapedata.shapes.ptrw();
for (int i = 0; i < shapedata.shapes.size(); i++) {
ShapeData::ShapeBase &s = shapes[i];
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index 3f2fb89548..ba2029788e 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -263,19 +263,19 @@ void Skeleton3D::_notification(int p_what) {
force_update_all_bone_transforms();
// Update skins.
- for (RBSet<SkinReference *>::Element *E = skin_bindings.front(); E; E = E->next()) {
- const Skin *skin = E->get()->skin.operator->();
- RID skeleton = E->get()->skeleton;
+ for (SkinReference *E : skin_bindings) {
+ const Skin *skin = E->skin.operator->();
+ RID skeleton = E->skeleton;
uint32_t bind_count = skin->get_bind_count();
- if (E->get()->bind_count != bind_count) {
+ if (E->bind_count != bind_count) {
RS::get_singleton()->skeleton_allocate_data(skeleton, bind_count);
- E->get()->bind_count = bind_count;
- E->get()->skin_bone_indices.resize(bind_count);
- E->get()->skin_bone_indices_ptrs = E->get()->skin_bone_indices.ptrw();
+ E->bind_count = bind_count;
+ E->skin_bone_indices.resize(bind_count);
+ E->skin_bone_indices_ptrs = E->skin_bone_indices.ptrw();
}
- if (E->get()->skeleton_version != version) {
+ if (E->skeleton_version != version) {
for (uint32_t i = 0; i < bind_count; i++) {
StringName bind_name = skin->get_bind_name(i);
@@ -284,7 +284,7 @@ void Skeleton3D::_notification(int p_what) {
bool found = false;
for (int j = 0; j < len; j++) {
if (bonesptr[j].name == bind_name) {
- E->get()->skin_bone_indices_ptrs[i] = j;
+ E->skin_bone_indices_ptrs[i] = j;
found = true;
break;
}
@@ -292,27 +292,27 @@ void Skeleton3D::_notification(int p_what) {
if (!found) {
ERR_PRINT("Skin bind #" + itos(i) + " contains named bind '" + String(bind_name) + "' but Skeleton3D has no bone by that name.");
- E->get()->skin_bone_indices_ptrs[i] = 0;
+ E->skin_bone_indices_ptrs[i] = 0;
}
} else if (skin->get_bind_bone(i) >= 0) {
int bind_index = skin->get_bind_bone(i);
if (bind_index >= len) {
ERR_PRINT("Skin bind #" + itos(i) + " contains bone index bind: " + itos(bind_index) + " , which is greater than the skeleton bone count: " + itos(len) + ".");
- E->get()->skin_bone_indices_ptrs[i] = 0;
+ E->skin_bone_indices_ptrs[i] = 0;
} else {
- E->get()->skin_bone_indices_ptrs[i] = bind_index;
+ E->skin_bone_indices_ptrs[i] = bind_index;
}
} else {
ERR_PRINT("Skin bind #" + itos(i) + " does not contain a name nor a bone index.");
- E->get()->skin_bone_indices_ptrs[i] = 0;
+ E->skin_bone_indices_ptrs[i] = 0;
}
}
- E->get()->skeleton_version = version;
+ E->skeleton_version = version;
}
for (uint32_t i = 0; i < bind_count; i++) {
- uint32_t bone_index = E->get()->skin_bone_indices_ptrs[i];
+ uint32_t bone_index = E->skin_bone_indices_ptrs[i];
ERR_CONTINUE(bone_index >= (uint32_t)len);
rs->skeleton_bone_set_transform(skeleton, i, bonesptr[bone_index].pose_global * skin->get_bind_pose(i));
}
@@ -1000,9 +1000,9 @@ Ref<Skin> Skeleton3D::create_skin_from_rest_transforms() {
Ref<SkinReference> Skeleton3D::register_skin(const Ref<Skin> &p_skin) {
ERR_FAIL_COND_V(p_skin.is_null(), Ref<SkinReference>());
- for (RBSet<SkinReference *>::Element *E = skin_bindings.front(); E; E = E->next()) {
- if (E->get()->skin == p_skin) {
- return Ref<SkinReference>(E->get());
+ for (const SkinReference *E : skin_bindings) {
+ if (E->skin == p_skin) {
+ return Ref<SkinReference>(E);
}
}
@@ -1303,7 +1303,7 @@ Skeleton3D::Skeleton3D() {
Skeleton3D::~Skeleton3D() {
// Some skins may remain bound.
- for (RBSet<SkinReference *>::Element *E = skin_bindings.front(); E; E = E->next()) {
- E->get()->skeleton_node = nullptr;
+ for (SkinReference *E : skin_bindings) {
+ E->skeleton_node = nullptr;
}
}
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 87bfb64917..921a06b73c 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1766,12 +1766,12 @@ void AnimationPlayer::_animation_changed() {
}
void AnimationPlayer::_stop_playing_caches() {
- for (RBSet<TrackNodeCache *>::Element *E = playing_caches.front(); E; E = E->next()) {
- if (E->get()->node && E->get()->audio_playing) {
- E->get()->node->call(SNAME("stop"));
+ for (TrackNodeCache *E : playing_caches) {
+ if (E->node && E->audio_playing) {
+ E->node->call(SNAME("stop"));
}
- if (E->get()->node && E->get()->animation_playing) {
- AnimationPlayer *player = Object::cast_to<AnimationPlayer>(E->get()->node);
+ if (E->node && E->animation_playing) {
+ AnimationPlayer *player = Object::cast_to<AnimationPlayer>(E->node);
if (!player) {
continue;
}
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 127eeed06f..d34e8db093 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -487,9 +487,9 @@ void AnimationTree::set_active(bool p_active) {
}
if (!active && is_inside_tree()) {
- for (RBSet<TrackCache *>::Element *E = playing_caches.front(); E; E = E->next()) {
- if (ObjectDB::get_instance(E->get()->object_id)) {
- E->get()->object->call(SNAME("stop"));
+ for (const TrackCache *E : playing_caches) {
+ if (ObjectDB::get_instance(E->object_id)) {
+ E->object->call(SNAME("stop"));
}
}
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp
index b792b11dbc..dfad91ecd5 100644
--- a/scene/debugger/scene_debugger.cpp
+++ b/scene/debugger/scene_debugger.cpp
@@ -436,11 +436,11 @@ void SceneDebuggerObject::_parse_script_properties(Script *p_script, ScriptInsta
// Members
for (KeyValue<const Script *, RBSet<StringName>> sm : members) {
- for (RBSet<StringName>::Element *E = sm.value.front(); E; E = E->next()) {
+ for (const StringName &E : sm.value) {
Variant m;
- if (p_instance->get(E->get(), m)) {
+ if (p_instance->get(E, m)) {
String script_path = sm.key == p_script ? "" : sm.key->get_path().get_file() + "/";
- PropertyInfo pi(m.get_type(), "Members/" + script_path + E->get());
+ PropertyInfo pi(m.get_type(), "Members/" + script_path + E);
properties.push_back(SceneDebuggerProperty(pi, m));
}
}
@@ -629,8 +629,8 @@ void LiveEditor::_node_set_func(int p_id, const StringName &p_prop, const Varian
return; //scene not editable
}
- for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -673,8 +673,8 @@ void LiveEditor::_node_call_func(int p_id, const StringName &p_method, const Var
return; //scene not editable
}
- for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -758,8 +758,8 @@ void LiveEditor::_create_node_func(const NodePath &p_parent, const String &p_typ
return; //scene not editable
}
- for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -802,8 +802,8 @@ void LiveEditor::_instance_node_func(const NodePath &p_parent, const String &p_p
return; //scene not editable
}
- for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -968,8 +968,8 @@ void LiveEditor::_duplicate_node_func(const NodePath &p_at, const String &p_new_
return; //scene not editable
}
- for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -1007,8 +1007,8 @@ void LiveEditor::_reparent_node_func(const NodePath &p_at, const NodePath &p_new
return; //scene not editable
}
- for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 595f0cbea7..776623f7ce 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -43,12 +43,12 @@ void BaseButton::_unpress_group() {
status.pressed = true;
}
- for (RBSet<BaseButton *>::Element *E = button_group->buttons.front(); E; E = E->next()) {
- if (E->get() == this) {
+ for (BaseButton *E : button_group->buttons) {
+ if (E == this) {
continue;
}
- E->get()->set_pressed(false);
+ E->set_pressed(false);
}
}
@@ -485,24 +485,24 @@ BaseButton::~BaseButton() {
}
void ButtonGroup::get_buttons(List<BaseButton *> *r_buttons) {
- for (RBSet<BaseButton *>::Element *E = buttons.front(); E; E = E->next()) {
- r_buttons->push_back(E->get());
+ for (BaseButton *E : buttons) {
+ r_buttons->push_back(E);
}
}
Array ButtonGroup::_get_buttons() {
Array btns;
- for (RBSet<BaseButton *>::Element *E = buttons.front(); E; E = E->next()) {
- btns.push_back(E->get());
+ for (const BaseButton *E : buttons) {
+ btns.push_back(E);
}
return btns;
}
BaseButton *ButtonGroup::get_pressed_button() {
- for (RBSet<BaseButton *>::Element *E = buttons.front(); E; E = E->next()) {
- if (E->get()->is_pressed()) {
- return E->get();
+ for (BaseButton *E : buttons) {
+ if (E->is_pressed()) {
+ return E;
}
}
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 197c9005c3..22e9763929 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -740,8 +740,8 @@ void CodeEdit::set_auto_indent_prefixes(const TypedArray<String> &p_prefixes) {
TypedArray<String> CodeEdit::get_auto_indent_prefixes() const {
TypedArray<String> prefixes;
- for (const RBSet<char32_t>::Element *E = auto_indent_prefixes.front(); E; E = E->next()) {
- prefixes.push_back(String::chr(E->get()));
+ for (const char32_t &E : auto_indent_prefixes) {
+ prefixes.push_back(String::chr(E));
}
return prefixes;
}
@@ -1752,8 +1752,8 @@ void CodeEdit::set_code_completion_prefixes(const TypedArray<String> &p_prefixes
TypedArray<String> CodeEdit::get_code_completion_prefixes() const {
TypedArray<String> prefixes;
- for (const RBSet<char32_t>::Element *E = code_completion_prefixes.front(); E; E = E->next()) {
- prefixes.push_back(String::chr(E->get()));
+ for (const char32_t &E : code_completion_prefixes) {
+ prefixes.push_back(String::chr(E));
}
return prefixes;
}
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 0ed9a4e989..ccf7e2828a 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -1699,8 +1699,8 @@ void GraphEdit::set_warped_panning(bool p_warped) {
int GraphEdit::_set_operations(SET_OPERATIONS p_operation, RBSet<StringName> &r_u, const RBSet<StringName> &r_v) {
switch (p_operation) {
case GraphEdit::IS_EQUAL: {
- for (RBSet<StringName>::Element *E = r_u.front(); E; E = E->next()) {
- if (!r_v.has(E->get())) {
+ for (const StringName &E : r_u) {
+ if (!r_v.has(E)) {
return 0;
}
}
@@ -1710,8 +1710,8 @@ int GraphEdit::_set_operations(SET_OPERATIONS p_operation, RBSet<StringName> &r_
if (r_u.size() == r_v.size() && !r_u.size()) {
return 1;
}
- for (RBSet<StringName>::Element *E = r_u.front(); E; E = E->next()) {
- if (!r_v.has(E->get())) {
+ for (const StringName &E : r_u) {
+ if (!r_v.has(E)) {
return 0;
}
}
@@ -1726,9 +1726,9 @@ int GraphEdit::_set_operations(SET_OPERATIONS p_operation, RBSet<StringName> &r_
return r_u.size();
} break;
case GraphEdit::UNION: {
- for (RBSet<StringName>::Element *E = r_v.front(); E; E = E->next()) {
- if (!r_u.has(E->get())) {
- r_u.insert(E->get());
+ for (const StringName &E : r_v) {
+ if (!r_u.has(E)) {
+ r_u.insert(E);
}
}
return r_u.size();
@@ -1748,11 +1748,11 @@ HashMap<int, Vector<StringName>> GraphEdit::_layering(const RBSet<StringName> &r
while (!_set_operations(GraphEdit::IS_EQUAL, q, u)) {
_set_operations(GraphEdit::DIFFERENCE, p, u);
- for (const RBSet<StringName>::Element *E = p.front(); E; E = E->next()) {
- RBSet<StringName> n = r_upper_neighbours[E->get()];
+ for (const StringName &E : p) {
+ RBSet<StringName> n = r_upper_neighbours[E];
if (_set_operations(GraphEdit::IS_SUBSET, n, z)) {
Vector<StringName> t;
- t.push_back(E->get());
+ t.push_back(E);
if (!l.has(current_layer)) {
l.insert(current_layer, Vector<StringName>{});
}
@@ -1760,7 +1760,7 @@ HashMap<int, Vector<StringName>> GraphEdit::_layering(const RBSet<StringName> &r
t.append_array(l[current_layer]);
l.insert(current_layer, t);
RBSet<StringName> V;
- V.insert(E->get());
+ V.insert(E);
_set_operations(GraphEdit::UNION, u, V);
}
}
@@ -1802,9 +1802,9 @@ Vector<StringName> GraphEdit::_split(const Vector<StringName> &r_layer, const Ha
}
void GraphEdit::_horizontal_alignment(Dictionary &r_root, Dictionary &r_align, const HashMap<int, Vector<StringName>> &r_layers, const HashMap<StringName, RBSet<StringName>> &r_upper_neighbours, const RBSet<StringName> &r_selected_nodes) {
- for (const RBSet<StringName>::Element *E = r_selected_nodes.front(); E; E = E->next()) {
- r_root[E->get()] = E->get();
- r_align[E->get()] = E->get();
+ for (const StringName &E : r_selected_nodes) {
+ r_root[E] = E;
+ r_align[E] = E;
}
if (r_layers.size() == 1) {
@@ -1880,9 +1880,9 @@ void GraphEdit::_crossing_minimisation(HashMap<int, Vector<StringName>> &r_layer
}
void GraphEdit::_calculate_inner_shifts(Dictionary &r_inner_shifts, const Dictionary &r_root, const Dictionary &r_node_names, const Dictionary &r_align, const RBSet<StringName> &r_block_heads, const HashMap<StringName, Pair<int, int>> &r_port_info) {
- for (const RBSet<StringName>::Element *E = r_block_heads.front(); E; E = E->next()) {
+ for (const StringName &E : r_block_heads) {
real_t left = 0;
- StringName u = E->get();
+ StringName u = E;
StringName v = r_align[u];
while (u != v && (StringName)r_root[u] != v) {
String _connection = String(u) + " " + String(v);
@@ -1903,11 +1903,11 @@ void GraphEdit::_calculate_inner_shifts(Dictionary &r_inner_shifts, const Dictio
v = (StringName)r_align[v];
}
- u = E->get();
+ u = E;
do {
r_inner_shifts[u] = (real_t)r_inner_shifts[u] - left;
u = (StringName)r_align[u];
- } while (u != E->get());
+ } while (u != E);
}
}
@@ -2117,33 +2117,33 @@ void GraphEdit::arrange_nodes() {
Dictionary inner_shift;
RBSet<StringName> block_heads;
- for (const RBSet<StringName>::Element *E = selected_nodes.front(); E; E = E->next()) {
- inner_shift[E->get()] = 0.0f;
- sink[E->get()] = E->get();
- shift[E->get()] = FLT_MAX;
- new_positions.insert(E->get(), default_position);
- if ((StringName)root[E->get()] == E->get()) {
- block_heads.insert(E->get());
+ for (const StringName &E : selected_nodes) {
+ inner_shift[E] = 0.0f;
+ sink[E] = E;
+ shift[E] = FLT_MAX;
+ new_positions.insert(E, default_position);
+ if ((StringName)root[E] == E) {
+ block_heads.insert(E);
}
}
_calculate_inner_shifts(inner_shift, root, node_names, align, block_heads, port_info);
- for (const RBSet<StringName>::Element *E = block_heads.front(); E; E = E->next()) {
- _place_block(E->get(), gap_v, layers, root, align, node_names, inner_shift, sink, shift, new_positions);
+ for (const StringName &E : block_heads) {
+ _place_block(E, gap_v, layers, root, align, node_names, inner_shift, sink, shift, new_positions);
}
origin.y = Object::cast_to<GraphNode>(node_names[layers[0][0]])->get_position_offset().y - (new_positions[layers[0][0]].y + (float)inner_shift[layers[0][0]]);
origin.x = Object::cast_to<GraphNode>(node_names[layers[0][0]])->get_position_offset().x;
- for (const RBSet<StringName>::Element *E = block_heads.front(); E; E = E->next()) {
- StringName u = E->get();
- float start_from = origin.y + new_positions[E->get()].y;
+ for (const StringName &E : block_heads) {
+ StringName u = E;
+ float start_from = origin.y + new_positions[E].y;
do {
Vector2 cal_pos;
cal_pos.y = start_from + (real_t)inner_shift[u];
new_positions.insert(u, cal_pos);
u = align[u];
- } while (u != E->get());
+ } while (u != E);
}
// Compute horizontal coordinates individually for layers to get uniform gap.
@@ -2181,10 +2181,10 @@ void GraphEdit::arrange_nodes() {
}
emit_signal(SNAME("begin_node_move"));
- for (const RBSet<StringName>::Element *E = selected_nodes.front(); E; E = E->next()) {
- GraphNode *gn = Object::cast_to<GraphNode>(node_names[E->get()]);
+ for (const StringName &E : selected_nodes) {
+ GraphNode *gn = Object::cast_to<GraphNode>(node_names[E]);
gn->set_drag(true);
- Vector2 pos = (new_positions[E->get()]);
+ Vector2 pos = (new_positions[E]);
if (is_using_snap()) {
const int snap = get_snap();
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index ec33018da0..5d9484806b 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -104,11 +104,11 @@ void GridContainer::_notification(int p_what) {
// Check if all minwidth constraints are OK if we use the remaining space.
can_fit = true;
int max_index = col_expanded.front()->get();
- for (RBSet<int>::Element *E = col_expanded.front(); E; E = E->next()) {
- if (col_minw[E->get()] > col_minw[max_index]) {
- max_index = E->get();
+ for (const int &E : col_expanded) {
+ if (col_minw[E] > col_minw[max_index]) {
+ max_index = E;
}
- if (can_fit && (remaining_space.width / col_expanded.size()) < col_minw[E->get()]) {
+ if (can_fit && (remaining_space.width / col_expanded.size()) < col_minw[E]) {
can_fit = false;
}
}
@@ -125,11 +125,11 @@ void GridContainer::_notification(int p_what) {
// Check if all minheight constraints are OK if we use the remaining space.
can_fit = true;
int max_index = row_expanded.front()->get();
- for (RBSet<int>::Element *E = row_expanded.front(); E; E = E->next()) {
- if (row_minh[E->get()] > row_minh[max_index]) {
- max_index = E->get();
+ for (const int &E : row_expanded) {
+ if (row_minh[E] > row_minh[max_index]) {
+ max_index = E;
}
- if (can_fit && (remaining_space.height / row_expanded.size()) < row_minh[E->get()]) {
+ if (can_fit && (remaining_space.height / row_expanded.size()) < row_minh[E]) {
can_fit = false;
}
}
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index 73f19a8eda..fae6688452 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -50,8 +50,8 @@ void Range::_value_changed_notify() {
}
void Range::Shared::emit_value_changed() {
- for (RBSet<Range *>::Element *E = owners.front(); E; E = E->next()) {
- Range *r = E->get();
+ for (Range *E : owners) {
+ Range *r = E;
if (!r->is_inside_tree()) {
continue;
}
@@ -70,8 +70,8 @@ void Range::_validate_values() {
}
void Range::Shared::emit_changed(const char *p_what) {
- for (RBSet<Range *>::Element *E = owners.front(); E; E = E->next()) {
- Range *r = E->get();
+ for (Range *E : owners) {
+ Range *r = E;
if (!r->is_inside_tree()) {
continue;
}
diff --git a/scene/main/resource_preloader.cpp b/scene/main/resource_preloader.cpp
index b3595c6227..71e62fe804 100644
--- a/scene/main/resource_preloader.cpp
+++ b/scene/main/resource_preloader.cpp
@@ -62,9 +62,9 @@ Array ResourcePreloader::_get_resources() const {
}
int i = 0;
- for (RBSet<String>::Element *E = sorted_names.front(); E; E = E->next()) {
- names.set(i, E->get());
- arr[i] = resources[E->get()];
+ for (const String &E : sorted_names) {
+ names.set(i, E);
+ arr[i] = resources[E];
i++;
}
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 0be4216e99..590c73de0b 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -412,9 +412,9 @@ void Viewport::_notification(int p_what) {
#ifndef _3D_DISABLED
if (audio_listener_3d_set.size() && !audio_listener_3d) {
AudioListener3D *first = nullptr;
- for (RBSet<AudioListener3D *>::Element *E = audio_listener_3d_set.front(); E; E = E->next()) {
- if (first == nullptr || first->is_greater_than(E->get())) {
- first = E->get();
+ for (AudioListener3D *E : audio_listener_3d_set) {
+ if (first == nullptr || first->is_greater_than(E)) {
+ first = E;
}
}
@@ -426,9 +426,9 @@ void Viewport::_notification(int p_what) {
if (camera_3d_set.size() && !camera_3d) {
// There are cameras but no current camera, pick first in tree and make it current.
Camera3D *first = nullptr;
- for (RBSet<Camera3D *>::Element *E = camera_3d_set.front(); E; E = E->next()) {
- if (first == nullptr || first->is_greater_than(E->get())) {
- first = E->get();
+ for (Camera3D *E : camera_3d_set) {
+ if (first == nullptr || first->is_greater_than(E)) {
+ first = E;
}
}
@@ -647,13 +647,13 @@ void Viewport::_process_picking() {
uint64_t frame = get_tree()->get_frame();
PhysicsDirectSpaceState2D::ShapeResult res[64];
- for (RBSet<CanvasLayer *>::Element *E = canvas_layers.front(); E; E = E->next()) {
+ for (const CanvasLayer *E : canvas_layers) {
Transform2D canvas_transform;
ObjectID canvas_layer_id;
- if (E->get()) {
+ if (E) {
// A descendant CanvasLayer.
- canvas_transform = E->get()->get_transform();
- canvas_layer_id = E->get()->get_instance_id();
+ canvas_transform = E->get_transform();
+ canvas_layer_id = E->get_instance_id();
} else {
// This Viewport's builtin canvas.
canvas_transform = get_canvas_transform();
@@ -3202,18 +3202,18 @@ void Viewport::_audio_listener_3d_remove(AudioListener3D *p_listener) {
void Viewport::_audio_listener_3d_make_next_current(AudioListener3D *p_exclude) {
if (audio_listener_3d_set.size() > 0) {
- for (RBSet<AudioListener3D *>::Element *E = audio_listener_3d_set.front(); E; E = E->next()) {
- if (p_exclude == E->get()) {
+ for (AudioListener3D *E : audio_listener_3d_set) {
+ if (p_exclude == E) {
continue;
}
- if (!E->get()->is_inside_tree()) {
+ if (!E->is_inside_tree()) {
continue;
}
if (audio_listener_3d != nullptr) {
return;
}
- E->get()->make_current();
+ E->make_current();
}
} else {
// Attempt to reset listener to the camera position.
@@ -3290,18 +3290,18 @@ void Viewport::_camera_3d_remove(Camera3D *p_camera) {
}
void Viewport::_camera_3d_make_next_current(Camera3D *p_exclude) {
- for (RBSet<Camera3D *>::Element *E = camera_3d_set.front(); E; E = E->next()) {
- if (p_exclude == E->get()) {
+ for (Camera3D *E : camera_3d_set) {
+ if (p_exclude == E) {
continue;
}
- if (!E->get()->is_inside_tree()) {
+ if (!E->is_inside_tree()) {
continue;
}
if (camera_3d != nullptr) {
return;
}
- E->get()->make_current();
+ E->make_current();
}
}
@@ -3936,8 +3936,8 @@ Viewport::Viewport() {
Viewport::~Viewport() {
// Erase itself from viewport textures.
- for (RBSet<ViewportTexture *>::Element *E = viewport_textures.front(); E; E = E->next()) {
- E->get()->vp = nullptr;
+ for (ViewportTexture *E : viewport_textures) {
+ E->vp = nullptr;
}
RenderingServer::get_singleton()->free(viewport);
}
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index d8264e7d33..193f18c075 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -263,9 +263,9 @@ void Window::_make_window() {
DisplayServer::get_singleton()->window_set_transient(window_id, transient_parent->window_id);
}
- for (RBSet<Window *>::Element *E = transient_children.front(); E; E = E->next()) {
- if (E->get()->window_id != DisplayServer::INVALID_WINDOW_ID) {
- DisplayServer::get_singleton()->window_set_transient(E->get()->window_id, transient_parent->window_id);
+ for (const Window *E : transient_children) {
+ if (E->window_id != DisplayServer::INVALID_WINDOW_ID) {
+ DisplayServer::get_singleton()->window_set_transient(E->window_id, transient_parent->window_id);
}
}
@@ -290,9 +290,9 @@ void Window::_clear_window() {
DisplayServer::get_singleton()->window_set_transient(window_id, DisplayServer::INVALID_WINDOW_ID);
}
- for (RBSet<Window *>::Element *E = transient_children.front(); E; E = E->next()) {
- if (E->get()->window_id != DisplayServer::INVALID_WINDOW_ID) {
- DisplayServer::get_singleton()->window_set_transient(E->get()->window_id, DisplayServer::INVALID_WINDOW_ID);
+ for (const Window *E : transient_children) {
+ if (E->window_id != DisplayServer::INVALID_WINDOW_ID) {
+ DisplayServer::get_singleton()->window_set_transient(E->window_id, DisplayServer::INVALID_WINDOW_ID);
}
}
diff --git a/scene/multiplayer/scene_cache_interface.cpp b/scene/multiplayer/scene_cache_interface.cpp
index a7e84b6bca..7c271341db 100644
--- a/scene/multiplayer/scene_cache_interface.cpp
+++ b/scene/multiplayer/scene_cache_interface.cpp
@@ -214,17 +214,17 @@ bool SceneCacheInterface::send_object_cache(Object *p_obj, NodePath p_path, int
}
} else {
// Long and painful.
- for (const RBSet<int>::Element *E = multiplayer->get_connected_peers().front(); E; E = E->next()) {
- if (p_peer_id < 0 && E->get() == -p_peer_id) {
+ for (const int &E : multiplayer->get_connected_peers()) {
+ if (p_peer_id < 0 && E == -p_peer_id) {
continue; // Continue, excluded.
}
- if (p_peer_id > 0 && E->get() != p_peer_id) {
+ if (p_peer_id > 0 && E != p_peer_id) {
continue; // Continue, not for this peer.
}
- HashMap<int, bool>::Iterator F = psc->confirmed_peers.find(E->get());
+ HashMap<int, bool>::Iterator F = psc->confirmed_peers.find(E);
if (!F) {
- peers_to_add.push_back(E->get()); // Need to also be notified.
+ peers_to_add.push_back(E); // Need to also be notified.
has_all_peers = false;
} else if (!F->value) {
has_all_peers = false;
diff --git a/scene/resources/concave_polygon_shape_3d.cpp b/scene/resources/concave_polygon_shape_3d.cpp
index ab2c1da327..081271c2fc 100644
--- a/scene/resources/concave_polygon_shape_3d.cpp
+++ b/scene/resources/concave_polygon_shape_3d.cpp
@@ -50,9 +50,9 @@ Vector<Vector3> ConcavePolygonShape3D::get_debug_mesh_lines() const {
Vector<Vector3> points;
points.resize(edges.size() * 2);
int idx = 0;
- for (RBSet<DrawEdge>::Element *E = edges.front(); E; E = E->next()) {
- points.write[idx + 0] = E->get().a;
- points.write[idx + 1] = E->get().b;
+ for (const DrawEdge &E : edges) {
+ points.write[idx + 0] = E.a;
+ points.write[idx + 1] = E.b;
idx += 2;
}
diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp
index 155a8522cf..6b0c22d720 100644
--- a/scene/resources/polygon_path_finder.cpp
+++ b/scene/resources/polygon_path_finder.cpp
@@ -34,8 +34,8 @@
bool PolygonPathFinder::_is_point_inside(const Vector2 &p_point) const {
int crosses = 0;
- for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) {
- const Edge &e = E->get();
+ for (const Edge &E : edges) {
+ const Edge &e = E;
Vector2 a = points[e.points[0]].pos;
Vector2 b = points[e.points[1]].pos;
@@ -105,8 +105,8 @@ void PolygonPathFinder::setup(const Vector<Vector2> &p_points, const Vector<int>
bool valid = true;
- for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) {
- const Edge &e = E->get();
+ for (const Edge &E : edges) {
+ const Edge &e = E;
if (e.points[0] == i || e.points[1] == i || e.points[0] == j || e.points[1] == j) {
continue;
}
@@ -140,8 +140,8 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
float closest_dist = 1e20f;
Vector2 closest_point;
- for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) {
- const Edge &e = E->get();
+ for (const Edge &E : edges) {
+ const Edge &e = E;
Vector2 seg[2] = {
points[e.points[0]].pos,
points[e.points[1]].pos
@@ -151,7 +151,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
float d = from.distance_squared_to(closest);
if (d < closest_dist) {
- ignore_from_edge = E->get();
+ ignore_from_edge = E;
closest_dist = d;
closest_point = closest;
}
@@ -164,8 +164,8 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
float closest_dist = 1e20f;
Vector2 closest_point;
- for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) {
- const Edge &e = E->get();
+ for (const Edge &E : edges) {
+ const Edge &e = E;
Vector2 seg[2] = {
points[e.points[0]].pos,
points[e.points[1]].pos
@@ -175,7 +175,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
float d = to.distance_squared_to(closest);
if (d < closest_dist) {
- ignore_to_edge = E->get();
+ ignore_to_edge = E;
closest_dist = d;
closest_point = closest;
}
@@ -188,8 +188,8 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
{
bool can_see_eachother = true;
- for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) {
- const Edge &e = E->get();
+ for (const Edge &E : edges) {
+ const Edge &e = E;
if (e.points[0] == ignore_from_edge.points[0] && e.points[1] == ignore_from_edge.points[1]) {
continue;
}
@@ -240,8 +240,8 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
valid_b = false;
}
- for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) {
- const Edge &e = E->get();
+ for (const Edge &E : edges) {
+ const Edge &e = E;
if (e.points[0] == i || e.points[1] == i) {
continue;
@@ -293,10 +293,10 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
points.write[aidx].distance = 0;
points.write[aidx].prev = aidx;
- for (RBSet<int>::Element *E = points[aidx].connections.front(); E; E = E->next()) {
- open_list.insert(E->get());
- points.write[E->get()].distance = from.distance_to(points[E->get()].pos);
- points.write[E->get()].prev = aidx;
+ for (const int &E : points[aidx].connections) {
+ open_list.insert(E);
+ points.write[E].distance = from.distance_to(points[E].pos);
+ points.write[E].prev = aidx;
}
bool found_route = false;
@@ -312,14 +312,14 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
float least_cost = 1e30;
//this could be faster (cache previous results)
- for (RBSet<int>::Element *E = open_list.front(); E; E = E->next()) {
- const Point &p = points[E->get()];
+ for (const int &E : open_list) {
+ const Point &p = points[E];
float cost = p.distance;
cost += p.pos.distance_to(to);
cost += p.penalty;
if (cost < least_cost) {
- least_cost_point = E->get();
+ least_cost_point = E;
least_cost = cost;
}
}
@@ -327,8 +327,8 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
const Point &np = points[least_cost_point];
//open the neighbours for search
- for (RBSet<int>::Element *E = np.connections.front(); E; E = E->next()) {
- Point &p = points.write[E->get()];
+ for (const int &E : np.connections) {
+ Point &p = points.write[E];
float distance = np.pos.distance_to(p.pos) + np.distance;
if (p.prev != -1) {
@@ -343,9 +343,9 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
p.prev = least_cost_point;
p.distance = distance;
- open_list.insert(E->get());
+ open_list.insert(E);
- if (E->get() == bidx) {
+ if (E == bidx) {
//oh my reached end! stop algorithm
found_route = true;
break;
@@ -459,8 +459,8 @@ Dictionary PolygonPathFinder::_get_data() const {
{
int *cw = c.ptrw();
int idx = 0;
- for (RBSet<int>::Element *E = points[i].connections.front(); E; E = E->next()) {
- cw[idx++] = E->get();
+ for (const int &E : points[i].connections) {
+ cw[idx++] = E;
}
}
connections[i] = c;
@@ -469,9 +469,9 @@ Dictionary PolygonPathFinder::_get_data() const {
{
int *iw = ind.ptrw();
int idx = 0;
- for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) {
- iw[idx++] = E->get().points[0];
- iw[idx++] = E->get().points[1];
+ for (const Edge &E : edges) {
+ iw[idx++] = E.points[0];
+ iw[idx++] = E.points[1];
}
}
@@ -492,8 +492,8 @@ Vector2 PolygonPathFinder::get_closest_point(const Vector2 &p_point) const {
float closest_dist = 1e20f;
Vector2 closest_point;
- for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) {
- const Edge &e = E->get();
+ for (const Edge &E : edges) {
+ const Edge &e = E;
Vector2 seg[2] = {
points[e.points[0]].pos,
points[e.points[1]].pos
@@ -516,9 +516,9 @@ Vector2 PolygonPathFinder::get_closest_point(const Vector2 &p_point) const {
Vector<Vector2> PolygonPathFinder::get_intersections(const Vector2 &p_from, const Vector2 &p_to) const {
Vector<Vector2> inters;
- for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) {
- Vector2 a = points[E->get().points[0]].pos;
- Vector2 b = points[E->get().points[1]].pos;
+ for (const Edge &E : edges) {
+ Vector2 a = points[E.points[0]].pos;
+ Vector2 b = points[E.points[1]].pos;
Vector2 res;
if (Geometry2D::segment_intersects_segment(a, b, p_from, p_to, &res)) {
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index e65763ba2e..2981f38766 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -1307,8 +1307,8 @@ void Theme::get_type_list(List<StringName> *p_list) const {
types.insert(E.key);
}
- for (RBSet<StringName>::Element *E = types.front(); E; E = E->next()) {
- p_list->push_back(E->get());
+ for (const StringName &E : types) {
+ p_list->push_back(E);
}
}
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index cee3f85c32..e22b8efaae 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -1369,12 +1369,12 @@ TileMapCell TileSet::get_random_tile_from_terrains_pattern(int p_terrain_set, Ti
// Count the sum of probabilities.
double sum = 0.0;
RBSet<TileMapCell> set = per_terrain_pattern_tiles[p_terrain_set][p_terrain_tile_pattern];
- for (RBSet<TileMapCell>::Element *E = set.front(); E; E = E->next()) {
- if (E->get().source_id >= 0) {
- Ref<TileSetSource> source = sources[E->get().source_id];
+ for (const TileMapCell &E : set) {
+ if (E.source_id >= 0) {
+ Ref<TileSetSource> source = sources[E.source_id];
Ref<TileSetAtlasSource> atlas_source = source;
if (atlas_source.is_valid()) {
- TileData *tile_data = atlas_source->get_tile_data(E->get().get_atlas_coords(), E->get().alternative_tile);
+ TileData *tile_data = atlas_source->get_tile_data(E.get_atlas_coords(), E.alternative_tile);
sum += tile_data->get_probability();
} else {
sum += 1.0;
@@ -1389,13 +1389,13 @@ TileMapCell TileSet::get_random_tile_from_terrains_pattern(int p_terrain_set, Ti
double picked = Math::random(0.0, sum);
// Pick the tile.
- for (RBSet<TileMapCell>::Element *E = set.front(); E; E = E->next()) {
- if (E->get().source_id >= 0) {
- Ref<TileSetSource> source = sources[E->get().source_id];
+ for (const TileMapCell &E : set) {
+ if (E.source_id >= 0) {
+ Ref<TileSetSource> source = sources[E.source_id];
Ref<TileSetAtlasSource> atlas_source = source;
if (atlas_source.is_valid()) {
- TileData *tile_data = atlas_source->get_tile_data(E->get().get_atlas_coords(), E->get().alternative_tile);
+ TileData *tile_data = atlas_source->get_tile_data(E.get_atlas_coords(), E.alternative_tile);
count += tile_data->get_probability();
} else {
count += 1.0;
@@ -1405,7 +1405,7 @@ TileMapCell TileSet::get_random_tile_from_terrains_pattern(int p_terrain_set, Ti
}
if (count >= picked) {
- return E->get();
+ return E;
}
}
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 3281ebb2f6..d361aa876b 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1579,8 +1579,8 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::INT, vformat("%s/%s", PNAME("modes"), E.key), PROPERTY_HINT_ENUM, E.value));
}
- for (RBSet<String>::Element *E = toggles.front(); E; E = E->next()) {
- p_list->push_back(PropertyInfo(Variant::BOOL, vformat("%s/%s", PNAME("flags"), E->get())));
+ for (const String &E : toggles) {
+ p_list->push_back(PropertyInfo(Variant::BOOL, vformat("%s/%s", PNAME("flags"), E)));
}
for (const KeyValue<String, Varying> &E : varyings) {
diff --git a/servers/physics_2d/godot_physics_server_2d.cpp b/servers/physics_2d/godot_physics_server_2d.cpp
index f82f2533f3..cb829e5d91 100644
--- a/servers/physics_2d/godot_physics_server_2d.cpp
+++ b/servers/physics_2d/godot_physics_server_2d.cpp
@@ -1250,11 +1250,11 @@ void GodotPhysicsServer2D::step(real_t p_step) {
island_count = 0;
active_objects = 0;
collision_pairs = 0;
- for (RBSet<const GodotSpace2D *>::Element *E = active_spaces.front(); E; E = E->next()) {
- stepper->step(const_cast<GodotSpace2D *>(E->get()), p_step);
- island_count += E->get()->get_island_count();
- active_objects += E->get()->get_active_objects();
- collision_pairs += E->get()->get_collision_pairs();
+ for (const GodotSpace2D *E : active_spaces) {
+ stepper->step(const_cast<GodotSpace2D *>(E), p_step);
+ island_count += E->get_island_count();
+ active_objects += E->get_active_objects();
+ collision_pairs += E->get_collision_pairs();
}
}
@@ -1271,8 +1271,8 @@ void GodotPhysicsServer2D::flush_queries() {
uint64_t time_beg = OS::get_singleton()->get_ticks_usec();
- for (RBSet<const GodotSpace2D *>::Element *E = active_spaces.front(); E; E = E->next()) {
- GodotSpace2D *space = const_cast<GodotSpace2D *>(E->get());
+ for (const GodotSpace2D *E : active_spaces) {
+ GodotSpace2D *space = const_cast<GodotSpace2D *>(E);
space->call_queries();
}
@@ -1292,9 +1292,9 @@ void GodotPhysicsServer2D::flush_queries() {
total_time[i] = 0;
}
- for (RBSet<const GodotSpace2D *>::Element *E = active_spaces.front(); E; E = E->next()) {
+ for (const GodotSpace2D *E : active_spaces) {
for (int i = 0; i < GodotSpace2D::ELAPSED_TIME_MAX; i++) {
- total_time[i] += E->get()->get_elapsed_time(GodotSpace2D::ElapsedTime(i));
+ total_time[i] += E->get_elapsed_time(GodotSpace2D::ElapsedTime(i));
}
}
diff --git a/servers/physics_2d/godot_step_2d.cpp b/servers/physics_2d/godot_step_2d.cpp
index 0df5c1aabc..551fd9329f 100644
--- a/servers/physics_2d/godot_step_2d.cpp
+++ b/servers/physics_2d/godot_step_2d.cpp
@@ -168,8 +168,8 @@ void GodotStep2D::step(GodotSpace2D *p_space, real_t p_delta) {
const SelfList<GodotArea2D>::List &aml = p_space->get_moved_area_list();
while (aml.first()) {
- for (const RBSet<GodotConstraint2D *>::Element *E = aml.first()->self()->get_constraints().front(); E; E = E->next()) {
- GodotConstraint2D *constraint = E->get();
+ for (GodotConstraint2D *E : aml.first()->self()->get_constraints()) {
+ GodotConstraint2D *constraint = E;
if (constraint->get_island_step() == _step) {
continue;
}
diff --git a/servers/physics_3d/godot_physics_server_3d.cpp b/servers/physics_3d/godot_physics_server_3d.cpp
index cb4988757c..b3a384ba8f 100644
--- a/servers/physics_3d/godot_physics_server_3d.cpp
+++ b/servers/physics_3d/godot_physics_server_3d.cpp
@@ -1611,11 +1611,11 @@ void GodotPhysicsServer3D::step(real_t p_step) {
island_count = 0;
active_objects = 0;
collision_pairs = 0;
- for (RBSet<const GodotSpace3D *>::Element *E = active_spaces.front(); E; E = E->next()) {
- stepper->step(const_cast<GodotSpace3D *>(E->get()), p_step);
- island_count += E->get()->get_island_count();
- active_objects += E->get()->get_active_objects();
- collision_pairs += E->get()->get_collision_pairs();
+ for (const GodotSpace3D *E : active_spaces) {
+ stepper->step(const_cast<GodotSpace3D *>(E), p_step);
+ island_count += E->get_island_count();
+ active_objects += E->get_active_objects();
+ collision_pairs += E->get_collision_pairs();
}
#endif
}
@@ -1635,8 +1635,8 @@ void GodotPhysicsServer3D::flush_queries() {
uint64_t time_beg = OS::get_singleton()->get_ticks_usec();
- for (RBSet<const GodotSpace3D *>::Element *E = active_spaces.front(); E; E = E->next()) {
- GodotSpace3D *space = const_cast<GodotSpace3D *>(E->get());
+ for (const GodotSpace3D *E : active_spaces) {
+ GodotSpace3D *space = const_cast<GodotSpace3D *>(E);
space->call_queries();
}
@@ -1656,9 +1656,9 @@ void GodotPhysicsServer3D::flush_queries() {
total_time[i] = 0;
}
- for (RBSet<const GodotSpace3D *>::Element *E = active_spaces.front(); E; E = E->next()) {
+ for (const GodotSpace3D *E : active_spaces) {
for (int i = 0; i < GodotSpace3D::ELAPSED_TIME_MAX; i++) {
- total_time[i] += E->get()->get_elapsed_time(GodotSpace3D::ElapsedTime(i));
+ total_time[i] += E->get_elapsed_time(GodotSpace3D::ElapsedTime(i));
}
}
diff --git a/servers/physics_3d/godot_step_3d.cpp b/servers/physics_3d/godot_step_3d.cpp
index b46436ba39..99656d01a0 100644
--- a/servers/physics_3d/godot_step_3d.cpp
+++ b/servers/physics_3d/godot_step_3d.cpp
@@ -87,8 +87,8 @@ void GodotStep3D::_populate_island(GodotBody3D *p_body, LocalVector<GodotBody3D
void GodotStep3D::_populate_island_soft_body(GodotSoftBody3D *p_soft_body, LocalVector<GodotBody3D *> &p_body_island, LocalVector<GodotConstraint3D *> &p_constraint_island) {
p_soft_body->set_island_step(_step);
- for (RBSet<GodotConstraint3D *>::Element *E = p_soft_body->get_constraints().front(); E; E = E->next()) {
- GodotConstraint3D *constraint = const_cast<GodotConstraint3D *>(E->get());
+ for (const GodotConstraint3D *E : p_soft_body->get_constraints()) {
+ GodotConstraint3D *constraint = const_cast<GodotConstraint3D *>(E);
if (constraint->get_island_step() == _step) {
continue; // Already processed.
}
@@ -236,8 +236,8 @@ void GodotStep3D::step(GodotSpace3D *p_space, real_t p_delta) {
const SelfList<GodotArea3D>::List &aml = p_space->get_moved_area_list();
while (aml.first()) {
- for (const RBSet<GodotConstraint3D *>::Element *E = aml.first()->self()->get_constraints().front(); E; E = E->next()) {
- GodotConstraint3D *constraint = E->get();
+ for (GodotConstraint3D *E : aml.first()->self()->get_constraints()) {
+ GodotConstraint3D *constraint = E;
if (constraint->get_island_step() == _step) {
continue;
}
diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp
index a9b7964858..41aae36785 100644
--- a/servers/physics_server_2d.cpp
+++ b/servers/physics_server_2d.cpp
@@ -158,8 +158,8 @@ Vector<RID> PhysicsRayQueryParameters2D::get_exclude() const {
Vector<RID> ret;
ret.resize(parameters.exclude.size());
int idx = 0;
- for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) {
- ret.write[idx++] = E->get();
+ for (const RID &E : parameters.exclude) {
+ ret.write[idx++] = E;
}
return ret;
}
@@ -208,8 +208,8 @@ Vector<RID> PhysicsPointQueryParameters2D::get_exclude() const {
Vector<RID> ret;
ret.resize(parameters.exclude.size());
int idx = 0;
- for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) {
- ret.write[idx++] = E->get();
+ for (const RID &E : parameters.exclude) {
+ ret.write[idx++] = E;
}
return ret;
}
@@ -267,8 +267,8 @@ Vector<RID> PhysicsShapeQueryParameters2D::get_exclude() const {
Vector<RID> ret;
ret.resize(parameters.exclude.size());
int idx = 0;
- for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) {
- ret.write[idx++] = E->get();
+ for (const RID &E : parameters.exclude) {
+ ret.write[idx++] = E;
}
return ret;
}
diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp
index f2072f7666..a606d055f7 100644
--- a/servers/physics_server_3d.cpp
+++ b/servers/physics_server_3d.cpp
@@ -177,8 +177,8 @@ Vector<RID> PhysicsRayQueryParameters3D::get_exclude() const {
Vector<RID> ret;
ret.resize(parameters.exclude.size());
int idx = 0;
- for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) {
- ret.write[idx++] = E->get();
+ for (const RID &E : parameters.exclude) {
+ ret.write[idx++] = E;
}
return ret;
}
@@ -231,8 +231,8 @@ Vector<RID> PhysicsPointQueryParameters3D::get_exclude() const {
Vector<RID> ret;
ret.resize(parameters.exclude.size());
int idx = 0;
- for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) {
- ret.write[idx++] = E->get();
+ for (const RID &E : parameters.exclude) {
+ ret.write[idx++] = E;
}
return ret;
}
@@ -286,8 +286,8 @@ Vector<RID> PhysicsShapeQueryParameters3D::get_exclude() const {
Vector<RID> ret;
ret.resize(parameters.exclude.size());
int idx = 0;
- for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) {
- ret.write[idx++] = E->get();
+ for (const RID &E : parameters.exclude) {
+ ret.write[idx++] = E;
}
return ret;
}
diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp
index 46bc22ad54..9291a89333 100644
--- a/servers/rendering/renderer_canvas_cull.cpp
+++ b/servers/rendering/renderer_canvas_cull.cpp
@@ -1831,8 +1831,8 @@ void RendererCanvasCull::canvas_occluder_polygon_set_shape(RID p_occluder_polygo
RSG::canvas_render->occluder_polygon_set_shape(occluder_poly->occluder, p_shape, p_closed);
- for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *E = occluder_poly->owners.front(); E; E = E->next()) {
- E->get()->aabb_cache = occluder_poly->aabb;
+ for (RendererCanvasRender::LightOccluderInstance *E : occluder_poly->owners) {
+ E->aabb_cache = occluder_poly->aabb;
}
}
@@ -1841,8 +1841,8 @@ void RendererCanvasCull::canvas_occluder_polygon_set_cull_mode(RID p_occluder_po
ERR_FAIL_COND(!occluder_poly);
occluder_poly->cull_mode = p_mode;
RSG::canvas_render->occluder_polygon_set_cull_mode(occluder_poly->occluder, p_mode);
- for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *E = occluder_poly->owners.front(); E; E = E->next()) {
- E->get()->cull_cache = p_mode;
+ for (RendererCanvasRender::LightOccluderInstance *E : occluder_poly->owners) {
+ E->cull_cache = p_mode;
}
}
@@ -1942,12 +1942,12 @@ bool RendererCanvasCull::free(RID p_rid) {
canvas->child_items[i].item->parent = RID();
}
- for (RBSet<RendererCanvasRender::Light *>::Element *E = canvas->lights.front(); E; E = E->next()) {
- E->get()->canvas = RID();
+ for (RendererCanvasRender::Light *E : canvas->lights) {
+ E->canvas = RID();
}
- for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *E = canvas->occluders.front(); E; E = E->next()) {
- E->get()->canvas = RID();
+ for (RendererCanvasRender::LightOccluderInstance *E : canvas->occluders) {
+ E->canvas = RID();
}
canvas_owner.free(p_rid);
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
index e3bf2e3dda..3f3b087edb 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
@@ -5464,8 +5464,8 @@ bool RendererSceneRenderRD::free(RID p_rid) {
LightInstance *light_instance = light_instance_owner.get_or_null(p_rid);
//remove from shadow atlases..
- for (RBSet<RID>::Element *E = light_instance->shadow_atlases.front(); E; E = E->next()) {
- ShadowAtlas *shadow_atlas = shadow_atlas_owner.get_or_null(E->get());
+ for (const RID &E : light_instance->shadow_atlases) {
+ ShadowAtlas *shadow_atlas = shadow_atlas_owner.get_or_null(E);
ERR_CONTINUE(!shadow_atlas->shadow_owners.has(p_rid));
uint32_t key = shadow_atlas->shadow_owners[p_rid];
uint32_t q = (key >> ShadowAtlas::QUADRANT_SHIFT) & 0x3;
diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
index 27f0c5f273..93f1f4e0d9 100644
--- a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
@@ -1979,8 +1979,8 @@ void MaterialStorage::global_variable_set(const StringName &p_name, const Varian
} else {
//texture
MaterialStorage *material_storage = MaterialStorage::get_singleton();
- for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) {
- Material *material = material_storage->get_material(E->get());
+ for (const RID &E : gv.texture_materials) {
+ Material *material = material_storage->get_material(E);
ERR_CONTINUE(!material);
material_storage->_material_queue_update(material, false, true);
}
@@ -2011,8 +2011,8 @@ void MaterialStorage::global_variable_set_override(const StringName &p_name, con
} else {
//texture
MaterialStorage *material_storage = MaterialStorage::get_singleton();
- for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) {
- Material *material = material_storage->get_material(E->get());
+ for (const RID &E : gv.texture_materials) {
+ Material *material = material_storage->get_material(E);
ERR_CONTINUE(!material);
material_storage->_material_queue_update(material, false, true);
}
@@ -2305,8 +2305,8 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
shader->data = nullptr;
}
- for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
- Material *material = E->get();
+ for (Material *E : shader->owners) {
+ Material *material = E;
material->shader_type = new_type;
if (material->data) {
memdelete(material->data);
@@ -2322,8 +2322,8 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
shader->type = SHADER_TYPE_MAX; //invalid
}
- for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
- Material *material = E->get();
+ for (Material *E : shader->owners) {
+ Material *material = E;
if (shader->data) {
material->data = material_get_data_request_function(new_type)(shader->data);
material->data->self = material->self;
@@ -2346,8 +2346,8 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
shader->data->set_code(p_code);
}
- for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
- Material *material = E->get();
+ for (Material *E : shader->owners) {
+ Material *material = E;
material->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MATERIAL);
_material_queue_update(material, true, true);
}
@@ -2388,8 +2388,8 @@ void MaterialStorage::shader_set_default_texture_param(RID p_shader, const Strin
if (shader->data) {
shader->data->set_default_texture_param(p_name, p_texture, p_index);
}
- for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
- Material *material = E->get();
+ for (Material *E : shader->owners) {
+ Material *material = E;
_material_queue_update(material, false, true);
}
}
diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
index fa051c92ed..1e0d67f269 100644
--- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
@@ -215,8 +215,8 @@ void MeshStorage::mesh_free(RID p_rid) {
ERR_PRINT("deleting mesh with active instances");
}
if (mesh->shadow_owners.size()) {
- for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
- Mesh *shadow_owner = E->get();
+ for (Mesh *E : mesh->shadow_owners) {
+ Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
}
@@ -431,8 +431,8 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
- for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
- Mesh *shadow_owner = E->get();
+ for (Mesh *E : mesh->shadow_owners) {
+ Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
}
@@ -742,8 +742,8 @@ void MeshStorage::mesh_clear(RID p_mesh) {
mesh->has_bone_weights = false;
mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
- for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
- Mesh *shadow_owner = E->get();
+ for (Mesh *E : mesh->shadow_owners) {
+ Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
}
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
index 1701b56b0b..e15d3e13a9 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
@@ -838,8 +838,8 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta
}
uint32_t collision_3d_textures_used = 0;
- for (const RBSet<RID>::Element *E = p_particles->collisions.front(); E; E = E->next()) {
- ParticlesCollisionInstance *pci = particles_collision_instance_owner.get_or_null(E->get());
+ for (const RID &E : p_particles->collisions) {
+ ParticlesCollisionInstance *pci = particles_collision_instance_owner.get_or_null(E);
if (!pci || !pci->active) {
continue;
}
diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp
index 37bbab86ff..89bd12ea3d 100644
--- a/servers/rendering/renderer_scene_cull.cpp
+++ b/servers/rendering/renderer_scene_cull.cpp
@@ -653,8 +653,8 @@ void RendererSceneCull::instance_set_base(RID p_instance, RID p_base) {
scene_render->geometry_instance_set_lightmap_capture(geom->geometry_instance, instance->lightmap_sh.ptr());
}
- for (RBSet<Instance *>::Element *E = instance->visibility_dependencies.front(); E; E = E->next()) {
- Instance *dep_instance = E->get();
+ for (Instance *E : instance->visibility_dependencies) {
+ Instance *dep_instance = E;
ERR_CONTINUE(dep_instance->array_index == -1);
ERR_CONTINUE(dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index != -1);
dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = instance->array_index;
@@ -1299,8 +1299,8 @@ bool RendererSceneCull::_update_instance_visibility_depth(Instance *p_instance)
while (instance) {
if (!instance->visibility_dependencies.is_empty()) {
uint32_t depth = 0;
- for (RBSet<Instance *>::Element *E = instance->visibility_dependencies.front(); E; E = E->next()) {
- depth = MAX(depth, E->get()->visibility_dependencies_depth);
+ for (const Instance *E : instance->visibility_dependencies) {
+ depth = MAX(depth, E->visibility_dependencies_depth);
}
instance->visibility_dependencies_depth = depth + 1;
} else {
@@ -1559,8 +1559,8 @@ void RendererSceneCull::_update_instance(Instance *p_instance) {
InstanceLightmapData *lightmap_data = static_cast<InstanceLightmapData *>(p_instance->base_data);
//erase dependencies, since no longer a lightmap
- for (RBSet<Instance *>::Element *E = lightmap_data->geometries.front(); E; E = E->next()) {
- Instance *geom = E->get();
+ for (Instance *E : lightmap_data->geometries) {
+ Instance *geom = E;
_instance_queue_update(geom, true, false);
}
}
@@ -1574,8 +1574,8 @@ void RendererSceneCull::_update_instance(Instance *p_instance) {
//make sure lights are updated if it casts shadow
if (geom->can_cast_shadows) {
- for (RBSet<Instance *>::Element *E = geom->lights.front(); E; E = E->next()) {
- InstanceLightData *light = static_cast<InstanceLightData *>(E->get()->base_data);
+ for (const Instance *E : geom->lights) {
+ InstanceLightData *light = static_cast<InstanceLightData *>(E->base_data);
light->shadow_dirty = true;
}
}
@@ -1632,8 +1632,8 @@ void RendererSceneCull::_update_instance(Instance *p_instance) {
idata.parent_array_index = p_instance->visibility_parent ? p_instance->visibility_parent->array_index : -1;
idata.visibility_index = p_instance->visibility_index;
- for (RBSet<Instance *>::Element *E = p_instance->visibility_dependencies.front(); E; E = E->next()) {
- Instance *dep_instance = E->get();
+ for (Instance *E : p_instance->visibility_dependencies) {
+ Instance *dep_instance = E;
if (dep_instance->array_index != -1) {
dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = p_instance->array_index;
}
@@ -1800,8 +1800,8 @@ void RendererSceneCull::_unpair_instance(Instance *p_instance) {
swapped_instance->scenario->instance_visibility[swapped_instance->visibility_index].array_index = swapped_instance->array_index;
}
- for (RBSet<Instance *>::Element *E = swapped_instance->visibility_dependencies.front(); E; E = E->next()) {
- Instance *dep_instance = E->get();
+ for (Instance *E : swapped_instance->visibility_dependencies) {
+ Instance *dep_instance = E;
if (dep_instance != p_instance && dep_instance->array_index != -1) {
dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = swapped_instance->array_index;
}
@@ -1824,8 +1824,8 @@ void RendererSceneCull::_unpair_instance(Instance *p_instance) {
scene_render->geometry_instance_pair_voxel_gi_instances(geom->geometry_instance, nullptr, 0);
}
- for (RBSet<Instance *>::Element *E = p_instance->visibility_dependencies.front(); E; E = E->next()) {
- Instance *dep_instance = E->get();
+ for (Instance *E : p_instance->visibility_dependencies) {
+ Instance *dep_instance = E;
if (dep_instance->array_index != -1) {
dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = -1;
if ((1 << dep_instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) {
@@ -1923,8 +1923,8 @@ void RendererSceneCull::_update_instance_lightmap_captures(Instance *p_instance)
float accum_blend = 0.0;
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(p_instance->base_data);
- for (RBSet<Instance *>::Element *E = geom->lightmap_captures.front(); E; E = E->next()) {
- Instance *lightmap = E->get();
+ for (Instance *E : geom->lightmap_captures) {
+ Instance *lightmap = E;
bool interior = RSG::light_storage->lightmap_is_interior(lightmap->base);
@@ -2744,8 +2744,8 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0;
- for (RBSet<Instance *>::Element *E = geom->lights.front(); E; E = E->next()) {
- InstanceLightData *light = static_cast<InstanceLightData *>(E->get()->base_data);
+ for (const Instance *E : geom->lights) {
+ InstanceLightData *light = static_cast<InstanceLightData *>(E->base_data);
instance_pair_buffer[idx++] = light->instance;
if (idx == MAX_INSTANCE_PAIRS) {
break;
@@ -2767,8 +2767,8 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0;
- for (RBSet<Instance *>::Element *E = geom->reflection_probes.front(); E; E = E->next()) {
- InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(E->get()->base_data);
+ for (const Instance *E : geom->reflection_probes) {
+ InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(E->base_data);
instance_pair_buffer[idx++] = reflection_probe->instance;
if (idx == MAX_INSTANCE_PAIRS) {
@@ -2784,8 +2784,8 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0;
- for (RBSet<Instance *>::Element *E = geom->decals.front(); E; E = E->next()) {
- InstanceDecalData *decal = static_cast<InstanceDecalData *>(E->get()->base_data);
+ for (const Instance *E : geom->decals) {
+ InstanceDecalData *decal = static_cast<InstanceDecalData *>(E->base_data);
instance_pair_buffer[idx++] = decal->instance;
if (idx == MAX_INSTANCE_PAIRS) {
@@ -2799,8 +2799,8 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
if (idata.flags & InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY) {
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0;
- for (RBSet<Instance *>::Element *E = geom->voxel_gi_instances.front(); E; E = E->next()) {
- InstanceVoxelGIData *voxel_gi = static_cast<InstanceVoxelGIData *>(E->get()->base_data);
+ for (const Instance *E : geom->voxel_gi_instances) {
+ InstanceVoxelGIData *voxel_gi = static_cast<InstanceVoxelGIData *>(E->base_data);
instance_pair_buffer[idx++] = voxel_gi->probe_instance;
if (idx == MAX_INSTANCE_PAIRS) {
@@ -3420,8 +3420,8 @@ void RendererSceneCull::render_probes() {
const RID *instance_caches = probe->light_instances.ptr();
int idx = 0; //must count visible lights
- for (RBSet<Instance *>::Element *E = probe->lights.front(); E; E = E->next()) {
- Instance *instance = E->get();
+ for (Instance *E : probe->lights) {
+ Instance *instance = E;
InstanceLightData *instance_light = (InstanceLightData *)instance->base_data;
if (!instance->visible) {
continue;
@@ -3502,8 +3502,8 @@ void RendererSceneCull::render_probes() {
RID *instance_caches = probe->light_instances.ptrw();
int idx = 0; //must count visible lights
- for (RBSet<Instance *>::Element *E = probe->lights.front(); E; E = E->next()) {
- Instance *instance = E->get();
+ for (Instance *E : probe->lights) {
+ Instance *instance = E;
InstanceLightData *instance_light = (InstanceLightData *)instance->base_data;
if (!instance->visible) {
continue;
@@ -3557,8 +3557,8 @@ void RendererSceneCull::render_probes() {
RID instance_pair_buffer[MAX_INSTANCE_PAIRS];
- for (RBSet<Instance *>::Element *E = probe->dynamic_geometries.front(); E; E = E->next()) {
- Instance *ins = E->get();
+ for (Instance *E : probe->dynamic_geometries) {
+ Instance *ins = E;
if (!ins->visible) {
continue;
}
@@ -3566,8 +3566,8 @@ void RendererSceneCull::render_probes() {
if (ins->scenario && ins->array_index >= 0 && (ins->scenario->instance_data[ins->array_index].flags & InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY)) {
uint32_t idx = 0;
- for (RBSet<Instance *>::Element *F = geom->voxel_gi_instances.front(); F; F = F->next()) {
- InstanceVoxelGIData *voxel_gi2 = static_cast<InstanceVoxelGIData *>(F->get()->base_data);
+ for (const Instance *F : geom->voxel_gi_instances) {
+ InstanceVoxelGIData *voxel_gi2 = static_cast<InstanceVoxelGIData *>(F->base_data);
instance_pair_buffer[idx++] = voxel_gi2->probe_instance;
if (idx == MAX_INSTANCE_PAIRS) {
@@ -3823,8 +3823,8 @@ void RendererSceneCull::_update_dirty_instance(Instance *p_instance) {
if (can_cast_shadows != geom->can_cast_shadows) {
//ability to cast shadows change, let lights now
- for (RBSet<Instance *>::Element *E = geom->lights.front(); E; E = E->next()) {
- InstanceLightData *light = static_cast<InstanceLightData *>(E->get()->base_data);
+ for (const Instance *E : geom->lights) {
+ InstanceLightData *light = static_cast<InstanceLightData *>(E->base_data);
light->shadow_dirty = true;
}
diff --git a/servers/rendering/renderer_storage.h b/servers/rendering/renderer_storage.h
index 7f35d2ca99..672fd4e4f1 100644
--- a/servers/rendering/renderer_storage.h
+++ b/servers/rendering/renderer_storage.h
@@ -85,8 +85,8 @@ public:
void update_end() { //call after updating dependencies
List<Pair<Dependency *, DependencyTracker *>> to_clean_up;
- for (RBSet<Dependency *>::Element *E = dependencies.front(); E; E = E->next()) {
- Dependency *dep = E->get();
+ for (Dependency *E : dependencies) {
+ Dependency *dep = E;
HashMap<DependencyTracker *, uint32_t>::Iterator F = dep->instances.find(this);
ERR_CONTINUE(!F);
if (F->value != instance_version) {
@@ -105,8 +105,8 @@ public:
}
void clear() { // clear all dependencies
- for (RBSet<Dependency *>::Element *E = dependencies.front(); E; E = E->next()) {
- Dependency *dep = E->get();
+ for (Dependency *E : dependencies) {
+ Dependency *dep = E;
dep->instances.erase(this);
}
dependencies.clear();
diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp
index d612fb4aa7..7c2d7a1e1d 100644
--- a/servers/rendering/renderer_viewport.cpp
+++ b/servers/rendering/renderer_viewport.cpp
@@ -247,15 +247,15 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas);
Transform2D xf = _canvas_get_transform(p_viewport, canvas, &E.value, clip_rect.size);
- for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *F = canvas->occluders.front(); F; F = F->next()) {
- if (!F->get()->enabled) {
+ for (RendererCanvasRender::LightOccluderInstance *F : canvas->occluders) {
+ if (!F->enabled) {
continue;
}
- F->get()->xform_cache = xf * F->get()->xform;
+ F->xform_cache = xf * F->xform;
- if (sdf_rect.intersects_transformed(F->get()->xform_cache, F->get()->aabb_cache)) {
- F->get()->next = occluders;
- occluders = F->get();
+ if (sdf_rect.intersects_transformed(F->xform_cache, F->aabb_cache)) {
+ F->next = occluders;
+ occluders = F;
}
}
}
@@ -281,8 +281,8 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
// Find lights in canvas.
- for (RBSet<RendererCanvasRender::Light *>::Element *F = canvas->lights.front(); F; F = F->next()) {
- RendererCanvasRender::Light *cl = F->get();
+ for (RendererCanvasRender::Light *F : canvas->lights) {
+ RendererCanvasRender::Light *cl = F;
if (cl->enabled && cl->texture.is_valid()) {
//not super efficient..
Size2 tsize = RSG::texture_storage->texture_size_with_proxy(cl->texture);
@@ -313,8 +313,8 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
}
}
- for (RBSet<RendererCanvasRender::Light *>::Element *F = canvas->directional_lights.front(); F; F = F->next()) {
- RendererCanvasRender::Light *cl = F->get();
+ for (RendererCanvasRender::Light *F : canvas->directional_lights) {
+ RendererCanvasRender::Light *cl = F;
if (cl->enabled) {
cl->filter_next_ptr = directional_lights;
directional_lights = cl;
@@ -349,14 +349,14 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas);
Transform2D xf = _canvas_get_transform(p_viewport, canvas, &E.value, clip_rect.size);
- for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *F = canvas->occluders.front(); F; F = F->next()) {
- if (!F->get()->enabled) {
+ for (RendererCanvasRender::LightOccluderInstance *F : canvas->occluders) {
+ if (!F->enabled) {
continue;
}
- F->get()->xform_cache = xf * F->get()->xform;
- if (shadow_rect.intersects_transformed(F->get()->xform_cache, F->get()->aabb_cache)) {
- F->get()->next = occluders;
- occluders = F->get();
+ F->xform_cache = xf * F->xform;
+ if (shadow_rect.intersects_transformed(F->xform_cache, F->aabb_cache)) {
+ F->next = occluders;
+ occluders = F;
}
}
}
@@ -429,19 +429,19 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas);
Transform2D xf = _canvas_get_transform(p_viewport, canvas, &E.value, clip_rect.size);
- for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *F = canvas->occluders.front(); F; F = F->next()) {
- if (!F->get()->enabled) {
+ for (RendererCanvasRender::LightOccluderInstance *F : canvas->occluders) {
+ if (!F->enabled) {
continue;
}
- F->get()->xform_cache = xf * F->get()->xform;
- Transform2D localizer = F->get()->xform_cache.affine_inverse();
+ F->xform_cache = xf * F->xform;
+ Transform2D localizer = F->xform_cache.affine_inverse();
for (int j = 0; j < point_count; j++) {
xf_points[j] = localizer.xform(points[j]);
}
- if (F->get()->aabb_cache.intersects_filled_polygon(xf_points, point_count)) {
- F->get()->next = occluders;
- occluders = F->get();
+ if (F->aabb_cache.intersects_filled_polygon(xf_points, point_count)) {
+ F->next = occluders;
+ occluders = F;
}
}
}
diff --git a/servers/rendering/shader_compiler.cpp b/servers/rendering/shader_compiler.cpp
index c88d9e8222..662016e6f4 100644
--- a/servers/rendering/shader_compiler.cpp
+++ b/servers/rendering/shader_compiler.cpp
@@ -303,8 +303,8 @@ void ShaderCompiler::_dump_function_deps(const SL::ShaderNode *p_node, const Str
Vector<StringName> uses_functions;
- for (RBSet<StringName>::Element *E = p_node->functions[fidx].uses_function.front(); E; E = E->next()) {
- uses_functions.push_back(E->get());
+ for (const StringName &E : p_node->functions[fidx].uses_function) {
+ uses_functions.push_back(E);
}
uses_functions.sort_custom<StringName::AlphCompare>(); //ensure order is deterministic so the same shader is always produced
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 8a3ab92714..d2e188a9a7 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -4036,8 +4036,8 @@ void ShaderLanguage::get_keyword_list(List<String> *r_keywords) {
idx++;
}
- for (RBSet<String>::Element *E = kws.front(); E; E = E->next()) {
- r_keywords->push_back(E->get());
+ for (const String &E : kws) {
+ r_keywords->push_back(E);
}
}
@@ -4066,8 +4066,8 @@ void ShaderLanguage::get_builtin_funcs(List<String> *r_keywords) {
idx++;
}
- for (RBSet<String>::Element *E = kws.front(); E; E = E->next()) {
- r_keywords->push_back(E->get());
+ for (const String &E : kws) {
+ r_keywords->push_back(E);
}
}
@@ -4341,8 +4341,8 @@ bool ShaderLanguage::_propagate_function_call_sampler_uniform_settings(StringNam
arg->tex_argument_filter = p_filter;
arg->tex_argument_repeat = p_repeat;
for (KeyValue<StringName, RBSet<int>> &E : arg->tex_argument_connect) {
- for (RBSet<int>::Element *F = E.value.front(); F; F = F->next()) {
- if (!_propagate_function_call_sampler_uniform_settings(E.key, F->get(), p_filter, p_repeat)) {
+ for (const int &F : E.value) {
+ if (!_propagate_function_call_sampler_uniform_settings(E.key, F, p_filter, p_repeat)) {
return false;
}
}
@@ -4375,8 +4375,8 @@ bool ShaderLanguage::_propagate_function_call_sampler_builtin_reference(StringNa
arg->tex_builtin = p_builtin;
for (KeyValue<StringName, RBSet<int>> &E : arg->tex_argument_connect) {
- for (RBSet<int>::Element *F = E.value.front(); F; F = F->next()) {
- if (!_propagate_function_call_sampler_builtin_reference(E.key, F->get(), p_builtin)) {
+ for (const int &F : E.value) {
+ if (!_propagate_function_call_sampler_builtin_reference(E.key, F, p_builtin)) {
return false;
}
}
@@ -7568,12 +7568,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
String ShaderLanguage::_get_shader_type_list(const RBSet<String> &p_shader_types) const {
// Return a list of shader types as an human-readable string
String valid_types;
- for (const RBSet<String>::Element *E = p_shader_types.front(); E; E = E->next()) {
+ for (const String &E : p_shader_types) {
if (!valid_types.is_empty()) {
valid_types += ", ";
}
- valid_types += "'" + E->get() + "'";
+ valid_types += "'" + E + "'";
}
return valid_types;