Use range iterators for RBSet in most cases

This commit is contained in:
Aaron Record 2022-05-18 17:43:40 -06:00
parent 71c40ff4da
commit 900c676b02
84 changed files with 782 additions and 782 deletions

View File

@ -360,8 +360,8 @@ void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const {
vclist.insert(vc); vclist.insert(vc);
} }
for (RBSet<_VCSort>::Element *E = vclist.front(); E; E = E->next()) { for (const _VCSort &E : vclist) {
String prop_info_name = E->get().name; String prop_info_name = E.name;
int dot = prop_info_name.find("."); int dot = prop_info_name.find(".");
if (dot != -1 && !custom_prop_info.has(prop_info_name)) { if (dot != -1 && !custom_prop_info.has(prop_info_name)) {
prop_info_name = prop_info_name.substr(0, dot); 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)) { if (custom_prop_info.has(prop_info_name)) {
PropertyInfo pi = custom_prop_info[prop_info_name]; PropertyInfo pi = custom_prop_info[prop_info_name];
pi.name = E->get().name; pi.name = E.name;
pi.usage = E->get().flags; pi.usage = E.flags;
p_list->push_back(pi); p_list->push_back(pi);
} else { } 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; RBMap<String, List<String>> props;
for (RBSet<_VCSort>::Element *E = vclist.front(); E; E = E->next()) { for (const _VCSort &E : vclist) {
String category = E->get().name; String category = E.name;
String name = E->get().name; String name = E.name;
int div = category.find("/"); int div = category.find("/");

View File

@ -406,8 +406,8 @@ Error DirAccessPack::list_dir_begin() {
list_dirs.push_back(E.key); list_dirs.push_back(E.key);
} }
for (RBSet<String>::Element *E = current->files.front(); E; E = E->next()) { for (const String &E : current->files) {
list_files.push_back(E->get()); list_files.push_back(E);
} }
return OK; return OK;

View File

@ -317,8 +317,8 @@ void Resource::unregister_owner(Object *p_owner) {
} }
void Resource::notify_change_to_owners() { void Resource::notify_change_to_owners() {
for (RBSet<ObjectID>::Element *E = owners.front(); E; E = E->next()) { for (const ObjectID &E : owners) {
Object *obj = ObjectDB::get_instance(E->get()); Object *obj = ObjectDB::get_instance(E);
ERR_CONTINUE_MSG(!obj, "Object was deleted, while still owning a resource."); //wtf ERR_CONTINUE_MSG(!obj, "Object was deleted, while still owning a resource."); //wtf
//TODO store string //TODO store string
obj->call("resource_changed", Ref<Resource>(this)); obj->call("resource_changed", Ref<Resource>(this));

View File

@ -391,8 +391,8 @@ float ResourceLoader::_dependency_get_progress(const String &p_path) {
int dep_count = load_task.sub_tasks.size(); int dep_count = load_task.sub_tasks.size();
if (dep_count > 0) { if (dep_count > 0) {
float dep_progress = 0; float dep_progress = 0;
for (RBSet<String>::Element *E = load_task.sub_tasks.front(); E; E = E->next()) { for (const String &E : load_task.sub_tasks) {
dep_progress += _dependency_get_progress(E->get()); dep_progress += _dependency_get_progress(E);
} }
dep_progress /= float(dep_count); dep_progress /= float(dep_count);
dep_progress *= 0.5; dep_progress *= 0.5;

View File

@ -293,10 +293,10 @@ Vector3 AStar3D::get_closest_position_in_segment(const Vector3 &p_point) const {
real_t closest_dist = 1e20; real_t closest_dist = 1e20;
Vector3 closest_point; 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; Point *from_point = nullptr, *to_point = nullptr;
points.lookup(E->get().u, from_point); points.lookup(E.u, from_point);
points.lookup(E->get().v, to_point); points.lookup(E.v, to_point);
if (!(from_point->enabled && to_point->enabled)) { if (!(from_point->enabled && to_point->enabled)) {
continue; continue;

View File

@ -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."); ERR_FAIL_COND_V_MSG(!multiplayer_peer.is_valid(), Vector<int>(), "No multiplayer peer is assigned. Assume no peers are connected.");
Vector<int> ret; Vector<int> ret;
for (RBSet<int>::Element *E = connected_peers.front(); E; E = E->next()) { for (const int &E : connected_peers) {
ret.push_back(E->get()); ret.push_back(E);
} }
return ret; return ret;

View File

@ -507,8 +507,8 @@ String TranslationServer::get_locale() const {
Array TranslationServer::get_loaded_locales() const { Array TranslationServer::get_loaded_locales() const {
Array locales; Array locales;
for (const RBSet<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) { for (const Ref<Translation> &E : translations) {
const Ref<Translation> &t = E->get(); const Ref<Translation> &t = E;
ERR_FAIL_COND_V(t.is_null(), Array()); ERR_FAIL_COND_V(t.is_null(), Array());
String l = t->get_locale(); String l = t->get_locale();
@ -530,8 +530,8 @@ Ref<Translation> TranslationServer::get_translation_object(const String &p_local
Ref<Translation> res; Ref<Translation> res;
int best_score = 0; int best_score = 0;
for (const RBSet<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) { for (const Ref<Translation> &E : translations) {
const Ref<Translation> &t = E->get(); const Ref<Translation> &t = E;
ERR_FAIL_COND_V(t.is_null(), nullptr); ERR_FAIL_COND_V(t.is_null(), nullptr);
String l = t->get_locale(); String l = t->get_locale();
@ -599,8 +599,8 @@ StringName TranslationServer::_get_message_from_translations(const StringName &p
StringName res; StringName res;
int best_score = 0; int best_score = 0;
for (const RBSet<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) { for (const Ref<Translation> &E : translations) {
const Ref<Translation> &t = E->get(); const Ref<Translation> &t = E;
ERR_FAIL_COND_V(t.is_null(), p_message); ERR_FAIL_COND_V(t.is_null(), p_message);
String l = t->get_locale(); String l = t->get_locale();

View File

@ -2091,8 +2091,8 @@ void MaterialStorage::global_variable_set(const StringName &p_name, const Varian
} else { } else {
//texture //texture
MaterialStorage *material_storage = MaterialStorage::get_singleton(); MaterialStorage *material_storage = MaterialStorage::get_singleton();
for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) { for (const RID &E : gv.texture_materials) {
Material *material = material_storage->get_material(E->get()); Material *material = material_storage->get_material(E);
ERR_CONTINUE(!material); ERR_CONTINUE(!material);
material_storage->_material_queue_update(material, false, true); material_storage->_material_queue_update(material, false, true);
} }
@ -2123,8 +2123,8 @@ void MaterialStorage::global_variable_set_override(const StringName &p_name, con
} else { } else {
//texture //texture
MaterialStorage *material_storage = MaterialStorage::get_singleton(); MaterialStorage *material_storage = MaterialStorage::get_singleton();
for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) { for (const RID &E : gv.texture_materials) {
Material *material = material_storage->get_material(E->get()); Material *material = material_storage->get_material(E);
ERR_CONTINUE(!material); ERR_CONTINUE(!material);
material_storage->_material_queue_update(material, false, true); 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; shader->data = nullptr;
} }
for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { for (Material *E : shader->owners) {
Material *material = E->get(); Material *material = E;
material->shader_mode = new_mode; material->shader_mode = new_mode;
if (material->data) { if (material->data) {
memdelete(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 shader->mode = RS::SHADER_MAX; //invalid
} }
for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { for (Material *E : shader->owners) {
Material *material = E->get(); Material *material = E;
if (shader->data) { if (shader->data) {
material->data = material_data_request_func[new_mode](shader->data); material->data = material_data_request_func[new_mode](shader->data);
material->data->self = material->self; 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); shader->data->set_code(p_code);
} }
for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { for (Material *E : shader->owners) {
Material *material = E->get(); Material *material = E;
material->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MATERIAL); material->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MATERIAL);
_material_queue_update(material, true, true); _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) { if (shader->data) {
shader->data->set_default_texture_param(p_name, p_texture, p_index); shader->data->set_default_texture_param(p_name, p_texture, p_index);
} }
for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { for (Material *E : shader->owners) {
Material *material = E->get(); Material *material = E;
_material_queue_update(material, false, true); _material_queue_update(material, false, true);
} }
} }

View File

@ -68,8 +68,8 @@ void MeshStorage::mesh_free(RID p_rid) {
ERR_PRINT("deleting mesh with active instances"); ERR_PRINT("deleting mesh with active instances");
} }
if (mesh->shadow_owners.size()) { if (mesh->shadow_owners.size()) {
for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) { for (Mesh *E : mesh->shadow_owners) {
Mesh *shadow_owner = E->get(); Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID(); shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); 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); mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) { for (Mesh *E : mesh->shadow_owners) {
Mesh *shadow_owner = E->get(); Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID(); shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); 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->has_bone_weights = false;
mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) { for (Mesh *E : mesh->shadow_owners) {
Mesh *shadow_owner = E->get(); Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID(); shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
} }

View File

@ -159,8 +159,8 @@ void RenderingDeviceVulkan::_free_dependencies(RID p_id) {
E = reverse_dependency_map.find(p_id); E = reverse_dependency_map.find(p_id);
if (E) { if (E) {
for (RBSet<RID>::Element *F = E->value.front(); F; F = F->next()) { for (const RID &F : E->value) {
HashMap<RID, RBSet<RID>>::Iterator G = dependency_map.find(F->get()); HashMap<RID, RBSet<RID>>::Iterator G = dependency_map.find(F);
ERR_CONTINUE(!G); ERR_CONTINUE(!G);
ERR_CONTINUE(!G->value.has(p_id)); ERR_CONTINUE(!G->value.has(p_id));
G->value.erase(p_id); G->value.erase(p_id);
@ -5473,9 +5473,9 @@ RenderingDeviceVulkan::DescriptorPool *RenderingDeviceVulkan::_descriptor_pool_a
DescriptorPool *pool = nullptr; DescriptorPool *pool = nullptr;
for (RBSet<DescriptorPool *>::Element *E = descriptor_pools[p_key].front(); E; E = E->next()) { for (DescriptorPool *E : descriptor_pools[p_key]) {
if (E->get()->usage < max_descriptors_per_pool) { if (E->usage < max_descriptors_per_pool) {
pool = E->get(); pool = E;
break; break;
} }
} }
@ -8349,31 +8349,31 @@ void RenderingDeviceVulkan::compute_list_end(uint32_t p_post_barrier) {
uint32_t barrier_idx = 0; 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++]; VkImageMemoryBarrier &image_memory_barrier = image_barriers[barrier_idx++];
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
image_memory_barrier.pNext = nullptr; image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; image_memory_barrier.srcAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
image_memory_barrier.dstAccessMask = access_flags; 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.newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
image_memory_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; image_memory_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
image_memory_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; image_memory_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
image_memory_barrier.image = E->get()->image; image_memory_barrier.image = E->image;
image_memory_barrier.subresourceRange.aspectMask = E->get()->read_aspect_mask; image_memory_barrier.subresourceRange.aspectMask = E->read_aspect_mask;
image_memory_barrier.subresourceRange.baseMipLevel = E->get()->base_mipmap; image_memory_barrier.subresourceRange.baseMipLevel = E->base_mipmap;
image_memory_barrier.subresourceRange.levelCount = E->get()->mipmaps; image_memory_barrier.subresourceRange.levelCount = E->mipmaps;
image_memory_barrier.subresourceRange.baseArrayLayer = E->get()->base_layer; image_memory_barrier.subresourceRange.baseArrayLayer = E->base_layer;
image_memory_barrier.subresourceRange.layerCount = E->get()->layers; image_memory_barrier.subresourceRange.layerCount = E->layers;
E->get()->layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; E->layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
if (E->get()->used_in_frame != frames_drawn) { if (E->used_in_frame != frames_drawn) {
E->get()->used_in_transfer = false; E->used_in_transfer = false;
E->get()->used_in_raster = false; E->used_in_raster = false;
E->get()->used_in_compute = false; E->used_in_compute = false;
E->get()->used_in_frame = frames_drawn; E->used_in_frame = frames_drawn;
} }
} }

View File

@ -747,8 +747,8 @@ void AnimationBezierTrackEdit::_update_locked_tracks_after(int p_track) {
} }
Vector<int> updated_locked_tracks; Vector<int> updated_locked_tracks;
for (RBSet<int>::Element *E = locked_tracks.front(); E; E = E->next()) { for (const int &E : locked_tracks) {
updated_locked_tracks.push_back(E->get()); updated_locked_tracks.push_back(E);
} }
locked_tracks.clear(); locked_tracks.clear();
for (int i = 0; i < updated_locked_tracks.size(); ++i) { 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; Vector<int> updated_hidden_tracks;
for (RBSet<int>::Element *E = hidden_tracks.front(); E; E = E->next()) { for (const int &E : hidden_tracks) {
updated_hidden_tracks.push_back(E->get()); updated_hidden_tracks.push_back(E);
} }
hidden_tracks.clear(); hidden_tracks.clear();
for (int i = 0; i < updated_hidden_tracks.size(); ++i) { for (int i = 0; i < updated_hidden_tracks.size(); ++i) {

View File

@ -138,8 +138,8 @@ bool CreateDialog::_should_hide_type(const String &p_type) const {
return true; // Wrong inheritance. return true; // Wrong inheritance.
} }
for (RBSet<StringName>::Element *E = type_blacklist.front(); E; E = E->next()) { for (const StringName &E : type_blacklist) {
if (ClassDB::is_parent_class(p_type, E->get())) { if (ClassDB::is_parent_class(p_type, E)) {
return true; // Parent type is blacklisted. return true; // Parent type is blacklisted.
} }
} }

View File

@ -193,8 +193,8 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) {
if (old_prop_size == debugObj->prop_list.size() && new_props_added == 0) { if (old_prop_size == debugObj->prop_list.size() && new_props_added == 0) {
//only some may have changed, if so, then update those, if exist //only some may have changed, if so, then update those, if exist
for (RBSet<String>::Element *E = changed.front(); E; E = E->next()) { for (const String &E : changed) {
emit_signal(SNAME("object_property_updated"), debugObj->remote_object_id, E->get()); emit_signal(SNAME("object_property_updated"), debugObj->remote_object_id, E);
} }
} else { } else {
//full update, because props were added or removed //full update, because props were added or removed

View File

@ -118,8 +118,8 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() {
} }
if (!debugger_plugins.is_empty()) { if (!debugger_plugins.is_empty()) {
for (RBSet<Ref<Script>>::Element *i = debugger_plugins.front(); i; i = i->next()) { for (const Ref<Script> &i : debugger_plugins) {
node->add_debugger_plugin(i->get()); node->add_debugger_plugin(i);
} }
} }

View File

@ -198,13 +198,13 @@ void EditorProfiler::_update_plot() {
for (int i = 0; i < total_metrics; i++) { for (int i = 0; i < total_metrics; i++) {
const Metric &m = _get_frame_metric(i); const Metric &m = _get_frame_metric(i);
for (RBSet<StringName>::Element *E = plot_sigs.front(); E; E = E->next()) { for (const StringName &E : plot_sigs) {
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) { if (F) {
highest = MAX(F->value->total_time, highest); 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 (G) {
if (use_self) { if (use_self) {
highest = MAX(G->value->self, highest); highest = MAX(G->value->self, highest);
@ -234,17 +234,17 @@ void EditorProfiler::_update_plot() {
int current = i * frame_metrics.size() / w; 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); const Metric &m = _get_frame_metric(current);
float value = 0; 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) { if (F) {
value = F->value->total_time; 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 (G) {
if (use_self) { if (use_self) {
value = G->value->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 plot_pos = CLAMP(int(value * h / highest), 0, h - 1);
int prev_plot = plot_pos; 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) { if (H) {
prev_plot = H->value; prev_plot = H->value;
H->value = plot_pos; H->value = plot_pos;
} else { } else {
prev_plots[E->get()] = plot_pos; prev_plots[E] = plot_pos;
} }
plot_pos = h - plot_pos - 1; plot_pos = h - plot_pos - 1;
@ -271,7 +271,7 @@ void EditorProfiler::_update_plot() {
SWAP(prev_plot, plot_pos); 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++) { for (int j = prev_plot; j <= plot_pos; j++) {
column[j * 4 + 0] += Math::fast_ftoi(CLAMP(col.r * 255, 0, 255)); 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; Vector<String> signatures;
signatures.resize(possible_signatures.size()); signatures.resize(possible_signatures.size());
int sig_index = 0; int sig_index = 0;
for (const RBSet<StringName>::Element *E = possible_signatures.front(); E; E = E->next()) { for (const StringName &E : possible_signatures) {
signatures.write[sig_index] = E->get(); signatures.write[sig_index] = E;
sig_map[E->get()] = sig_index; sig_map[E] = sig_index;
sig_index++; sig_index++;
} }
res.push_back(signatures); res.push_back(signatures);

View File

@ -154,8 +154,8 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
int num_file_conflicts = 0; int num_file_conflicts = 0;
for (RBSet<String>::Element *E = files_sorted.front(); E; E = E->next()) { for (const String &E : files_sorted) {
String path = E->get(); String path = E;
int depth = p_depth; int depth = p_depth;
bool skip = false; bool skip = false;
while (depth > 0) { while (depth > 0) {
@ -224,7 +224,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
ti->set_metadata(0, res_path); ti->set_metadata(0, res_path);
} }
status_map[E->get()] = ti; status_map[E] = ti;
} }
if (num_file_conflicts >= 1) { if (num_file_conflicts >= 1) {

View File

@ -95,9 +95,9 @@ Ref<EditorExportPlatform> EditorExportPreset::get_platform() const {
void EditorExportPreset::update_files_to_export() { void EditorExportPreset::update_files_to_export() {
Vector<String> to_remove; Vector<String> to_remove;
for (RBSet<String>::Element *E = selected_files.front(); E; E = E->next()) { for (const String &E : selected_files) {
if (!FileAccess::exists(E->get())) { if (!FileAccess::exists(E)) {
to_remove.push_back(E->get()); to_remove.push_back(E);
} }
} }
for (int i = 0; i < to_remove.size(); ++i) { 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> EditorExportPreset::get_files_to_export() const {
Vector<String> files; Vector<String> files;
for (RBSet<String>::Element *E = selected_files.front(); E; E = E->next()) { for (const String &E : selected_files) {
files.push_back(E->get()); files.push_back(E);
} }
return files; return files;
} }
@ -879,8 +879,8 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
int idx = 0; int idx = 0;
int total = paths.size(); int total = paths.size();
for (RBSet<String>::Element *E = paths.front(); E; E = E->next()) { for (const String &E : paths) {
String path = E->get(); String path = E;
String type = ResourceLoader::get_resource_type(path); String type = ResourceLoader::get_resource_type(path);
if (FileAccess::exists(path + ".import")) { if (FileAccess::exists(path + ".import")) {

View File

@ -166,15 +166,15 @@ Error EditorFeatureProfile::save_to_file(const String &p_path) {
Dictionary data; Dictionary data;
data["type"] = "feature_profile"; data["type"] = "feature_profile";
Array dis_classes; Array dis_classes;
for (RBSet<StringName>::Element *E = disabled_classes.front(); E; E = E->next()) { for (const StringName &E : disabled_classes) {
dis_classes.push_back(String(E->get())); dis_classes.push_back(String(E));
} }
dis_classes.sort(); dis_classes.sort();
data["disabled_classes"] = dis_classes; data["disabled_classes"] = dis_classes;
Array dis_editors; Array dis_editors;
for (RBSet<StringName>::Element *E = disabled_editors.front(); E; E = E->next()) { for (const StringName &E : disabled_editors) {
dis_editors.push_back(String(E->get())); dis_editors.push_back(String(E));
} }
dis_editors.sort(); dis_editors.sort();
data["disabled_editors"] = dis_editors; data["disabled_editors"] = dis_editors;
@ -182,8 +182,8 @@ Error EditorFeatureProfile::save_to_file(const String &p_path) {
Array dis_props; Array dis_props;
for (KeyValue<StringName, RBSet<StringName>> &E : disabled_properties) { for (KeyValue<StringName, RBSet<StringName>> &E : disabled_properties) {
for (RBSet<StringName>::Element *F = E.value.front(); F; F = F->next()) { for (const StringName &F : E.value) {
dis_props.push_back(String(E.key) + ":" + String(F->get())); dis_props.push_back(String(E.key) + ":" + String(F));
} }
} }

View File

@ -1458,8 +1458,8 @@ void EditorFileSystem::_save_late_updated_files() {
String fscache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file("filesystem_update4"); String fscache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file("filesystem_update4");
Ref<FileAccess> f = FileAccess::open(fscache, FileAccess::WRITE); Ref<FileAccess> f = FileAccess::open(fscache, FileAccess::WRITE);
ERR_FAIL_COND_MSG(f.is_null(), "Cannot create file '" + fscache + "'. Check user write permissions."); 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()) { for (const String &E : late_update_files) {
f->store_line(E->get()); f->store_line(E);
} }
} }

View File

@ -40,8 +40,8 @@ Vector<String> EditorFolding::_get_unfolds(const Object *p_object) {
if (sections.size()) { if (sections.size()) {
String *w = sections.ptrw(); String *w = sections.ptrw();
int idx = 0; int idx = 0;
for (const RBSet<String>::Element *E = p_object->editor_get_section_folding().front(); E; E = E->next()) { for (const String &E : p_object->editor_get_section_folding()) {
w[idx++] = E->get(); 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()) { for (const String &E : unfold_group) {
p_object->editor_set_section_unfold(E->get(), true); p_object->editor_set_section_unfold(E, true);
} }
} }

View File

@ -231,8 +231,8 @@ void EditorNode::disambiguate_filenames(const Vector<String> p_full_paths, Vecto
RBSet<int> iset = index_sets[i]; RBSet<int> iset = index_sets[i];
while (iset.size() > 1) { while (iset.size() > 1) {
// Append the parent folder to each scene name. // Append the parent folder to each scene name.
for (RBSet<int>::Element *E = iset.front(); E; E = E->next()) { for (const int &E : iset) {
int set_idx = E->get(); int set_idx = E;
String scene_name = r_filenames[set_idx]; String scene_name = r_filenames[set_idx];
String full_path = p_full_paths[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) { while (E) {
String scene_name = r_filenames[E->get()]; String scene_name = r_filenames[E->get()];
bool duplicate_found = false; bool duplicate_found = false;
for (RBSet<int>::Element *F = iset.front(); F; F = F->next()) { for (const int &F : iset) {
if (E->get() == F->get()) { if (E->get() == F) {
continue; continue;
} }
String other_scene_name = r_filenames[F->get()]; String other_scene_name = r_filenames[F];
if (other_scene_name == scene_name) { if (other_scene_name == scene_name) {
duplicate_found = true; duplicate_found = true;
break; break;
@ -907,12 +907,12 @@ void EditorNode::_resources_changed(const Vector<String> &p_resources) {
} }
void EditorNode::_fs_changed() { void EditorNode::_fs_changed() {
for (RBSet<FileDialog *>::Element *E = file_dialogs.front(); E; E = E->next()) { for (FileDialog *E : file_dialogs) {
E->get()->invalidate(); E->invalidate();
} }
for (RBSet<EditorFileDialog *>::Element *E = editor_file_dialogs.front(); E; E = E->next()) { for (EditorFileDialog *E : editor_file_dialogs) {
E->get()->invalidate(); E->invalidate();
} }
_mark_unsaved_scenes(); _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)) { if (!p_ignore_broken_deps && dependency_errors.has(p_resource)) {
Vector<String> errors; Vector<String> errors;
for (RBSet<String>::Element *E = dependency_errors[p_resource].front(); E; E = E->next()) { for (const String &E : dependency_errors[p_resource]) {
errors.push_back(E->get()); errors.push_back(E);
} }
dependency_error->show(DependencyErrorDialog::MODE_RESOURCE, p_resource, errors); dependency_error->show(DependencyErrorDialog::MODE_RESOURCE, p_resource, errors);
dependency_errors.erase(p_resource); 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, // Clear later, because user may have put the same subresource in two different resources,
// which will be shared until the next reload. // which will be shared until the next reload.
for (RBSet<Ref<Resource>>::Element *E = edited_subresources.front(); E; E = E->next()) { for (const Ref<Resource> &E : edited_subresources) {
Ref<Resource> res = E->get(); Ref<Resource> res = E;
res->set_edited(false); 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)) { if (!p_ignore_broken_deps && dependency_errors.has(lpath)) {
current_menu_option = -1; current_menu_option = -1;
Vector<String> errors; Vector<String> errors;
for (RBSet<String>::Element *E = dependency_errors[lpath].front(); E; E = E->next()) { for (const String &E : dependency_errors[lpath]) {
errors.push_back(E->get()); errors.push_back(E);
} }
dependency_error->show(DependencyErrorDialog::MODE_SCENE, lpath, errors); dependency_error->show(DependencyErrorDialog::MODE_SCENE, lpath, errors);
opening_prev = false; 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) { for (KeyValue<String, RBSet<String>> &E : dependency_errors) {
String txt = vformat(TTR("Scene '%s' has broken dependencies:"), E.key) + "\n"; String txt = vformat(TTR("Scene '%s' has broken dependencies:"), E.key) + "\n";
for (RBSet<String>::Element *F = E.value.front(); F; F = F->next()) { for (const String &F : E.value) {
txt += "\t" + F->get() + "\n"; txt += "\t" + F + "\n";
} }
add_io_error(txt); add_io_error(txt);
} }

View File

@ -253,8 +253,8 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
} }
file_dialog->clear_filters(); file_dialog->clear_filters();
for (RBSet<String>::Element *E = valid_extensions.front(); E; E = E->next()) { for (const String &E : valid_extensions) {
file_dialog->add_filter("*." + E->get() + " ; " + E->get().to_upper()); file_dialog->add_filter("*." + E + " ; " + E.to_upper());
} }
file_dialog->popup_file_dialog(); 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"]; custom_resources = EditorNode::get_editor_data().get_custom_types()["Resource"];
} }
for (RBSet<String>::Element *E = allowed_types.front(); E; E = E->next()) { for (const String &E : allowed_types) {
const String &t = E->get(); const String &t = E;
bool is_custom_resource = false; bool is_custom_resource = false;
Ref<Texture2D> icon; 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 { 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()) { for (const String &E : p_allowed_types) {
String at = E->get().strip_edges(); 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)) { 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; 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 the accepted dropped resource is from the extended list, it requires conversion.
if (!_is_type_valid(dropped_resource->get_class(), allowed_types)) { if (!_is_type_valid(dropped_resource->get_class(), allowed_types)) {
for (RBSet<String>::Element *E = allowed_types.front(); E; E = E->next()) { for (const String &E : allowed_types) {
String at = E->get().strip_edges(); String at = E.strip_edges();
if (at == "BaseMaterial3D" && Ref<Texture2D>(dropped_resource).is_valid()) { if (at == "BaseMaterial3D" && Ref<Texture2D>(dropped_resource).is_valid()) {
// Use existing resource if possible and only replace its data. // Use existing resource if possible and only replace its data.

View File

@ -268,25 +268,25 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
vclist.insert(vc); 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; uint32_t pusage = PROPERTY_USAGE_NONE;
if (E->get().save || !optimize_save) { if (E.save || !optimize_save) {
pusage |= PROPERTY_USAGE_STORAGE; 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; pusage |= PROPERTY_USAGE_EDITOR;
} else { } else {
pusage |= PROPERTY_USAGE_STORAGE; //hiddens must always be saved 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; pi.usage = pusage;
if (hints.has(E->get().name)) { if (hints.has(E.name)) {
pi = hints[E->get().name]; pi = hints[E.name];
} }
if (E->get().restart_if_changed) { if (E.restart_if_changed) {
pi.usage |= PROPERTY_USAGE_RESTART_IF_CHANGED; pi.usage |= PROPERTY_USAGE_RESTART_IF_CHANGED;
} }

View File

@ -96,8 +96,8 @@ void EditorTranslationParser::get_recognized_extensions(List<String> *r_extensio
for (int i = 0; i < temp.size(); i++) { for (int i = 0; i < temp.size(); i++) {
extensions.insert(temp[i]); extensions.insert(temp[i]);
} }
for (RBSet<String>::Element *E = extensions.front(); E; E = E->next()) { for (const String &E : extensions) {
r_extensions->push_back(E->get()); r_extensions->push_back(E);
} }
} }

View File

@ -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 Vector<Collada::Vertex> vertex_array; //there we go, vertex array
vertex_array.resize(vertex_set.size()); vertex_array.resize(vertex_set.size());
for (RBSet<Collada::Vertex>::Element *F = vertex_set.front(); F; F = F->next()) { for (Collada::Vertex &F : vertex_set) {
vertex_array.write[F->get().idx] = F->get(); vertex_array.write[F.idx] = F;
} }
if (has_weights) { if (has_weights) {
@ -1507,14 +1507,14 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
bool tracks_found = false; 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 // take snapshots
if (!collada.state.scene_map.has(E->get())) { if (!collada.state.scene_map.has(E)) {
continue; continue;
} }
NodeMap &nm = node_map[E->get()]; NodeMap &nm = node_map[E];
String path = scene->get_path_to(nm.node); String path = scene->get_path_to(nm.node);
if (nm.bone >= 0) { if (nm.bone >= 0) {
@ -1525,7 +1525,7 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
bool found_anim = false; 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) { if (cn->ignore_anim) {
continue; continue;
} }
@ -1665,7 +1665,7 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
if (nm.bone >= 0) { if (nm.bone >= 0) {
if (found_anim) { if (found_anim) {
bones_with_animation[E->get()] = true; bones_with_animation[E] = true;
} }
} }

View File

@ -603,8 +603,8 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
HashMap<String, TreeItem *> parenthood; HashMap<String, TreeItem *> parenthood;
for (RBSet<String>::Element *E = paths.front(); E; E = E->next()) { for (const String &E : paths) {
NodePath path = E->get(); NodePath path = E;
TreeItem *ti = nullptr; TreeItem *ti = nullptr;
String accum; String accum;
for (int i = 0; i < path.get_name_count(); i++) { for (int i = 0; i < path.get_name_count(); i++) {

View File

@ -6710,8 +6710,8 @@ RBSet<RID> _get_physics_bodies_rid(Node *node) {
rids.insert(pb->get_rid()); rids.insert(pb->get_rid());
} }
RBSet<PhysicsBody3D *> child_nodes = _get_child_nodes<PhysicsBody3D>(node); RBSet<PhysicsBody3D *> child_nodes = _get_child_nodes<PhysicsBody3D>(node);
for (RBSet<PhysicsBody3D *>::Element *I = child_nodes.front(); I; I = I->next()) { for (const PhysicsBody3D *I : child_nodes) {
rids.insert(I->get()->get_rid()); rids.insert(I->get_rid());
} }
return rids; return rids;
@ -6755,8 +6755,8 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
} }
if (!found_valid_shape && vi.size()) { if (!found_valid_shape && vi.size()) {
AABB aabb = vi.front()->get()->get_transformed_aabb(); AABB aabb = vi.front()->get()->get_transformed_aabb();
for (RBSet<VisualInstance3D *>::Element *I = vi.front(); I; I = I->next()) { for (const VisualInstance3D *I : vi) {
aabb.merge_with(I->get()->get_transformed_aabb()); aabb.merge_with(I->get_transformed_aabb());
} }
Vector3 size = aabb.size * Vector3(0.5, 0.0, 0.5); Vector3 size = aabb.size * Vector3(0.5, 0.0, 0.5);
from = aabb.position + size; from = aabb.position + size;

View File

@ -83,8 +83,8 @@ void EditorPropertyRootMotion::_node_assign() {
HashMap<String, TreeItem *> parenthood; HashMap<String, TreeItem *> parenthood;
for (RBSet<String>::Element *E = paths.front(); E; E = E->next()) { for (const String &E : paths) {
NodePath path = E->get(); NodePath path = E;
TreeItem *ti = nullptr; TreeItem *ti = nullptr;
String accum; String accum;
for (int i = 0; i < path.get_name_count(); i++) { for (int i = 0; i < path.get_name_count(); i++) {

View File

@ -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); _find_changed_scripts_for_external_editor(base, base, scripts);
} }
for (RBSet<Ref<Script>>::Element *E = scripts.front(); E; E = E->next()) { for (const Ref<Script> &E : scripts) {
Ref<Script> script = E->get(); Ref<Script> script = E;
if (p_for_script.is_valid() && p_for_script != script) { if (p_for_script.is_valid() && p_for_script != script) {
continue; continue;

View File

@ -125,8 +125,8 @@ void SpriteFramesEditor::_sheet_preview_draw() {
Color accent = get_theme_color("accent_color", "Editor"); Color accent = get_theme_color("accent_color", "Editor");
for (RBSet<int>::Element *E = frames_selected.front(); E; E = E->next()) { for (const int &E : frames_selected) {
const int idx = E->get(); const int idx = E;
const int x = idx % frame_count.x; const int x = idx % frame_count.x;
const int y = idx / frame_count.x; const int y = idx / frame_count.x;
const Point2 pos = draw_offset + Point2(x, y) * (draw_frame_size + draw_sep); 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); int fc = frames->get_frame_count(edited_anim);
for (RBSet<int>::Element *E = frames_selected.front(); E; E = E->next()) { for (const int &E : frames_selected) {
int idx = E->get(); int idx = E;
const Point2 frame_coords(idx % frame_count.x, idx / frame_count.x); const Point2 frame_coords(idx % frame_count.x, idx / frame_count.x);
Ref<AtlasTexture> at; Ref<AtlasTexture> at;

View File

@ -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()) { for (const TileMapCell &E : edited) {
Vector2i coords = E->get().get_atlas_coords(); 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_rect(p_tile_set_atlas_source->get_tile_texture_region(coords), selection_color, false);
} }
p_canvas_item->draw_set_transform_matrix(Transform2D()); 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()) { for (const TileMapCell &E : edited) {
Vector2i coords = E->get().get_atlas_coords(); 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_rect(p_tile_set_atlas_source->get_tile_texture_region(coords), selection_color, false);
} }
p_canvas_item->draw_set_transform_matrix(Transform2D()); 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); p_canvas_item->draw_set_transform_matrix(p_transform);
for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) { for (const TileMapCell &E : edited) {
Vector2i coords = E->get().get_atlas_coords(); Vector2i coords = E.get_atlas_coords();
Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(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); 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")); undo_redo->create_action(TTR("Painting Terrain Set"));
for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) { for (const TileMapCell &E : edited) {
Vector2i coords = E->get().get_atlas_coords(); Vector2i coords = E.get_atlas_coords();
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0); 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_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->get().alternative_tile), drag_painted_value); 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++) { for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
if (tile_data->is_valid_peering_bit_terrain(bit)) { 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)); mouse_pos_rect_polygon.push_back(Vector2(drag_start_pos.x, mb->get_position().y));
undo_redo->create_action(TTR("Painting Terrain")); undo_redo->create_action(TTR("Painting Terrain"));
for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) { for (const TileMapCell &E : edited) {
Vector2i coords = E->get().get_atlas_coords(); Vector2i coords = E.get_atlas_coords();
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0); TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0);
for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { 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()) { if (!Geometry2D::intersect_polygons(polygon, mouse_pos_rect_polygon).is_empty()) {
// Draw bit. // 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_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->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));
} }
} }
} }

View File

@ -501,8 +501,8 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
if (!tile_map_selection.is_empty()) { if (!tile_map_selection.is_empty()) {
tile_map_clipboard.instantiate(); tile_map_clipboard.instantiate();
TypedArray<Vector2i> coords_array; TypedArray<Vector2i> coords_array;
for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) { for (const Vector2i &E : tile_map_selection) {
coords_array.push_back(E->get()); coords_array.push_back(E);
} }
tile_map_clipboard = tile_map->get_pattern(tile_map_layer, coords_array); 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. // Delete selected tiles.
if (!tile_map_selection.is_empty()) { if (!tile_map_selection.is_empty()) {
undo_redo->create_action(TTR("Delete tiles")); undo_redo->create_action(TTR("Delete tiles"));
for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) { for (const Vector2i &E : tile_map_selection) {
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_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->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())); 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()); undo_redo->add_undo_method(this, "_set_tile_map_selection", _get_tile_map_selection());
tile_map_selection.clear(); tile_map_selection.clear();
@ -542,9 +542,9 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
// Delete selected tiles. // Delete selected tiles.
if (!tile_map_selection.is_empty()) { if (!tile_map_selection.is_empty()) {
undo_redo->create_action(TTR("Delete tiles")); undo_redo->create_action(TTR("Delete tiles"));
for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) { for (const Vector2i &E : tile_map_selection) {
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_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->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())); 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()); undo_redo->add_undo_method(this, "_set_tile_map_selection", _get_tile_map_selection());
tile_map_selection.clear(); 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. _update_selection_pattern_from_tilemap_selection(); // Make sure the pattern is up to date before moving.
drag_type = DRAG_TYPE_MOVE; drag_type = DRAG_TYPE_MOVE;
drag_modified.clear(); drag_modified.clear();
for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) { for (const Vector2i &E : tile_map_selection) {
Vector2i coords = E->get(); Vector2i coords = E;
drag_modified.insert(coords, tile_map->get_cell(tile_map_layer, coords)); 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); 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()) { if (!tile_map_selection.is_empty()) {
top_left = tile_map_selection.front()->get(); top_left = tile_map_selection.front()->get();
} }
for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) { for (const Vector2i &E : tile_map_selection) {
top_left = top_left.min(E->get()); top_left = top_left.min(E);
} }
Vector2i offset = drag_start_mouse_pos - tile_map->map_to_world(top_left); 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); 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()) { if (!tile_map_selection.is_empty()) {
top_left = tile_map_selection.front()->get(); top_left = tile_map_selection.front()->get();
} }
for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) { for (const Vector2i &E : tile_map_selection) {
top_left = top_left.min(E->get()); top_left = top_left.min(E);
} }
// Get the offset from the mouse. // Get the offset from the mouse.
@ -1534,8 +1534,8 @@ void TileMapEditorTilesPlugin::_update_selection_pattern_from_tilemap_selection(
selection_pattern.instantiate(); selection_pattern.instantiate();
TypedArray<Vector2i> coords_array; TypedArray<Vector2i> coords_array;
for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) { for (const Vector2i &E : tile_map_selection) {
coords_array.push_back(E->get()); coords_array.push_back(E);
} }
selection_pattern = tile_map->get_pattern(tile_map_layer, coords_array); 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. // Group per source.
HashMap<int, List<const TileMapCell *>> per_source; HashMap<int, List<const TileMapCell *>> per_source;
for (RBSet<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) { for (const TileMapCell &E : tile_set_selection) {
per_source[E->get().source_id].push_back(&(E->get())); per_source[E.source_id].push_back(&(E));
} }
int vertical_offset = 0; int vertical_offset = 0;
@ -1680,14 +1680,14 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_draw() {
// Draw the selection. // Draw the selection.
Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); 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); 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()) { for (const TileMapCell &E : tile_set_selection) {
if (E->get().source_id == source_id && E->get().alternative_tile == 0) { if (E.source_id == source_id && E.alternative_tile == 0) {
for (int frame = 0; frame < atlas->get_tile_animation_frames_count(E->get().get_atlas_coords()); frame++) { for (int frame = 0; frame < atlas->get_tile_animation_frames_count(E.get_atlas_coords()); frame++) {
Color color = selection_color; Color color = selection_color;
if (frame > 0) { if (frame > 0) {
color.a *= 0.3; 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); Color selection_rect_color = selection_color.lightened(0.2);
for (RBSet<Vector2i>::Element *E = to_draw.front(); E; E = E->next()) { for (const Vector2i &E : to_draw) {
tile_atlas_control->draw_rect(atlas->get_tile_texture_region(E->get()), selection_rect_color, false); 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. // Draw the selection.
for (RBSet<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) { for (const TileMapCell &E : tile_set_selection) {
if (E->get().source_id == source_id && E->get().get_atlas_coords() != TileSetSource::INVALID_ATLAS_COORDS && E->get().alternative_tile > 0) { 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().get_atlas_coords(), E->get().alternative_tile); Rect2i rect = tile_atlas_view->get_alternative_tile_rect(E.get_atlas_coords(), E.alternative_tile);
if (rect != Rect2i()) { if (rect != Rect2i()) {
alternative_tiles_control->draw_rect(rect, Color(0.2, 0.2, 1.0), false); 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> TileMapEditorTilesPlugin::_get_tile_map_selection() const {
TypedArray<Vector2i> output; TypedArray<Vector2i> output;
for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) { for (const Vector2i &E : tile_map_selection) {
output.push_back(E->get()); output.push_back(E);
} }
return output; return output;
} }
@ -2341,8 +2341,8 @@ HashMap<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const
TileSet::TerrainsPattern terrains_pattern = E_to_paint.value; 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); 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()) { for (const TileMap::TerrainConstraint &E : cell_constraints) {
added_tiles_constraints_set.insert(E->get()); 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. // Filter the sources to make sure they are in the potential_to_replace.
RBMap<TileMap::TerrainConstraint, RBSet<Vector2i>> per_constraint_tiles; RBMap<TileMap::TerrainConstraint, RBSet<Vector2i>> per_constraint_tiles;
for (RBSet<TileMap::TerrainConstraint>::Element *E = removed_cells_constraints_set.front(); E; E = E->next()) { for (const TileMap::TerrainConstraint &E : removed_cells_constraints_set) {
HashMap<Vector2i, TileSet::CellNeighbor> sources_of_constraint = E->get().get_overlapping_coords_and_peering_bits(); 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) { 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)) { 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; to_replace_modified = false;
for (RBSet<TileMap::TerrainConstraint>::Element *E = added_tiles_constraints_set.front(); E; E = E->next()) { for (const TileMap::TerrainConstraint &E : added_tiles_constraints_set) {
TileMap::TerrainConstraint c = E->get(); TileMap::TerrainConstraint c = E;
// Check if we have a conflict in constraints. // 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 (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. // 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. // Combine all constraints together.
RBSet<TileMap::TerrainConstraint> constraints = removed_cells_constraints_set; RBSet<TileMap::TerrainConstraint> constraints = removed_cells_constraints_set;
for (RBSet<TileMap::TerrainConstraint>::Element *E = added_tiles_constraints_set.front(); E; E = E->next()) { for (const TileMap::TerrainConstraint &E : added_tiles_constraints_set) {
constraints.insert(E->get()); constraints.insert(E);
} }
// Remove the central tiles from the ones to replace. // 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. // Sort the items in a map by the number of corresponding terrains.
RBMap<int, RBSet<TileSet::TerrainsPattern>> sorted; 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. // Count the number of matching sides/terrains.
int count = 0; int count = 0;
for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
TileSet::CellNeighbor bit = TileSet::CellNeighbor(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++; 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 (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()) { for (const TileSet::TerrainsPattern &E : E_set->get()) {
TileSet::TerrainsPattern terrains_pattern = E->get(); TileSet::TerrainsPattern terrains_pattern = E;
// Get the icon. // Get the icon.
Ref<Texture2D> icon; Ref<Texture2D> icon;

View File

@ -270,9 +270,9 @@ bool TileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_na
// Other properties. // Other properties.
bool any_valid = false; bool any_valid = false;
for (RBSet<TileSelection>::Element *E = tiles.front(); E; E = E->next()) { for (const TileSelection &E : tiles) {
const Vector2i &coords = E->get().tile; const Vector2i &coords = E.tile;
const int &alternative = E->get().alternative; const int &alternative = E.alternative;
bool valid = false; bool valid = false;
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative); 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. // 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. // Note: It's a little bit annoying, but the behavior is the same the one in MultiNodeEdit.
const Vector2i &coords = E->get().tile; const Vector2i &coords = E.tile;
const int &alternative = E->get().alternative; const int &alternative = E.alternative;
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative); TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
ERR_FAIL_COND_V(!tile_data, false); ERR_FAIL_COND_V(!tile_data, false);
@ -429,9 +429,9 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
RBMap<PropertyId, PLData> usage; RBMap<PropertyId, PLData> usage;
List<PLData *> data_list; List<PLData *> data_list;
for (RBSet<TileSelection>::Element *E = tiles.front(); E; E = E->next()) { for (const TileSelection &E : tiles) {
const Vector2i &coords = E->get().tile; const Vector2i &coords = E.tile;
const int &alternative = E->get().alternative; const int &alternative = E.alternative;
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative); TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
ERR_FAIL_COND(!tile_data); 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) { 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_tile_set_atlas_source);
ERR_FAIL_COND(p_tiles.is_empty()); ERR_FAIL_COND(p_tiles.is_empty());
for (RBSet<TileSelection>::Element *E = p_tiles.front(); E; E = E->next()) { for (const TileSelection &E : p_tiles) {
ERR_FAIL_COND(E->get().tile == TileSetSource::INVALID_ATLAS_COORDS); ERR_FAIL_COND(E.tile == TileSetSource::INVALID_ATLAS_COORDS);
ERR_FAIL_COND(E->get().alternative < 0); ERR_FAIL_COND(E.alternative < 0);
} }
// Disconnect to changes. // Disconnect to changes.
for (RBSet<TileSelection>::Element *E = tiles.front(); E; E = E->next()) { for (const TileSelection &E : tiles) {
const Vector2i &coords = E->get().tile; const Vector2i &coords = E.tile;
const int &alternative = E->get().alternative; 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)) { 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); 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); tiles = RBSet<TileSelection>(p_tiles);
// Connect to changes. // Connect to changes.
for (RBSet<TileSelection>::Element *E = p_tiles.front(); E; E = E->next()) { for (const TileSelection &E : p_tiles) {
const Vector2i &coords = E->get().tile; const Vector2i &coords = E.tile;
const int &alternative = E->get().alternative; const int &alternative = E.alternative;
if (tile_set_atlas_source->has_tile(coords) && tile_set_atlas_source->has_alternative_tile(coords, 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); TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
@ -1313,9 +1313,9 @@ void TileSetAtlasSourceEditor::_end_dragging() {
switch (drag_type) { switch (drag_type) {
case DRAG_TYPE_CREATE_TILES: case DRAG_TYPE_CREATE_TILES:
undo_redo->create_action(TTR("Create tiles")); undo_redo->create_action(TTR("Create tiles"));
for (RBSet<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) { for (const Vector2i &E : drag_modified_tiles) {
undo_redo->add_do_method(tile_set_atlas_source, "create_tile", E->get()); undo_redo->add_do_method(tile_set_atlas_source, "create_tile", E);
undo_redo->add_undo_method(tile_set_atlas_source, "remove_tile", E->get()); undo_redo->add_undo_method(tile_set_atlas_source, "remove_tile", E);
} }
undo_redo->commit_action(false); undo_redo->commit_action(false);
break; break;
@ -1330,8 +1330,8 @@ void TileSetAtlasSourceEditor::_end_dragging() {
tile_set_atlas_source->get_property_list(&list); tile_set_atlas_source->get_property_list(&list);
HashMap<Vector2i, List<const PropertyInfo *>> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source); HashMap<Vector2i, List<const PropertyInfo *>> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source);
undo_redo->create_action(TTR("Remove tiles")); undo_redo->create_action(TTR("Remove tiles"));
for (RBSet<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) { for (const Vector2i &E : drag_modified_tiles) {
Vector2i coords = E->get(); Vector2i coords = E;
undo_redo->add_do_method(tile_set_atlas_source, "remove_tile", coords); undo_redo->add_do_method(tile_set_atlas_source, "remove_tile", coords);
undo_redo->add_undo_method(tile_set_atlas_source, "create_tile", coords); undo_redo->add_undo_method(tile_set_atlas_source, "create_tile", coords);
if (per_tile.has(coords)) { if (per_tile.has(coords)) {
@ -1384,8 +1384,8 @@ void TileSetAtlasSourceEditor::_end_dragging() {
undo_redo->create_action(TTR("Remove tiles")); undo_redo->create_action(TTR("Remove tiles"));
undo_redo->add_do_method(this, "_set_selection_from_array", Array()); undo_redo->add_do_method(this, "_set_selection_from_array", Array());
for (RBSet<Vector2i>::Element *E = to_delete.front(); E; E = E->next()) { for (const Vector2i &E : to_delete) {
Vector2i coords = E->get(); Vector2i coords = E;
undo_redo->add_do_method(tile_set_atlas_source, "remove_tile", coords); undo_redo->add_do_method(tile_set_atlas_source, "remove_tile", coords);
undo_redo->add_undo_method(tile_set_atlas_source, "create_tile", coords); undo_redo->add_undo_method(tile_set_atlas_source, "create_tile", coords);
if (per_tile.has(coords)) { if (per_tile.has(coords)) {
@ -1549,8 +1549,8 @@ void TileSetAtlasSourceEditor::_menu_option(int p_option) {
// Remove tiles // Remove tiles
RBSet<Vector2i> removed; RBSet<Vector2i> removed;
for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) { for (const TileSelection &E : selection) {
TileSelection selected = E->get(); TileSelection selected = E;
if (selected.alternative == 0) { if (selected.alternative == 0) {
// Remove a tile. // Remove a tile.
undo_redo->add_do_method(tile_set_atlas_source, "remove_tile", selected.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 // Remove alternatives
for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) { for (const TileSelection &E : selection) {
TileSelection selected = E->get(); TileSelection selected = E;
if (selected.alternative > 0 && !removed.has(selected.tile)) { if (selected.alternative > 0 && !removed.has(selected.tile)) {
// Remove an alternative tile. // Remove an alternative tile.
undo_redo->add_do_method(tile_set_atlas_source, "remove_alternative_tile", selected.tile, selected.alternative); 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: { case TILE_CREATE_ALTERNATIVE: {
undo_redo->create_action(TTR("Create tile alternatives")); undo_redo->create_action(TTR("Create tile alternatives"));
Array array; Array array;
for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) { for (const TileSelection &E : selection) {
if (E->get().alternative == 0) { if (E.alternative == 0) {
int next_id = tile_set_atlas_source->get_next_alternative_tile_id(E->get().tile); 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->get().tile, next_id); undo_redo->add_do_method(tile_set_atlas_source, "create_alternative_tile", E.tile, next_id);
array.push_back(E->get().tile); array.push_back(E.tile);
array.push_back(next_id); 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); 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 TileSetAtlasSourceEditor::_get_selection_as_array() {
Array output; Array output;
for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) { for (const TileSelection &E : selection) {
output.push_back(E->get().tile); output.push_back(E.tile);
output.push_back(E->get().alternative); output.push_back(E.alternative);
} }
return output; return output;
} }
@ -1672,8 +1672,8 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() {
// Draw the selected tile. // Draw the selected tile.
if (tools_button_group->get_pressed_button() == tool_select_button) { if (tools_button_group->get_pressed_button() == tool_select_button) {
for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) { for (const TileSelection &E : selection) {
TileSelection selected = E->get(); TileSelection selected = E;
if (selected.alternative == 0) { if (selected.alternative == 0) {
// Draw the rect. // Draw the rect.
for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(selected.tile); frame++) { 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) { if (drag_type == DRAG_TYPE_REMOVE_TILES) {
// Draw the tiles to be removed. // Draw the tiles to be removed.
for (RBSet<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) { for (const Vector2i &E : drag_modified_tiles) {
for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(E->get()); frame++) { 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->get(), frame), Color(0.0, 0.0, 0.0), false); 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) { } 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()) { for (const Vector2i &E : to_paint) {
Vector2i coords = E->get(); Vector2i coords = E;
tile_atlas_control->draw_rect(tile_set_atlas_source->get_tile_texture_region(coords), color, false); 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) { } 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. // Draw the selection on top of other.
if (tools_button_group->get_pressed_button() == tool_select_button) { if (tools_button_group->get_pressed_button() == tool_select_button) {
for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) { for (const TileSelection &E : selection) {
if (E->get().alternative != 0) { if (E.alternative != 0) {
continue; continue;
} }
Rect2i texture_region = tile_set_atlas_source->get_tile_texture_region(E->get().tile); 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->get().tile, 0); 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(); Transform2D xform = tile_atlas_control->get_parent_control()->get_transform();
xform.translate(position); xform.translate(position);
TileMapCell cell; TileMapCell cell;
cell.source_id = tile_set_atlas_source_id; 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; cell.alternative_tile = 0;
current_tile_data_editor->draw_over_tile(tile_atlas_control_unscaled, xform, cell, true); 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. // Draw selected tile.
for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) { for (const TileSelection &E : selection) {
TileSelection selected = E->get(); TileSelection selected = E;
if (selected.alternative >= 1) { if (selected.alternative >= 1) {
Rect2i rect = tile_atlas_view->get_alternative_tile_rect(selected.tile, selected.alternative); Rect2i rect = tile_atlas_view->get_alternative_tile_rect(selected.tile, selected.alternative);
if (rect != Rect2i()) { if (rect != Rect2i()) {
@ -2005,11 +2005,11 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_unscaled_draw() {
// Draw the selection on top of other. // Draw the selection on top of other.
if (tools_button_group->get_pressed_button() == tool_select_button) { if (tools_button_group->get_pressed_button() == tool_select_button) {
for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) { for (const TileSelection &E : selection) {
if (E->get().alternative == 0) { if (E.alternative == 0) {
continue; 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(); Vector2 position = rect.get_center();
Transform2D xform = alternative_tiles_control->get_parent_control()->get_transform(); Transform2D xform = alternative_tiles_control->get_parent_control()->get_transform();
@ -2017,8 +2017,8 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_unscaled_draw() {
TileMapCell cell; TileMapCell cell;
cell.source_id = tile_set_atlas_source_id; cell.source_id = tile_set_atlas_source_id;
cell.set_atlas_coords(E->get().tile); cell.set_atlas_coords(E.tile);
cell.alternative_tile = E->get().alternative; cell.alternative_tile = E.alternative;
current_tile_data_editor->draw_over_tile(alternative_tiles_control_unscaled, xform, cell, true); current_tile_data_editor->draw_over_tile(alternative_tiles_control_unscaled, xform, cell, true);
} }
} }

View File

@ -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; const RBSet<int> &current_set = p_vice_versa ? selected_uniforms : selected_constants;
RBSet<String> deleted_names; RBSet<String> deleted_names;
for (RBSet<int>::Element *E = current_set.front(); E; E = E->next()) { for (const int &E : current_set) {
int node_id = E->get(); int node_id = E;
Ref<VisualShaderNode> node = visual_shader->get_node(type_id, node_id); Ref<VisualShaderNode> node = visual_shader->get_node(type_id, node_id);
bool caught = false; bool caught = false;
Variant var; Variant var;

View File

@ -46,8 +46,8 @@ void POTGenerator::_print_all_translation_strings() {
print_line("msgid: " + E.key()); print_line("msgid: " + E.key());
print_line("context: " + v_md[i].ctx); print_line("context: " + v_md[i].ctx);
print_line("msgid_plural: " + v_md[i].plural); print_line("msgid_plural: " + v_md[i].plural);
for (RBSet<String>::Element *F = v_md[i].locations.front(); F; F = F->next()) { for (const String &F : v_md[i].locations) {
print_line("location: " + F->get()); print_line("location: " + F);
} }
} }
} }
@ -133,8 +133,8 @@ void POTGenerator::_write_to_pot(const String &p_file) {
file->store_line(""); file->store_line("");
// Write file locations. // Write file locations.
for (RBSet<String>::Element *E = locations.front(); E; E = E->next()) { for (const String &E : locations) {
file->store_line("#: " + E->get().trim_prefix("res://")); file->store_line("#: " + E.trim_prefix("res://"));
} }
// Write context. // Write context.

View File

@ -2099,8 +2099,8 @@ void ProjectManager::_open_selected_projects() {
const RBSet<String> &selected_list = _project_list->get_selected_project_keys(); const RBSet<String> &selected_list = _project_list->get_selected_project_keys();
for (const RBSet<String>::Element *E = selected_list.front(); E; E = E->next()) { for (const String &E : selected_list) {
const String &selected = E->get(); const String &selected = E;
String path = EditorSettings::get_singleton()->get("projects/" + selected); String path = EditorSettings::get_singleton()->get("projects/" + selected);
String conf = path.plus_file("project.godot"); String conf = path.plus_file("project.godot");
@ -2327,8 +2327,8 @@ void ProjectManager::_rename_project() {
return; return;
} }
for (RBSet<String>::Element *E = selected_list.front(); E; E = E->next()) { for (const String &E : selected_list) {
const String &selected = E->get(); const String &selected = E;
String path = EditorSettings::get_singleton()->get("projects/" + selected); String path = EditorSettings::get_singleton()->get("projects/" + selected);
npdialog->set_project_path(path); npdialog->set_project_path(path);
npdialog->set_mode(ProjectDialog::MODE_RENAME); npdialog->set_mode(ProjectDialog::MODE_RENAME);
@ -2412,8 +2412,8 @@ void ProjectManager::_files_dropped(PackedStringArray p_files) {
} }
if (folders_set.size() > 0) { if (folders_set.size() > 0) {
PackedStringArray folders; PackedStringArray folders;
for (RBSet<String>::Element *E = folders_set.front(); E; E = E->next()) { for (const String &E : folders_set) {
folders.push_back(E->get()); folders.push_back(E);
} }
bool confirm = true; bool confirm = true;

View File

@ -292,8 +292,8 @@ void ProjectSettingsEditor::_add_feature_overrides() {
feature_box->clear(); feature_box->clear();
feature_box->add_item(TTR("(All)"), 0); // So it is always on top. feature_box->add_item(TTR("(All)"), 0); // So it is always on top.
int id = 1; int id = 1;
for (RBSet<String>::Element *E = presets.front(); E; E = E->next()) { for (const String &E : presets) {
feature_box->add_item(E->get(), id++); feature_box->add_item(E, id++);
} }
} }

View File

@ -143,8 +143,8 @@ void CustomPropertyEditor::_menu_option(int p_which) {
} }
file->clear_filters(); file->clear_filters();
for (RBSet<String>::Element *E = valid_extensions.front(); E; E = E->next()) { for (const String &E : valid_extensions) {
file->add_filter("*." + E->get() + " ; " + E->get().to_upper()); file->add_filter("*." + E + " ; " + E.to_upper());
} }
file->popup_file_dialog(); file->popup_file_dialog();
@ -890,8 +890,8 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
E = E->next(); E = E->next();
} }
for (RBSet<String>::Element *j = valid_inheritors.front(); j; j = j->next()) { for (const String &j : valid_inheritors) {
const String &t = j->get(); const String &t = j;
bool is_custom_resource = false; bool is_custom_resource = false;
Ref<Texture2D> icon; Ref<Texture2D> icon;

View File

@ -2189,10 +2189,10 @@ bool Main::start() {
print_line("Merging docs..."); print_line("Merging docs...");
doc.merge_from(docsrc); doc.merge_from(docsrc);
for (RBSet<String>::Element *E = checked_paths.front(); E; E = E->next()) { for (const String &E : checked_paths) {
print_line("Erasing old docs at: " + E->get()); print_line("Erasing old docs at: " + E);
err = DocTools::erase_classes(E->get()); err = DocTools::erase_classes(E);
ERR_FAIL_COND_V_MSG(err != OK, false, "Error erasing old docs at: " + E->get() + ": " + itos(err)); ERR_FAIL_COND_V_MSG(err != OK, false, "Error erasing old docs at: " + E + ": " + itos(err));
} }
print_line("Generating new docs..."); print_line("Generating new docs...");

View File

@ -764,8 +764,8 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
_update_exports_values(values, propnames); _update_exports_values(values, propnames);
if (changed) { if (changed) {
for (RBSet<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) { for (PlaceHolderScriptInstance *E : placeholders) {
E->get()->update(propnames, values); E->update(propnames, values);
} }
} else { } else {
p_instance_to_update->update(propnames, values); p_instance_to_update->update(propnames, values);
@ -790,8 +790,8 @@ void GDScript::update_exports() {
RBSet<ObjectID> copy = inheriters_cache; //might get modified RBSet<ObjectID> copy = inheriters_cache; //might get modified
for (RBSet<ObjectID>::Element *E = copy.front(); E; E = E->next()) { for (const ObjectID &E : copy) {
Object *id = ObjectDB::get_instance(E->get()); Object *id = ObjectDB::get_instance(E);
GDScript *s = Object::cast_to<GDScript>(id); GDScript *s = Object::cast_to<GDScript>(id);
if (!s) { if (!s) {
continue; continue;
@ -939,8 +939,8 @@ void GDScript::get_constants(HashMap<StringName, Variant> *p_constants) {
void GDScript::get_members(RBSet<StringName> *p_members) { void GDScript::get_members(RBSet<StringName> *p_members) {
if (p_members) { if (p_members) {
for (RBSet<StringName>::Element *E = members.front(); E; E = E->next()) { for (const StringName &E : members) {
p_members->insert(E->get()); p_members->insert(E);
} }
} }
} }

View File

@ -794,7 +794,7 @@ GDScriptWorkspace::~GDScriptWorkspace() {
cached_parsers.insert(E.key); cached_parsers.insert(E.key);
} }
for (RBSet<String>::Element *E = cached_parsers.front(); E; E = E->next()) { for (const String &E : cached_parsers) {
remove_cache_parser(E->get()); remove_cache_parser(E);
} }
} }

View File

@ -483,15 +483,15 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
HashMap<int, List<Pair<Transform3D, IndexKey>>> multimesh_items; HashMap<int, List<Pair<Transform3D, IndexKey>>> multimesh_items;
for (RBSet<IndexKey>::Element *E = g.cells.front(); E; E = E->next()) { for (const IndexKey &E : g.cells) {
ERR_CONTINUE(!cell_map.has(E->get())); ERR_CONTINUE(!cell_map.has(E));
const Cell &c = cell_map[E->get()]; const Cell &c = cell_map[E];
if (!mesh_library.is_valid() || !mesh_library->has_item(c.item)) { if (!mesh_library.is_valid() || !mesh_library->has_item(c.item)) {
continue; 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(); Vector3 ofs = _get_offset();
Transform3D xform; Transform3D xform;
@ -507,7 +507,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
Pair<Transform3D, IndexKey> p; Pair<Transform3D, IndexKey> p;
p.first = xform * mesh_library->get_item_mesh_transform(c.item); 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); multimesh_items[c.item].push_back(p);
} }
} }
@ -540,7 +540,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
nm.region = region; nm.region = region;
} }
g.navmesh_ids[E->get()] = nm; g.navmesh_ids[E] = nm;
} }
} }

View File

@ -153,16 +153,16 @@ void LightmapRaycasterEmbree::commit() {
} }
void LightmapRaycasterEmbree::set_mesh_filter(const RBSet<int> &p_mesh_ids) { void LightmapRaycasterEmbree::set_mesh_filter(const RBSet<int> &p_mesh_ids) {
for (RBSet<int>::Element *E = p_mesh_ids.front(); E; E = E->next()) { for (const int &E : p_mesh_ids) {
rtcDisableGeometry(rtcGetGeometry(embree_scene, E->get())); rtcDisableGeometry(rtcGetGeometry(embree_scene, E));
} }
rtcCommitScene(embree_scene); rtcCommitScene(embree_scene);
filter_meshes = p_mesh_ids; filter_meshes = p_mesh_ids;
} }
void LightmapRaycasterEmbree::clear_mesh_filter() { void LightmapRaycasterEmbree::clear_mesh_filter() {
for (RBSet<int>::Element *E = filter_meshes.front(); E; E = E->next()) { for (const int &E : filter_meshes) {
rtcEnableGeometry(rtcGetGeometry(embree_scene, E->get())); rtcEnableGeometry(rtcGetGeometry(embree_scene, E));
} }
rtcCommitScene(embree_scene); rtcCommitScene(embree_scene);
filter_meshes.clear(); filter_meshes.clear();

View File

@ -223,9 +223,9 @@ void RaycastOcclusionCull::occluder_set_mesh(RID p_occluder, const PackedVector3
occluder->vertices = p_vertices; occluder->vertices = p_vertices;
occluder->indices = p_indices; occluder->indices = p_indices;
for (RBSet<InstanceID>::Element *E = occluder->users.front(); E; E = E->next()) { for (const InstanceID &E : occluder->users) {
RID scenario_rid = E->get().scenario; RID scenario_rid = E.scenario;
RID instance_rid = E->get().instance; RID instance_rid = E.instance;
ERR_CONTINUE(!scenarios.has(scenario_rid)); ERR_CONTINUE(!scenarios.has(scenario_rid));
Scenario &scenario = scenarios[scenario_rid]; Scenario &scenario = scenarios[scenario_rid];
ERR_CONTINUE(!scenario.instances.has(instance_rid)); ERR_CONTINUE(!scenario.instances.has(instance_rid));

View File

@ -95,16 +95,16 @@ void StaticRaycasterEmbree::commit() {
} }
void StaticRaycasterEmbree::set_mesh_filter(const RBSet<int> &p_mesh_ids) { void StaticRaycasterEmbree::set_mesh_filter(const RBSet<int> &p_mesh_ids) {
for (RBSet<int>::Element *E = p_mesh_ids.front(); E; E = E->next()) { for (const int &E : p_mesh_ids) {
rtcDisableGeometry(rtcGetGeometry(embree_scene, E->get())); rtcDisableGeometry(rtcGetGeometry(embree_scene, E));
} }
rtcCommitScene(embree_scene); rtcCommitScene(embree_scene);
filter_meshes = p_mesh_ids; filter_meshes = p_mesh_ids;
} }
void StaticRaycasterEmbree::clear_mesh_filter() { void StaticRaycasterEmbree::clear_mesh_filter() {
for (RBSet<int>::Element *E = filter_meshes.front(); E; E = E->next()) { for (const int &E : filter_meshes) {
rtcEnableGeometry(rtcGetGeometry(embree_scene, E->get())); rtcEnableGeometry(rtcGetGeometry(embree_scene, E));
} }
rtcCommitScene(embree_scene); rtcCommitScene(embree_scene);
filter_meshes.clear(); filter_meshes.clear();

View File

@ -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); undo_redo->add_do_method(this, "_update_graph", p_id);
for (const KeyValue<int, RBSet<int>> &E : conn_map) { for (const KeyValue<int, RBSet<int>> &E : conn_map) {
for (const RBSet<int>::Element *F = E.value.front(); F; F = F->next()) { for (const int &F : E.value) {
undo_redo->add_undo_method(script.ptr(), "data_connect", p_id, p_port, E.key, F->get()); 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); 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()) { for (const VisualScript::SequenceConnection &E : clipboard->sequence_connections) {
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_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->get().from_node], E->get().from_output, remap[E->get().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()) { for (const VisualScript::DataConnection &E : clipboard->data_connections) {
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_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->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.from_node], E.from_port, remap[E.to_node], E.to_port);
} }
undo_redo->add_do_method(this, "_update_graph"); undo_redo->add_do_method(this, "_update_graph");
@ -1910,17 +1910,17 @@ void VisualScriptEditor::_on_nodes_duplicate() {
RBSet<int> to_select; RBSet<int> to_select;
HashMap<int, int> remap; 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. // 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); Ref<VisualScriptNode> dupe = node->duplicate(true);
int new_id = idc++; int new_id = idc++;
remap.insert(F->get(), new_id); remap.insert(F, new_id);
to_select.insert(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); 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, // If we still don't have a start node then,
// run through the nodes and select the first tree node, // run through the nodes and select the first tree node,
// i.e. node without any input sequence but output sequence. // i.e. node without any input sequence but output sequence.
for (RBSet<int>::Element *E = nodes_from.front(); E; E = E->next()) { for (const int &E : nodes_from) {
if (!nodes_to.has(E->get())) { if (!nodes_to.has(E)) {
start_node = E->get(); start_node = E;
} }
} }
} }
@ -4272,13 +4272,13 @@ void VisualScriptEditor::_menu_option(int p_what) {
// Move the nodes. // Move the nodes.
// Handles reconnection of sequence connections on undo, start here in case of issues. // 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()) { for (const VisualScript::SequenceConnection &E : seqext) {
undo_redo->add_do_method(script.ptr(), "sequence_disconnect", E->get().from_node, E->get().from_output, E->get().to_node); 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->get().from_node, E->get().from_output, E->get().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()) { for (const VisualScript::DataConnection &E : dataext) {
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_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->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.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. // 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. // Could fail with the new changes, start here when searching for bugs in create function shortcut.
int m = 1; 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; Ref<VisualScriptReturn> ret_node;
ret_node.instantiate(); ret_node.instantiate();
int ret_id = fn_id + (m++); int ret_id = fn_id + (m++);
selections.insert(ret_id); 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_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_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. // 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) { if (vsn.is_valid() && vsn->get_output_value_port_count() > 0) {
ret_node->set_enable_return_value(true); ret_node->set_enable_return_value(true);
// Use the zeroth data port cause that's the likely one that is planned to be used. // 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); 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);
} }
} }

View File

@ -230,12 +230,12 @@ void VisualScript::_node_ports_changed(int p_id) {
{ {
List<SequenceConnection> to_remove; List<SequenceConnection> to_remove;
for (RBSet<SequenceConnection>::Element *E = sequence_connections.front(); E; E = E->next()) { for (const SequenceConnection &E : sequence_connections) {
if (E->get().from_node == p_id && E->get().from_output >= vsn->get_output_sequence_port_count()) { if (E.from_node == p_id && E.from_output >= vsn->get_output_sequence_port_count()) {
to_remove.push_back(E->get()); to_remove.push_back(E);
} }
if (E->get().to_node == p_id && !vsn->has_input_sequence_port()) { if (E.to_node == p_id && !vsn->has_input_sequence_port()) {
to_remove.push_back(E->get()); to_remove.push_back(E);
} }
} }
@ -248,12 +248,12 @@ void VisualScript::_node_ports_changed(int p_id) {
{ {
List<DataConnection> to_remove; List<DataConnection> to_remove;
for (RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) { for (const DataConnection &E : data_connections) {
if (E->get().from_node == p_id && E->get().from_port >= vsn->get_output_value_port_count()) { if (E.from_node == p_id && E.from_port >= vsn->get_output_value_port_count()) {
to_remove.push_back(E->get()); to_remove.push_back(E);
} }
if (E->get().to_node == p_id && E->get().to_port >= vsn->get_input_value_port_count()) { if (E.to_node == p_id && E.to_port >= vsn->get_input_value_port_count()) {
to_remove.push_back(E->get()); to_remove.push_back(E);
} }
} }
@ -292,9 +292,9 @@ void VisualScript::remove_node(int p_id) {
{ {
List<SequenceConnection> to_remove; List<SequenceConnection> to_remove;
for (RBSet<SequenceConnection>::Element *E = sequence_connections.front(); E; E = E->next()) { for (const SequenceConnection &E : sequence_connections) {
if (E->get().from_node == p_id || E->get().to_node == p_id) { if (E.from_node == p_id || E.to_node == p_id) {
to_remove.push_back(E->get()); to_remove.push_back(E);
} }
} }
@ -307,9 +307,9 @@ void VisualScript::remove_node(int p_id) {
{ {
List<DataConnection> to_remove; List<DataConnection> to_remove;
for (RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) { for (const DataConnection &E : data_connections) {
if (E->get().from_node == p_id || E->get().to_node == p_id) { if (E.from_node == p_id || E.to_node == p_id) {
to_remove.push_back(E->get()); 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 { void VisualScript::get_sequence_connection_list(List<SequenceConnection> *r_connection) const {
for (const RBSet<SequenceConnection>::Element *E = sequence_connections.front(); E; E = E->next()) { for (const SequenceConnection &E : sequence_connections) {
r_connection->push_back(E->get()); 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 { 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()) { for (const DataConnection &E : data_connections) {
if (E->get().to_node == p_node && E->get().to_port == p_port) { if (E.to_node == p_node && E.to_port == p_port) {
return true; 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 { 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()) { for (const DataConnection &E : data_connections) {
if (E->get().to_node == p_node && E->get().to_port == p_port) { if (E.to_node == p_node && E.to_port == p_port) {
*r_node = E->get().from_node; *r_node = E.from_node;
*r_port = E->get().from_port; *r_port = E.from_port;
return true; 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 { void VisualScript::get_data_connection_list(List<DataConnection> *r_connection) const {
for (const RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) { for (const DataConnection &E : data_connections) {
r_connection->push_back(E->get()); r_connection->push_back(E);
} }
} }
@ -764,8 +764,8 @@ void VisualScript::_update_placeholders() {
values[p.name] = variables[E.key].default_value; values[p.name] = variables[E.key].default_value;
} }
for (RBSet<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) { for (PlaceHolderScriptInstance *E : placeholders) {
E->get()->update(pinfo, values); E->update(pinfo, values);
} }
} }
@ -1078,19 +1078,19 @@ Dictionary VisualScript::_get_data() const {
d["nodes"] = nds; d["nodes"] = nds;
Array seqconns; Array seqconns;
for (const RBSet<SequenceConnection>::Element *F = sequence_connections.front(); F; F = F->next()) { for (const SequenceConnection &F : sequence_connections) {
seqconns.push_back(F->get().from_node); seqconns.push_back(F.from_node);
seqconns.push_back(F->get().from_output); seqconns.push_back(F.from_output);
seqconns.push_back(F->get().to_node); seqconns.push_back(F.to_node);
} }
d["sequence_connections"] = seqconns; d["sequence_connections"] = seqconns;
Array dataconns; Array dataconns;
for (const RBSet<DataConnection>::Element *F = data_connections.front(); F; F = F->next()) { for (const DataConnection &F : data_connections) {
dataconns.push_back(F->get().from_node); dataconns.push_back(F.from_node);
dataconns.push_back(F->get().from_port); dataconns.push_back(F.from_port);
dataconns.push_back(F->get().to_node); dataconns.push_back(F.to_node);
dataconns.push_back(F->get().to_port); dataconns.push_back(F.to_port);
} }
d["data_connections"] = dataconns; d["data_connections"] = dataconns;
@ -1869,23 +1869,23 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
List<int> nd_queue; List<int> nd_queue;
nd_queue.push_back(function.node); nd_queue.push_back(function.node);
while (!nd_queue.is_empty()) { while (!nd_queue.is_empty()) {
for (const RBSet<VisualScript::SequenceConnection>::Element *F = script->sequence_connections.front(); F; F = F->next()) { for (const VisualScript::SequenceConnection &F : script->sequence_connections) {
if (nd_queue.front()->get() == F->get().from_node && !node_ids.has(F->get().to_node)) { if (nd_queue.front()->get() == F.from_node && !node_ids.has(F.to_node)) {
nd_queue.push_back(F->get().to_node); nd_queue.push_back(F.to_node);
node_ids.insert(F->get().to_node); node_ids.insert(F.to_node);
} }
if (nd_queue.front()->get() == F->get().from_node && !seqconns.has(F->get())) { if (nd_queue.front()->get() == F.from_node && !seqconns.has(F)) {
seqconns.insert(F->get()); seqconns.insert(F);
} }
} }
nd_queue.pop_front(); nd_queue.pop_front();
} }
HashMap<int, HashMap<int, Pair<int, int>>> dc_lut; // :: to -> to_port -> (from, from_port) 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()) { for (const VisualScript::DataConnection &F : script->data_connections) {
dc_lut[F->get().to_node][F->get().to_port] = Pair<int, int>(F->get().from_node, F->get().from_port); 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()) { for (const int &F : node_ids) {
nd_queue.push_back(F->get()); nd_queue.push_back(F);
} }
List<int> dc_keys; List<int> dc_keys;
while (!nd_queue.is_empty()) { 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.. //Multiple passes are required to set up this complex thing..
//First create the nodes. //First create the nodes.
for (const RBSet<int>::Element *F = node_ids.front(); F; F = F->next()) { for (const int &F : node_ids) {
Ref<VisualScriptNode> node = script->nodes[F->get()].node; Ref<VisualScriptNode> node = script->nodes[F].node;
VisualScriptNodeInstance *instance = node->instantiate(this); // Create instance. VisualScriptNodeInstance *instance = node->instantiate(this); // Create instance.
ERR_FAIL_COND(!instance); ERR_FAIL_COND(!instance);
instance->base = node.ptr(); instance->base = node.ptr();
instance->id = F->get(); instance->id = F;
instance->input_port_count = node->get_input_value_port_count(); instance->input_port_count = node->get_input_value_port_count();
instance->input_ports = nullptr; instance->input_ports = nullptr;
instance->output_port_count = node->get_output_value_port_count(); 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_input_args = MAX(max_input_args, instance->input_port_count);
max_output_args = MAX(max_output_args, instance->output_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 function.trash_pos = function.max_stack++; // create pos for trash
// Second pass, do data connections. // Second pass, do data connections.
for (const RBSet<VisualScript::DataConnection>::Element *F = dataconns.front(); F; F = F->next()) { for (const VisualScript::DataConnection &F : dataconns) {
VisualScript::DataConnection dc = F->get(); VisualScript::DataConnection dc = F;
ERR_CONTINUE(!instances.has(dc.from_node)); ERR_CONTINUE(!instances.has(dc.from_node));
VisualScriptNodeInstance *from = instances[dc.from_node]; VisualScriptNodeInstance *from = instances[dc.from_node];
ERR_CONTINUE(!instances.has(dc.to_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. // Third pass, do sequence connections.
for (const RBSet<VisualScript::SequenceConnection>::Element *F = seqconns.front(); F; F = F->next()) { for (const VisualScript::SequenceConnection &F : seqconns) {
VisualScript::SequenceConnection sc = F->get(); VisualScript::SequenceConnection sc = F;
ERR_CONTINUE(!instances.has(sc.from_node)); ERR_CONTINUE(!instances.has(sc.from_node));
VisualScriptNodeInstance *from = instances[sc.from_node]; VisualScriptNodeInstance *from = instances[sc.from_node];
ERR_CONTINUE(!instances.has(sc.to_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: //fourth pass:
// 1) unassigned input ports to default values // 1) unassigned input ports to default values
// 2) connect unassigned output ports to trash // 2) connect unassigned output ports to trash
for (const RBSet<int>::Element *F = node_ids.front(); F; F = F->next()) { for (const int &F : node_ids) {
ERR_CONTINUE(!instances.has(F->get())); ERR_CONTINUE(!instances.has(F));
Ref<VisualScriptNode> node = script->nodes[F->get()].node; Ref<VisualScriptNode> node = script->nodes[F].node;
VisualScriptNodeInstance *instance = instances[F->get()]; VisualScriptNodeInstance *instance = instances[F];
// Connect to default values. // Connect to default values.
for (int i = 0; i < instance->input_port_count; i++) { for (int i = 0; i < instance->input_port_count; i++) {

View File

@ -1350,8 +1350,8 @@ Error EditorExportPlatformIOS::_export_ios_plugins(const Ref<EditorExportPreset>
// Update Linker Flag Values // Update Linker Flag Values
{ {
String result_linker_flags = " "; String result_linker_flags = " ";
for (RBSet<String>::Element *E = plugin_linker_flags.front(); E; E = E->next()) { for (const String &E : plugin_linker_flags) {
const String &flag = E->get(); const String &flag = E;
if (flag.length() == 0) { if (flag.length() == 0) {
continue; continue;

View File

@ -810,8 +810,8 @@ void TileMap::_update_dirty_quadrants() {
for (SelfList<TileMapQuadrant> *q = dirty_quadrant_list.first(); q; q = q->next()) { for (SelfList<TileMapQuadrant> *q = dirty_quadrant_list.first(); q; q = q->next()) {
q->self()->map_to_world.clear(); q->self()->map_to_world.clear();
q->self()->world_to_map.clear(); q->self()->world_to_map.clear();
for (RBSet<Vector2i>::Element *E = q->self()->cells.front(); E; E = E->next()) { for (const Vector2i &E : q->self()->cells) {
Vector2i pk = E->get(); Vector2i pk = E;
Vector2i pk_world_coords = map_to_world(pk); Vector2i pk_world_coords = map_to_world(pk);
q->self()->map_to_world[pk] = pk_world_coords; q->self()->map_to_world[pk] = pk_world_coords;
q->self()->world_to_map[pk_world_coords] = pk; 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. // Draw a placeholder for scenes needing one.
RenderingServer *rs = RenderingServer::get_singleton(); RenderingServer *rs = RenderingServer::get_singleton();
Vector2 quadrant_pos = map_to_world(p_quadrant->coords * get_effective_quadrant_size(p_quadrant->layer)); 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()) { for (const Vector2i &E_cell : p_quadrant->cells) {
const TileMapCell &c = get_cell(p_quadrant->layer, E_cell->get(), true); const TileMapCell &c = get_cell(p_quadrant->layer, E_cell, true);
TileSetSource *source; TileSetSource *source;
if (tile_set->has_source(c.source_id)) { 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. // Draw a placeholder tile.
Transform2D xform; 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_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); 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(); q.bodies.clear();
// Recreate bodies and shapes. // Recreate bodies and shapes.
for (RBSet<Vector2i>::Element *E_cell = q.cells.front(); E_cell; E_cell = E_cell->next()) { for (const Vector2i &E_cell : q.cells) {
TileMapCell c = get_cell(q.layer, E_cell->get(), true); TileMapCell c = get_cell(q.layer, E_cell, true);
TileSetSource *source; TileSetSource *source;
if (tile_set->has_source(c.source_id)) { 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); TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
if (atlas_source) { if (atlas_source) {
const TileData *tile_data; const TileData *tile_data;
if (q.runtime_tile_data_cache.has(E_cell->get())) { if (q.runtime_tile_data_cache.has(E_cell)) {
tile_data = q.runtime_tile_data_cache[E_cell->get()]; tile_data = q.runtime_tile_data_cache[E_cell];
} else { } else {
tile_data = atlas_source->get_tile_data(c.get_atlas_coords(), c.alternative_tile); 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. // Create the body.
RID body = ps->body_create(); 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_mode(body, collision_animatable ? PhysicsServer2D::BODY_MODE_KINEMATIC : PhysicsServer2D::BODY_MODE_STATIC);
ps->body_set_space(body, space); ps->body_set_space(body, space);
Transform2D xform; Transform2D xform;
xform.set_origin(map_to_world(E_cell->get())); xform.set_origin(map_to_world(E_cell));
xform = global_transform * xform; xform = global_transform * xform;
ps->body_set_state(body, PhysicsServer2D::BODY_STATE_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(); q.navigation_regions.clear();
// Get the navigation polygons and create regions. // Get the navigation polygons and create regions.
for (RBSet<Vector2i>::Element *E_cell = q.cells.front(); E_cell; E_cell = E_cell->next()) { for (const Vector2i &E_cell : q.cells) {
TileMapCell c = get_cell(q.layer, E_cell->get(), true); TileMapCell c = get_cell(q.layer, E_cell, true);
TileSetSource *source; TileSetSource *source;
if (tile_set->has_source(c.source_id)) { 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); TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
if (atlas_source) { if (atlas_source) {
const TileData *tile_data; const TileData *tile_data;
if (q.runtime_tile_data_cache.has(E_cell->get())) { if (q.runtime_tile_data_cache.has(E_cell)) {
tile_data = q.runtime_tile_data_cache[E_cell->get()]; tile_data = q.runtime_tile_data_cache[E_cell];
} else { } else {
tile_data = atlas_source->get_tile_data(c.get_atlas_coords(), c.alternative_tile); 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++) { for (int layer_index = 0; layer_index < tile_set->get_navigation_layers_count(); layer_index++) {
Ref<NavigationPolygon> navpoly; Ref<NavigationPolygon> navpoly;
@ -1688,13 +1688,13 @@ void TileMap::_navigation_update_dirty_quadrants(SelfList<TileMapQuadrant>::List
if (navpoly.is_valid()) { if (navpoly.is_valid()) {
Transform2D tile_transform; 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(); 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_map(region, get_world_2d()->get_navigation_map());
NavigationServer2D::get_singleton()->region_set_transform(region, tilemap_xform * tile_transform); NavigationServer2D::get_singleton()->region_set_transform(region, tilemap_xform * tile_transform);
NavigationServer2D::get_singleton()->region_set_navpoly(region, navpoly); 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)); 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()) { for (const Vector2i &E_cell : p_quadrant->cells) {
TileMapCell c = get_cell(p_quadrant->layer, E_cell->get(), true); TileMapCell c = get_cell(p_quadrant->layer, E_cell, true);
TileSetSource *source; TileSetSource *source;
if (tile_set->has_source(c.source_id)) { 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); TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
if (atlas_source) { if (atlas_source) {
const TileData *tile_data; const TileData *tile_data;
if (p_quadrant->runtime_tile_data_cache.has(E_cell->get())) { if (p_quadrant->runtime_tile_data_cache.has(E_cell)) {
tile_data = p_quadrant->runtime_tile_data_cache[E_cell->get()]; tile_data = p_quadrant->runtime_tile_data_cache[E_cell];
} else { } else {
tile_data = atlas_source->get_tile_data(c.get_atlas_coords(), c.alternative_tile); tile_data = atlas_source->get_tile_data(c.get_atlas_coords(), c.alternative_tile);
} }
Transform2D xform; 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_set_transform(p_quadrant->debug_canvas_item, xform);
for (int layer_index = 0; layer_index < tile_set->get_navigation_layers_count(); layer_index++) { 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(); q.scenes.clear();
// Recreate the scenes. // Recreate the scenes.
for (RBSet<Vector2i>::Element *E_cell = q.cells.front(); E_cell; E_cell = E_cell->next()) { for (const Vector2i &E_cell : q.cells) {
const TileMapCell &c = get_cell(q.layer, E_cell->get(), true); const TileMapCell &c = get_cell(q.layer, E_cell, true);
TileSetSource *source; TileSetSource *source;
if (tile_set->has_source(c.source_id)) { 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); Control *scene_as_control = Object::cast_to<Control>(scene);
Node2D *scene_as_node2d = Object::cast_to<Node2D>(scene); Node2D *scene_as_node2d = Object::cast_to<Node2D>(scene);
if (scene_as_control) { 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) { } else if (scene_as_node2d) {
Transform2D xform; 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()); 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. // Draw a placeholder for scenes needing one.
RenderingServer *rs = RenderingServer::get_singleton(); RenderingServer *rs = RenderingServer::get_singleton();
Vector2 quadrant_pos = map_to_world(p_quadrant->coords * get_effective_quadrant_size(p_quadrant->layer)); 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()) { for (const Vector2i &E_cell : p_quadrant->cells) {
const TileMapCell &c = get_cell(p_quadrant->layer, E_cell->get(), true); const TileMapCell &c = get_cell(p_quadrant->layer, E_cell, true);
TileSetSource *source; TileSetSource *source;
if (tile_set->has_source(c.source_id)) { 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. // Draw a placeholder tile.
Transform2D xform; 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_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); 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. // Build a set of dummy constraints get the constrained points.
RBSet<TerrainConstraint> dummy_constraints; 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. for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { // Iterates over sides.
TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); TileSet::CellNeighbor bit = TileSet::CellNeighbor(i);
if (tile_set->is_valid_peering_bit_terrain(p_terrain_set, bit)) { 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. // For each constrained point, we get all overlapping tiles, and select the most adequate terrain for it.
RBSet<TerrainConstraint> constraints; RBSet<TerrainConstraint> constraints;
for (RBSet<TerrainConstraint>::Element *E = dummy_constraints.front(); E; E = E->next()) { for (const TerrainConstraint &E : dummy_constraints) {
TerrainConstraint c = E->get(); TerrainConstraint c = E;
HashMap<int, int> terrain_count; 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. // 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); 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()) { for (const TerrainConstraint &E_constraint : new_constraints) {
constraints.insert(E_constraint->get()); constraints.insert(E_constraint);
} }
// Compute valid tiles again for neighbors. // Compute valid tiles again for neighbors.
@ -2425,8 +2425,8 @@ void TileMap::fix_invalid_tiles() {
coords.insert(E.key); coords.insert(E.key);
} }
} }
for (RBSet<Vector2i>::Element *E = coords.front(); E; E = E->next()) { for (const Vector2i &E : coords) {
set_cell(i, E->get(), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE); 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(); Vector<Vector2> polygon = tile_set->get_tile_shape_polygon();
TileSet::TileShape shape = tile_set->get_tile_shape(); TileSet::TileShape shape = tile_set->get_tile_shape();
for (RBSet<Vector2i>::Element *E = p_cells.front(); E; E = E->next()) { for (const Vector2i &E : p_cells) {
Vector2 center = map_to_world(E->get()); Vector2 center = map_to_world(E);
#define DRAW_SIDE_IF_NEEDED(side, polygon_index_from, polygon_index_to) \ #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 from = p_transform.xform(center + polygon[polygon_index_from] * tile_size); \
Vector2 to = p_transform.xform(center + polygon[polygon_index_to] * tile_size); \ Vector2 to = p_transform.xform(center + polygon[polygon_index_to] * tile_size); \
p_control->draw_line(from, to, p_color); \ p_control->draw_line(from, to, p_color); \

View File

@ -345,9 +345,9 @@ void CollisionObject3D::_update_debug_shapes() {
return; return;
} }
for (RBSet<uint32_t>::Element *shapedata_idx = debug_shapes_to_update.front(); shapedata_idx; shapedata_idx = shapedata_idx->next()) { for (const uint32_t &shapedata_idx : debug_shapes_to_update) {
if (shapes.has(shapedata_idx->get())) { if (shapes.has(shapedata_idx)) {
ShapeData &shapedata = shapes[shapedata_idx->get()]; ShapeData &shapedata = shapes[shapedata_idx];
ShapeData::ShapeBase *shapes = shapedata.shapes.ptrw(); ShapeData::ShapeBase *shapes = shapedata.shapes.ptrw();
for (int i = 0; i < shapedata.shapes.size(); i++) { for (int i = 0; i < shapedata.shapes.size(); i++) {
ShapeData::ShapeBase &s = shapes[i]; ShapeData::ShapeBase &s = shapes[i];

View File

@ -263,19 +263,19 @@ void Skeleton3D::_notification(int p_what) {
force_update_all_bone_transforms(); force_update_all_bone_transforms();
// Update skins. // Update skins.
for (RBSet<SkinReference *>::Element *E = skin_bindings.front(); E; E = E->next()) { for (SkinReference *E : skin_bindings) {
const Skin *skin = E->get()->skin.operator->(); const Skin *skin = E->skin.operator->();
RID skeleton = E->get()->skeleton; RID skeleton = E->skeleton;
uint32_t bind_count = skin->get_bind_count(); 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); RS::get_singleton()->skeleton_allocate_data(skeleton, bind_count);
E->get()->bind_count = bind_count; E->bind_count = bind_count;
E->get()->skin_bone_indices.resize(bind_count); E->skin_bone_indices.resize(bind_count);
E->get()->skin_bone_indices_ptrs = E->get()->skin_bone_indices.ptrw(); 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++) { for (uint32_t i = 0; i < bind_count; i++) {
StringName bind_name = skin->get_bind_name(i); StringName bind_name = skin->get_bind_name(i);
@ -284,7 +284,7 @@ void Skeleton3D::_notification(int p_what) {
bool found = false; bool found = false;
for (int j = 0; j < len; j++) { for (int j = 0; j < len; j++) {
if (bonesptr[j].name == bind_name) { if (bonesptr[j].name == bind_name) {
E->get()->skin_bone_indices_ptrs[i] = j; E->skin_bone_indices_ptrs[i] = j;
found = true; found = true;
break; break;
} }
@ -292,27 +292,27 @@ void Skeleton3D::_notification(int p_what) {
if (!found) { if (!found) {
ERR_PRINT("Skin bind #" + itos(i) + " contains named bind '" + String(bind_name) + "' but Skeleton3D has no bone by that name."); 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) { } else if (skin->get_bind_bone(i) >= 0) {
int bind_index = skin->get_bind_bone(i); int bind_index = skin->get_bind_bone(i);
if (bind_index >= len) { 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) + "."); 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 { } else {
E->get()->skin_bone_indices_ptrs[i] = bind_index; E->skin_bone_indices_ptrs[i] = bind_index;
} }
} else { } else {
ERR_PRINT("Skin bind #" + itos(i) + " does not contain a name nor a bone index."); 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++) { 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); ERR_CONTINUE(bone_index >= (uint32_t)len);
rs->skeleton_bone_set_transform(skeleton, i, bonesptr[bone_index].pose_global * skin->get_bind_pose(i)); 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) { Ref<SkinReference> Skeleton3D::register_skin(const Ref<Skin> &p_skin) {
ERR_FAIL_COND_V(p_skin.is_null(), Ref<SkinReference>()); ERR_FAIL_COND_V(p_skin.is_null(), Ref<SkinReference>());
for (RBSet<SkinReference *>::Element *E = skin_bindings.front(); E; E = E->next()) { for (const SkinReference *E : skin_bindings) {
if (E->get()->skin == p_skin) { if (E->skin == p_skin) {
return Ref<SkinReference>(E->get()); return Ref<SkinReference>(E);
} }
} }
@ -1303,7 +1303,7 @@ Skeleton3D::Skeleton3D() {
Skeleton3D::~Skeleton3D() { Skeleton3D::~Skeleton3D() {
// Some skins may remain bound. // Some skins may remain bound.
for (RBSet<SkinReference *>::Element *E = skin_bindings.front(); E; E = E->next()) { for (SkinReference *E : skin_bindings) {
E->get()->skeleton_node = nullptr; E->skeleton_node = nullptr;
} }
} }

View File

@ -1766,12 +1766,12 @@ void AnimationPlayer::_animation_changed() {
} }
void AnimationPlayer::_stop_playing_caches() { void AnimationPlayer::_stop_playing_caches() {
for (RBSet<TrackNodeCache *>::Element *E = playing_caches.front(); E; E = E->next()) { for (TrackNodeCache *E : playing_caches) {
if (E->get()->node && E->get()->audio_playing) { if (E->node && E->audio_playing) {
E->get()->node->call(SNAME("stop")); E->node->call(SNAME("stop"));
} }
if (E->get()->node && E->get()->animation_playing) { if (E->node && E->animation_playing) {
AnimationPlayer *player = Object::cast_to<AnimationPlayer>(E->get()->node); AnimationPlayer *player = Object::cast_to<AnimationPlayer>(E->node);
if (!player) { if (!player) {
continue; continue;
} }

View File

@ -487,9 +487,9 @@ void AnimationTree::set_active(bool p_active) {
} }
if (!active && is_inside_tree()) { if (!active && is_inside_tree()) {
for (RBSet<TrackCache *>::Element *E = playing_caches.front(); E; E = E->next()) { for (const TrackCache *E : playing_caches) {
if (ObjectDB::get_instance(E->get()->object_id)) { if (ObjectDB::get_instance(E->object_id)) {
E->get()->object->call(SNAME("stop")); E->object->call(SNAME("stop"));
} }
} }

View File

@ -436,11 +436,11 @@ void SceneDebuggerObject::_parse_script_properties(Script *p_script, ScriptInsta
// Members // Members
for (KeyValue<const Script *, RBSet<StringName>> sm : 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; 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() + "/"; 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)); 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 return; //scene not editable
} }
for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) { for (Node *F : E->value) {
Node *n = F->get(); Node *n = F;
if (base && !base->is_ancestor_of(n)) { if (base && !base->is_ancestor_of(n)) {
continue; continue;
@ -673,8 +673,8 @@ void LiveEditor::_node_call_func(int p_id, const StringName &p_method, const Var
return; //scene not editable return; //scene not editable
} }
for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) { for (Node *F : E->value) {
Node *n = F->get(); Node *n = F;
if (base && !base->is_ancestor_of(n)) { if (base && !base->is_ancestor_of(n)) {
continue; continue;
@ -758,8 +758,8 @@ void LiveEditor::_create_node_func(const NodePath &p_parent, const String &p_typ
return; //scene not editable return; //scene not editable
} }
for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) { for (Node *F : E->value) {
Node *n = F->get(); Node *n = F;
if (base && !base->is_ancestor_of(n)) { if (base && !base->is_ancestor_of(n)) {
continue; continue;
@ -802,8 +802,8 @@ void LiveEditor::_instance_node_func(const NodePath &p_parent, const String &p_p
return; //scene not editable return; //scene not editable
} }
for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) { for (Node *F : E->value) {
Node *n = F->get(); Node *n = F;
if (base && !base->is_ancestor_of(n)) { if (base && !base->is_ancestor_of(n)) {
continue; continue;
@ -968,8 +968,8 @@ void LiveEditor::_duplicate_node_func(const NodePath &p_at, const String &p_new_
return; //scene not editable return; //scene not editable
} }
for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) { for (Node *F : E->value) {
Node *n = F->get(); Node *n = F;
if (base && !base->is_ancestor_of(n)) { if (base && !base->is_ancestor_of(n)) {
continue; continue;
@ -1007,8 +1007,8 @@ void LiveEditor::_reparent_node_func(const NodePath &p_at, const NodePath &p_new
return; //scene not editable return; //scene not editable
} }
for (RBSet<Node *>::Element *F = E->value.front(); F; F = F->next()) { for (Node *F : E->value) {
Node *n = F->get(); Node *n = F;
if (base && !base->is_ancestor_of(n)) { if (base && !base->is_ancestor_of(n)) {
continue; continue;

View File

@ -43,12 +43,12 @@ void BaseButton::_unpress_group() {
status.pressed = true; status.pressed = true;
} }
for (RBSet<BaseButton *>::Element *E = button_group->buttons.front(); E; E = E->next()) { for (BaseButton *E : button_group->buttons) {
if (E->get() == this) { if (E == this) {
continue; continue;
} }
E->get()->set_pressed(false); E->set_pressed(false);
} }
} }
@ -485,24 +485,24 @@ BaseButton::~BaseButton() {
} }
void ButtonGroup::get_buttons(List<BaseButton *> *r_buttons) { void ButtonGroup::get_buttons(List<BaseButton *> *r_buttons) {
for (RBSet<BaseButton *>::Element *E = buttons.front(); E; E = E->next()) { for (BaseButton *E : buttons) {
r_buttons->push_back(E->get()); r_buttons->push_back(E);
} }
} }
Array ButtonGroup::_get_buttons() { Array ButtonGroup::_get_buttons() {
Array btns; Array btns;
for (RBSet<BaseButton *>::Element *E = buttons.front(); E; E = E->next()) { for (const BaseButton *E : buttons) {
btns.push_back(E->get()); btns.push_back(E);
} }
return btns; return btns;
} }
BaseButton *ButtonGroup::get_pressed_button() { BaseButton *ButtonGroup::get_pressed_button() {
for (RBSet<BaseButton *>::Element *E = buttons.front(); E; E = E->next()) { for (BaseButton *E : buttons) {
if (E->get()->is_pressed()) { if (E->is_pressed()) {
return E->get(); return E;
} }
} }

View File

@ -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> CodeEdit::get_auto_indent_prefixes() const {
TypedArray<String> prefixes; TypedArray<String> prefixes;
for (const RBSet<char32_t>::Element *E = auto_indent_prefixes.front(); E; E = E->next()) { for (const char32_t &E : auto_indent_prefixes) {
prefixes.push_back(String::chr(E->get())); prefixes.push_back(String::chr(E));
} }
return prefixes; 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> CodeEdit::get_code_completion_prefixes() const {
TypedArray<String> prefixes; TypedArray<String> prefixes;
for (const RBSet<char32_t>::Element *E = code_completion_prefixes.front(); E; E = E->next()) { for (const char32_t &E : code_completion_prefixes) {
prefixes.push_back(String::chr(E->get())); prefixes.push_back(String::chr(E));
} }
return prefixes; return prefixes;
} }

View File

@ -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) { int GraphEdit::_set_operations(SET_OPERATIONS p_operation, RBSet<StringName> &r_u, const RBSet<StringName> &r_v) {
switch (p_operation) { switch (p_operation) {
case GraphEdit::IS_EQUAL: { case GraphEdit::IS_EQUAL: {
for (RBSet<StringName>::Element *E = r_u.front(); E; E = E->next()) { for (const StringName &E : r_u) {
if (!r_v.has(E->get())) { if (!r_v.has(E)) {
return 0; 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()) { if (r_u.size() == r_v.size() && !r_u.size()) {
return 1; return 1;
} }
for (RBSet<StringName>::Element *E = r_u.front(); E; E = E->next()) { for (const StringName &E : r_u) {
if (!r_v.has(E->get())) { if (!r_v.has(E)) {
return 0; return 0;
} }
} }
@ -1726,9 +1726,9 @@ int GraphEdit::_set_operations(SET_OPERATIONS p_operation, RBSet<StringName> &r_
return r_u.size(); return r_u.size();
} break; } break;
case GraphEdit::UNION: { case GraphEdit::UNION: {
for (RBSet<StringName>::Element *E = r_v.front(); E; E = E->next()) { for (const StringName &E : r_v) {
if (!r_u.has(E->get())) { if (!r_u.has(E)) {
r_u.insert(E->get()); r_u.insert(E);
} }
} }
return r_u.size(); 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)) { while (!_set_operations(GraphEdit::IS_EQUAL, q, u)) {
_set_operations(GraphEdit::DIFFERENCE, p, u); _set_operations(GraphEdit::DIFFERENCE, p, u);
for (const RBSet<StringName>::Element *E = p.front(); E; E = E->next()) { for (const StringName &E : p) {
RBSet<StringName> n = r_upper_neighbours[E->get()]; RBSet<StringName> n = r_upper_neighbours[E];
if (_set_operations(GraphEdit::IS_SUBSET, n, z)) { if (_set_operations(GraphEdit::IS_SUBSET, n, z)) {
Vector<StringName> t; Vector<StringName> t;
t.push_back(E->get()); t.push_back(E);
if (!l.has(current_layer)) { if (!l.has(current_layer)) {
l.insert(current_layer, Vector<StringName>{}); 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]); t.append_array(l[current_layer]);
l.insert(current_layer, t); l.insert(current_layer, t);
RBSet<StringName> V; RBSet<StringName> V;
V.insert(E->get()); V.insert(E);
_set_operations(GraphEdit::UNION, u, V); _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) { 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()) { for (const StringName &E : r_selected_nodes) {
r_root[E->get()] = E->get(); r_root[E] = E;
r_align[E->get()] = E->get(); r_align[E] = E;
} }
if (r_layers.size() == 1) { 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) { 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; real_t left = 0;
StringName u = E->get(); StringName u = E;
StringName v = r_align[u]; StringName v = r_align[u];
while (u != v && (StringName)r_root[u] != v) { while (u != v && (StringName)r_root[u] != v) {
String _connection = String(u) + " " + String(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]; v = (StringName)r_align[v];
} }
u = E->get(); u = E;
do { do {
r_inner_shifts[u] = (real_t)r_inner_shifts[u] - left; r_inner_shifts[u] = (real_t)r_inner_shifts[u] - left;
u = (StringName)r_align[u]; u = (StringName)r_align[u];
} while (u != E->get()); } while (u != E);
} }
} }
@ -2117,33 +2117,33 @@ void GraphEdit::arrange_nodes() {
Dictionary inner_shift; Dictionary inner_shift;
RBSet<StringName> block_heads; RBSet<StringName> block_heads;
for (const RBSet<StringName>::Element *E = selected_nodes.front(); E; E = E->next()) { for (const StringName &E : selected_nodes) {
inner_shift[E->get()] = 0.0f; inner_shift[E] = 0.0f;
sink[E->get()] = E->get(); sink[E] = E;
shift[E->get()] = FLT_MAX; shift[E] = FLT_MAX;
new_positions.insert(E->get(), default_position); new_positions.insert(E, default_position);
if ((StringName)root[E->get()] == E->get()) { if ((StringName)root[E] == E) {
block_heads.insert(E->get()); block_heads.insert(E);
} }
} }
_calculate_inner_shifts(inner_shift, root, node_names, align, block_heads, port_info); _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()) { for (const StringName &E : block_heads) {
_place_block(E->get(), gap_v, layers, root, align, node_names, inner_shift, sink, shift, new_positions); _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.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; 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()) { for (const StringName &E : block_heads) {
StringName u = E->get(); StringName u = E;
float start_from = origin.y + new_positions[E->get()].y; float start_from = origin.y + new_positions[E].y;
do { do {
Vector2 cal_pos; Vector2 cal_pos;
cal_pos.y = start_from + (real_t)inner_shift[u]; cal_pos.y = start_from + (real_t)inner_shift[u];
new_positions.insert(u, cal_pos); new_positions.insert(u, cal_pos);
u = align[u]; u = align[u];
} while (u != E->get()); } while (u != E);
} }
// Compute horizontal coordinates individually for layers to get uniform gap. // Compute horizontal coordinates individually for layers to get uniform gap.
@ -2181,10 +2181,10 @@ void GraphEdit::arrange_nodes() {
} }
emit_signal(SNAME("begin_node_move")); emit_signal(SNAME("begin_node_move"));
for (const RBSet<StringName>::Element *E = selected_nodes.front(); E; E = E->next()) { for (const StringName &E : selected_nodes) {
GraphNode *gn = Object::cast_to<GraphNode>(node_names[E->get()]); GraphNode *gn = Object::cast_to<GraphNode>(node_names[E]);
gn->set_drag(true); gn->set_drag(true);
Vector2 pos = (new_positions[E->get()]); Vector2 pos = (new_positions[E]);
if (is_using_snap()) { if (is_using_snap()) {
const int snap = get_snap(); const int snap = get_snap();

View File

@ -104,11 +104,11 @@ void GridContainer::_notification(int p_what) {
// Check if all minwidth constraints are OK if we use the remaining space. // Check if all minwidth constraints are OK if we use the remaining space.
can_fit = true; can_fit = true;
int max_index = col_expanded.front()->get(); int max_index = col_expanded.front()->get();
for (RBSet<int>::Element *E = col_expanded.front(); E; E = E->next()) { for (const int &E : col_expanded) {
if (col_minw[E->get()] > col_minw[max_index]) { if (col_minw[E] > col_minw[max_index]) {
max_index = E->get(); 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; 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. // Check if all minheight constraints are OK if we use the remaining space.
can_fit = true; can_fit = true;
int max_index = row_expanded.front()->get(); int max_index = row_expanded.front()->get();
for (RBSet<int>::Element *E = row_expanded.front(); E; E = E->next()) { for (const int &E : row_expanded) {
if (row_minh[E->get()] > row_minh[max_index]) { if (row_minh[E] > row_minh[max_index]) {
max_index = E->get(); 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; can_fit = false;
} }
} }

View File

@ -50,8 +50,8 @@ void Range::_value_changed_notify() {
} }
void Range::Shared::emit_value_changed() { void Range::Shared::emit_value_changed() {
for (RBSet<Range *>::Element *E = owners.front(); E; E = E->next()) { for (Range *E : owners) {
Range *r = E->get(); Range *r = E;
if (!r->is_inside_tree()) { if (!r->is_inside_tree()) {
continue; continue;
} }
@ -70,8 +70,8 @@ void Range::_validate_values() {
} }
void Range::Shared::emit_changed(const char *p_what) { void Range::Shared::emit_changed(const char *p_what) {
for (RBSet<Range *>::Element *E = owners.front(); E; E = E->next()) { for (Range *E : owners) {
Range *r = E->get(); Range *r = E;
if (!r->is_inside_tree()) { if (!r->is_inside_tree()) {
continue; continue;
} }

View File

@ -62,9 +62,9 @@ Array ResourcePreloader::_get_resources() const {
} }
int i = 0; int i = 0;
for (RBSet<String>::Element *E = sorted_names.front(); E; E = E->next()) { for (const String &E : sorted_names) {
names.set(i, E->get()); names.set(i, E);
arr[i] = resources[E->get()]; arr[i] = resources[E];
i++; i++;
} }

View File

@ -412,9 +412,9 @@ void Viewport::_notification(int p_what) {
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
if (audio_listener_3d_set.size() && !audio_listener_3d) { if (audio_listener_3d_set.size() && !audio_listener_3d) {
AudioListener3D *first = nullptr; AudioListener3D *first = nullptr;
for (RBSet<AudioListener3D *>::Element *E = audio_listener_3d_set.front(); E; E = E->next()) { for (AudioListener3D *E : audio_listener_3d_set) {
if (first == nullptr || first->is_greater_than(E->get())) { if (first == nullptr || first->is_greater_than(E)) {
first = E->get(); first = E;
} }
} }
@ -426,9 +426,9 @@ void Viewport::_notification(int p_what) {
if (camera_3d_set.size() && !camera_3d) { if (camera_3d_set.size() && !camera_3d) {
// There are cameras but no current camera, pick first in tree and make it current. // There are cameras but no current camera, pick first in tree and make it current.
Camera3D *first = nullptr; Camera3D *first = nullptr;
for (RBSet<Camera3D *>::Element *E = camera_3d_set.front(); E; E = E->next()) { for (Camera3D *E : camera_3d_set) {
if (first == nullptr || first->is_greater_than(E->get())) { if (first == nullptr || first->is_greater_than(E)) {
first = E->get(); first = E;
} }
} }
@ -647,13 +647,13 @@ void Viewport::_process_picking() {
uint64_t frame = get_tree()->get_frame(); uint64_t frame = get_tree()->get_frame();
PhysicsDirectSpaceState2D::ShapeResult res[64]; 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; Transform2D canvas_transform;
ObjectID canvas_layer_id; ObjectID canvas_layer_id;
if (E->get()) { if (E) {
// A descendant CanvasLayer. // A descendant CanvasLayer.
canvas_transform = E->get()->get_transform(); canvas_transform = E->get_transform();
canvas_layer_id = E->get()->get_instance_id(); canvas_layer_id = E->get_instance_id();
} else { } else {
// This Viewport's builtin canvas. // This Viewport's builtin canvas.
canvas_transform = get_canvas_transform(); 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) { void Viewport::_audio_listener_3d_make_next_current(AudioListener3D *p_exclude) {
if (audio_listener_3d_set.size() > 0) { if (audio_listener_3d_set.size() > 0) {
for (RBSet<AudioListener3D *>::Element *E = audio_listener_3d_set.front(); E; E = E->next()) { for (AudioListener3D *E : audio_listener_3d_set) {
if (p_exclude == E->get()) { if (p_exclude == E) {
continue; continue;
} }
if (!E->get()->is_inside_tree()) { if (!E->is_inside_tree()) {
continue; continue;
} }
if (audio_listener_3d != nullptr) { if (audio_listener_3d != nullptr) {
return; return;
} }
E->get()->make_current(); E->make_current();
} }
} else { } else {
// Attempt to reset listener to the camera position. // 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) { void Viewport::_camera_3d_make_next_current(Camera3D *p_exclude) {
for (RBSet<Camera3D *>::Element *E = camera_3d_set.front(); E; E = E->next()) { for (Camera3D *E : camera_3d_set) {
if (p_exclude == E->get()) { if (p_exclude == E) {
continue; continue;
} }
if (!E->get()->is_inside_tree()) { if (!E->is_inside_tree()) {
continue; continue;
} }
if (camera_3d != nullptr) { if (camera_3d != nullptr) {
return; return;
} }
E->get()->make_current(); E->make_current();
} }
} }
@ -3936,8 +3936,8 @@ Viewport::Viewport() {
Viewport::~Viewport() { Viewport::~Viewport() {
// Erase itself from viewport textures. // Erase itself from viewport textures.
for (RBSet<ViewportTexture *>::Element *E = viewport_textures.front(); E; E = E->next()) { for (ViewportTexture *E : viewport_textures) {
E->get()->vp = nullptr; E->vp = nullptr;
} }
RenderingServer::get_singleton()->free(viewport); RenderingServer::get_singleton()->free(viewport);
} }

View File

@ -263,9 +263,9 @@ void Window::_make_window() {
DisplayServer::get_singleton()->window_set_transient(window_id, transient_parent->window_id); DisplayServer::get_singleton()->window_set_transient(window_id, transient_parent->window_id);
} }
for (RBSet<Window *>::Element *E = transient_children.front(); E; E = E->next()) { for (const Window *E : transient_children) {
if (E->get()->window_id != DisplayServer::INVALID_WINDOW_ID) { if (E->window_id != DisplayServer::INVALID_WINDOW_ID) {
DisplayServer::get_singleton()->window_set_transient(E->get()->window_id, transient_parent->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); DisplayServer::get_singleton()->window_set_transient(window_id, DisplayServer::INVALID_WINDOW_ID);
} }
for (RBSet<Window *>::Element *E = transient_children.front(); E; E = E->next()) { for (const Window *E : transient_children) {
if (E->get()->window_id != DisplayServer::INVALID_WINDOW_ID) { if (E->window_id != DisplayServer::INVALID_WINDOW_ID) {
DisplayServer::get_singleton()->window_set_transient(E->get()->window_id, DisplayServer::INVALID_WINDOW_ID); DisplayServer::get_singleton()->window_set_transient(E->window_id, DisplayServer::INVALID_WINDOW_ID);
} }
} }

View File

@ -214,17 +214,17 @@ bool SceneCacheInterface::send_object_cache(Object *p_obj, NodePath p_path, int
} }
} else { } else {
// Long and painful. // Long and painful.
for (const RBSet<int>::Element *E = multiplayer->get_connected_peers().front(); E; E = E->next()) { for (const int &E : multiplayer->get_connected_peers()) {
if (p_peer_id < 0 && E->get() == -p_peer_id) { if (p_peer_id < 0 && E == -p_peer_id) {
continue; // Continue, excluded. 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. 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) { 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; has_all_peers = false;
} else if (!F->value) { } else if (!F->value) {
has_all_peers = false; has_all_peers = false;

View File

@ -50,9 +50,9 @@ Vector<Vector3> ConcavePolygonShape3D::get_debug_mesh_lines() const {
Vector<Vector3> points; Vector<Vector3> points;
points.resize(edges.size() * 2); points.resize(edges.size() * 2);
int idx = 0; int idx = 0;
for (RBSet<DrawEdge>::Element *E = edges.front(); E; E = E->next()) { for (const DrawEdge &E : edges) {
points.write[idx + 0] = E->get().a; points.write[idx + 0] = E.a;
points.write[idx + 1] = E->get().b; points.write[idx + 1] = E.b;
idx += 2; idx += 2;
} }

View File

@ -34,8 +34,8 @@
bool PolygonPathFinder::_is_point_inside(const Vector2 &p_point) const { bool PolygonPathFinder::_is_point_inside(const Vector2 &p_point) const {
int crosses = 0; int crosses = 0;
for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) { for (const Edge &E : edges) {
const Edge &e = E->get(); const Edge &e = E;
Vector2 a = points[e.points[0]].pos; Vector2 a = points[e.points[0]].pos;
Vector2 b = points[e.points[1]].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; bool valid = true;
for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) { for (const Edge &E : edges) {
const Edge &e = E->get(); const Edge &e = E;
if (e.points[0] == i || e.points[1] == i || e.points[0] == j || e.points[1] == j) { if (e.points[0] == i || e.points[1] == i || e.points[0] == j || e.points[1] == j) {
continue; continue;
} }
@ -140,8 +140,8 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
float closest_dist = 1e20f; float closest_dist = 1e20f;
Vector2 closest_point; Vector2 closest_point;
for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) { for (const Edge &E : edges) {
const Edge &e = E->get(); const Edge &e = E;
Vector2 seg[2] = { Vector2 seg[2] = {
points[e.points[0]].pos, points[e.points[0]].pos,
points[e.points[1]].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); float d = from.distance_squared_to(closest);
if (d < closest_dist) { if (d < closest_dist) {
ignore_from_edge = E->get(); ignore_from_edge = E;
closest_dist = d; closest_dist = d;
closest_point = closest; closest_point = closest;
} }
@ -164,8 +164,8 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
float closest_dist = 1e20f; float closest_dist = 1e20f;
Vector2 closest_point; Vector2 closest_point;
for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) { for (const Edge &E : edges) {
const Edge &e = E->get(); const Edge &e = E;
Vector2 seg[2] = { Vector2 seg[2] = {
points[e.points[0]].pos, points[e.points[0]].pos,
points[e.points[1]].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); float d = to.distance_squared_to(closest);
if (d < closest_dist) { if (d < closest_dist) {
ignore_to_edge = E->get(); ignore_to_edge = E;
closest_dist = d; closest_dist = d;
closest_point = closest; closest_point = closest;
} }
@ -188,8 +188,8 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
{ {
bool can_see_eachother = true; bool can_see_eachother = true;
for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) { for (const Edge &E : edges) {
const Edge &e = E->get(); const Edge &e = E;
if (e.points[0] == ignore_from_edge.points[0] && e.points[1] == ignore_from_edge.points[1]) { if (e.points[0] == ignore_from_edge.points[0] && e.points[1] == ignore_from_edge.points[1]) {
continue; continue;
} }
@ -240,8 +240,8 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
valid_b = false; valid_b = false;
} }
for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) { for (const Edge &E : edges) {
const Edge &e = E->get(); const Edge &e = E;
if (e.points[0] == i || e.points[1] == i) { if (e.points[0] == i || e.points[1] == i) {
continue; continue;
@ -293,10 +293,10 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
points.write[aidx].distance = 0; points.write[aidx].distance = 0;
points.write[aidx].prev = aidx; points.write[aidx].prev = aidx;
for (RBSet<int>::Element *E = points[aidx].connections.front(); E; E = E->next()) { for (const int &E : points[aidx].connections) {
open_list.insert(E->get()); open_list.insert(E);
points.write[E->get()].distance = from.distance_to(points[E->get()].pos); points.write[E].distance = from.distance_to(points[E].pos);
points.write[E->get()].prev = aidx; points.write[E].prev = aidx;
} }
bool found_route = false; bool found_route = false;
@ -312,14 +312,14 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
float least_cost = 1e30; float least_cost = 1e30;
//this could be faster (cache previous results) //this could be faster (cache previous results)
for (RBSet<int>::Element *E = open_list.front(); E; E = E->next()) { for (const int &E : open_list) {
const Point &p = points[E->get()]; const Point &p = points[E];
float cost = p.distance; float cost = p.distance;
cost += p.pos.distance_to(to); cost += p.pos.distance_to(to);
cost += p.penalty; cost += p.penalty;
if (cost < least_cost) { if (cost < least_cost) {
least_cost_point = E->get(); least_cost_point = E;
least_cost = cost; 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]; const Point &np = points[least_cost_point];
//open the neighbours for search //open the neighbours for search
for (RBSet<int>::Element *E = np.connections.front(); E; E = E->next()) { for (const int &E : np.connections) {
Point &p = points.write[E->get()]; Point &p = points.write[E];
float distance = np.pos.distance_to(p.pos) + np.distance; float distance = np.pos.distance_to(p.pos) + np.distance;
if (p.prev != -1) { 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.prev = least_cost_point;
p.distance = distance; 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 //oh my reached end! stop algorithm
found_route = true; found_route = true;
break; break;
@ -459,8 +459,8 @@ Dictionary PolygonPathFinder::_get_data() const {
{ {
int *cw = c.ptrw(); int *cw = c.ptrw();
int idx = 0; int idx = 0;
for (RBSet<int>::Element *E = points[i].connections.front(); E; E = E->next()) { for (const int &E : points[i].connections) {
cw[idx++] = E->get(); cw[idx++] = E;
} }
} }
connections[i] = c; connections[i] = c;
@ -469,9 +469,9 @@ Dictionary PolygonPathFinder::_get_data() const {
{ {
int *iw = ind.ptrw(); int *iw = ind.ptrw();
int idx = 0; int idx = 0;
for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) { for (const Edge &E : edges) {
iw[idx++] = E->get().points[0]; iw[idx++] = E.points[0];
iw[idx++] = E->get().points[1]; iw[idx++] = E.points[1];
} }
} }
@ -492,8 +492,8 @@ Vector2 PolygonPathFinder::get_closest_point(const Vector2 &p_point) const {
float closest_dist = 1e20f; float closest_dist = 1e20f;
Vector2 closest_point; Vector2 closest_point;
for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) { for (const Edge &E : edges) {
const Edge &e = E->get(); const Edge &e = E;
Vector2 seg[2] = { Vector2 seg[2] = {
points[e.points[0]].pos, points[e.points[0]].pos,
points[e.points[1]].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> PolygonPathFinder::get_intersections(const Vector2 &p_from, const Vector2 &p_to) const {
Vector<Vector2> inters; Vector<Vector2> inters;
for (RBSet<Edge>::Element *E = edges.front(); E; E = E->next()) { for (const Edge &E : edges) {
Vector2 a = points[E->get().points[0]].pos; Vector2 a = points[E.points[0]].pos;
Vector2 b = points[E->get().points[1]].pos; Vector2 b = points[E.points[1]].pos;
Vector2 res; Vector2 res;
if (Geometry2D::segment_intersects_segment(a, b, p_from, p_to, &res)) { if (Geometry2D::segment_intersects_segment(a, b, p_from, p_to, &res)) {

View File

@ -1307,8 +1307,8 @@ void Theme::get_type_list(List<StringName> *p_list) const {
types.insert(E.key); types.insert(E.key);
} }
for (RBSet<StringName>::Element *E = types.front(); E; E = E->next()) { for (const StringName &E : types) {
p_list->push_back(E->get()); p_list->push_back(E);
} }
} }

View File

@ -1369,12 +1369,12 @@ TileMapCell TileSet::get_random_tile_from_terrains_pattern(int p_terrain_set, Ti
// Count the sum of probabilities. // Count the sum of probabilities.
double sum = 0.0; double sum = 0.0;
RBSet<TileMapCell> set = per_terrain_pattern_tiles[p_terrain_set][p_terrain_tile_pattern]; 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()) { for (const TileMapCell &E : set) {
if (E->get().source_id >= 0) { if (E.source_id >= 0) {
Ref<TileSetSource> source = sources[E->get().source_id]; Ref<TileSetSource> source = sources[E.source_id];
Ref<TileSetAtlasSource> atlas_source = source; Ref<TileSetAtlasSource> atlas_source = source;
if (atlas_source.is_valid()) { 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(); sum += tile_data->get_probability();
} else { } else {
sum += 1.0; 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); double picked = Math::random(0.0, sum);
// Pick the tile. // Pick the tile.
for (RBSet<TileMapCell>::Element *E = set.front(); E; E = E->next()) { for (const TileMapCell &E : set) {
if (E->get().source_id >= 0) { if (E.source_id >= 0) {
Ref<TileSetSource> source = sources[E->get().source_id]; Ref<TileSetSource> source = sources[E.source_id];
Ref<TileSetAtlasSource> atlas_source = source; Ref<TileSetAtlasSource> atlas_source = source;
if (atlas_source.is_valid()) { 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(); count += tile_data->get_probability();
} else { } else {
count += 1.0; count += 1.0;
@ -1405,7 +1405,7 @@ TileMapCell TileSet::get_random_tile_from_terrains_pattern(int p_terrain_set, Ti
} }
if (count >= picked) { if (count >= picked) {
return E->get(); return E;
} }
} }

View File

@ -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)); 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()) { for (const String &E : toggles) {
p_list->push_back(PropertyInfo(Variant::BOOL, vformat("%s/%s", PNAME("flags"), E->get()))); p_list->push_back(PropertyInfo(Variant::BOOL, vformat("%s/%s", PNAME("flags"), E)));
} }
for (const KeyValue<String, Varying> &E : varyings) { for (const KeyValue<String, Varying> &E : varyings) {

View File

@ -1250,11 +1250,11 @@ void GodotPhysicsServer2D::step(real_t p_step) {
island_count = 0; island_count = 0;
active_objects = 0; active_objects = 0;
collision_pairs = 0; collision_pairs = 0;
for (RBSet<const GodotSpace2D *>::Element *E = active_spaces.front(); E; E = E->next()) { for (const GodotSpace2D *E : active_spaces) {
stepper->step(const_cast<GodotSpace2D *>(E->get()), p_step); stepper->step(const_cast<GodotSpace2D *>(E), p_step);
island_count += E->get()->get_island_count(); island_count += E->get_island_count();
active_objects += E->get()->get_active_objects(); active_objects += E->get_active_objects();
collision_pairs += E->get()->get_collision_pairs(); collision_pairs += E->get_collision_pairs();
} }
} }
@ -1271,8 +1271,8 @@ void GodotPhysicsServer2D::flush_queries() {
uint64_t time_beg = OS::get_singleton()->get_ticks_usec(); uint64_t time_beg = OS::get_singleton()->get_ticks_usec();
for (RBSet<const GodotSpace2D *>::Element *E = active_spaces.front(); E; E = E->next()) { for (const GodotSpace2D *E : active_spaces) {
GodotSpace2D *space = const_cast<GodotSpace2D *>(E->get()); GodotSpace2D *space = const_cast<GodotSpace2D *>(E);
space->call_queries(); space->call_queries();
} }
@ -1292,9 +1292,9 @@ void GodotPhysicsServer2D::flush_queries() {
total_time[i] = 0; 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++) { 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));
} }
} }

View File

@ -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(); const SelfList<GodotArea2D>::List &aml = p_space->get_moved_area_list();
while (aml.first()) { while (aml.first()) {
for (const RBSet<GodotConstraint2D *>::Element *E = aml.first()->self()->get_constraints().front(); E; E = E->next()) { for (GodotConstraint2D *E : aml.first()->self()->get_constraints()) {
GodotConstraint2D *constraint = E->get(); GodotConstraint2D *constraint = E;
if (constraint->get_island_step() == _step) { if (constraint->get_island_step() == _step) {
continue; continue;
} }

View File

@ -1611,11 +1611,11 @@ void GodotPhysicsServer3D::step(real_t p_step) {
island_count = 0; island_count = 0;
active_objects = 0; active_objects = 0;
collision_pairs = 0; collision_pairs = 0;
for (RBSet<const GodotSpace3D *>::Element *E = active_spaces.front(); E; E = E->next()) { for (const GodotSpace3D *E : active_spaces) {
stepper->step(const_cast<GodotSpace3D *>(E->get()), p_step); stepper->step(const_cast<GodotSpace3D *>(E), p_step);
island_count += E->get()->get_island_count(); island_count += E->get_island_count();
active_objects += E->get()->get_active_objects(); active_objects += E->get_active_objects();
collision_pairs += E->get()->get_collision_pairs(); collision_pairs += E->get_collision_pairs();
} }
#endif #endif
} }
@ -1635,8 +1635,8 @@ void GodotPhysicsServer3D::flush_queries() {
uint64_t time_beg = OS::get_singleton()->get_ticks_usec(); uint64_t time_beg = OS::get_singleton()->get_ticks_usec();
for (RBSet<const GodotSpace3D *>::Element *E = active_spaces.front(); E; E = E->next()) { for (const GodotSpace3D *E : active_spaces) {
GodotSpace3D *space = const_cast<GodotSpace3D *>(E->get()); GodotSpace3D *space = const_cast<GodotSpace3D *>(E);
space->call_queries(); space->call_queries();
} }
@ -1656,9 +1656,9 @@ void GodotPhysicsServer3D::flush_queries() {
total_time[i] = 0; 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++) { 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));
} }
} }

View File

@ -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) { 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); p_soft_body->set_island_step(_step);
for (RBSet<GodotConstraint3D *>::Element *E = p_soft_body->get_constraints().front(); E; E = E->next()) { for (const GodotConstraint3D *E : p_soft_body->get_constraints()) {
GodotConstraint3D *constraint = const_cast<GodotConstraint3D *>(E->get()); GodotConstraint3D *constraint = const_cast<GodotConstraint3D *>(E);
if (constraint->get_island_step() == _step) { if (constraint->get_island_step() == _step) {
continue; // Already processed. 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(); const SelfList<GodotArea3D>::List &aml = p_space->get_moved_area_list();
while (aml.first()) { while (aml.first()) {
for (const RBSet<GodotConstraint3D *>::Element *E = aml.first()->self()->get_constraints().front(); E; E = E->next()) { for (GodotConstraint3D *E : aml.first()->self()->get_constraints()) {
GodotConstraint3D *constraint = E->get(); GodotConstraint3D *constraint = E;
if (constraint->get_island_step() == _step) { if (constraint->get_island_step() == _step) {
continue; continue;
} }

View File

@ -158,8 +158,8 @@ Vector<RID> PhysicsRayQueryParameters2D::get_exclude() const {
Vector<RID> ret; Vector<RID> ret;
ret.resize(parameters.exclude.size()); ret.resize(parameters.exclude.size());
int idx = 0; int idx = 0;
for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) { for (const RID &E : parameters.exclude) {
ret.write[idx++] = E->get(); ret.write[idx++] = E;
} }
return ret; return ret;
} }
@ -208,8 +208,8 @@ Vector<RID> PhysicsPointQueryParameters2D::get_exclude() const {
Vector<RID> ret; Vector<RID> ret;
ret.resize(parameters.exclude.size()); ret.resize(parameters.exclude.size());
int idx = 0; int idx = 0;
for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) { for (const RID &E : parameters.exclude) {
ret.write[idx++] = E->get(); ret.write[idx++] = E;
} }
return ret; return ret;
} }
@ -267,8 +267,8 @@ Vector<RID> PhysicsShapeQueryParameters2D::get_exclude() const {
Vector<RID> ret; Vector<RID> ret;
ret.resize(parameters.exclude.size()); ret.resize(parameters.exclude.size());
int idx = 0; int idx = 0;
for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) { for (const RID &E : parameters.exclude) {
ret.write[idx++] = E->get(); ret.write[idx++] = E;
} }
return ret; return ret;
} }

View File

@ -177,8 +177,8 @@ Vector<RID> PhysicsRayQueryParameters3D::get_exclude() const {
Vector<RID> ret; Vector<RID> ret;
ret.resize(parameters.exclude.size()); ret.resize(parameters.exclude.size());
int idx = 0; int idx = 0;
for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) { for (const RID &E : parameters.exclude) {
ret.write[idx++] = E->get(); ret.write[idx++] = E;
} }
return ret; return ret;
} }
@ -231,8 +231,8 @@ Vector<RID> PhysicsPointQueryParameters3D::get_exclude() const {
Vector<RID> ret; Vector<RID> ret;
ret.resize(parameters.exclude.size()); ret.resize(parameters.exclude.size());
int idx = 0; int idx = 0;
for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) { for (const RID &E : parameters.exclude) {
ret.write[idx++] = E->get(); ret.write[idx++] = E;
} }
return ret; return ret;
} }
@ -286,8 +286,8 @@ Vector<RID> PhysicsShapeQueryParameters3D::get_exclude() const {
Vector<RID> ret; Vector<RID> ret;
ret.resize(parameters.exclude.size()); ret.resize(parameters.exclude.size());
int idx = 0; int idx = 0;
for (RBSet<RID>::Element *E = parameters.exclude.front(); E; E = E->next()) { for (const RID &E : parameters.exclude) {
ret.write[idx++] = E->get(); ret.write[idx++] = E;
} }
return ret; return ret;
} }

View File

@ -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); 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()) { for (RendererCanvasRender::LightOccluderInstance *E : occluder_poly->owners) {
E->get()->aabb_cache = occluder_poly->aabb; 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); ERR_FAIL_COND(!occluder_poly);
occluder_poly->cull_mode = p_mode; occluder_poly->cull_mode = p_mode;
RSG::canvas_render->occluder_polygon_set_cull_mode(occluder_poly->occluder, 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()) { for (RendererCanvasRender::LightOccluderInstance *E : occluder_poly->owners) {
E->get()->cull_cache = p_mode; E->cull_cache = p_mode;
} }
} }
@ -1942,12 +1942,12 @@ bool RendererCanvasCull::free(RID p_rid) {
canvas->child_items[i].item->parent = RID(); canvas->child_items[i].item->parent = RID();
} }
for (RBSet<RendererCanvasRender::Light *>::Element *E = canvas->lights.front(); E; E = E->next()) { for (RendererCanvasRender::Light *E : canvas->lights) {
E->get()->canvas = RID(); E->canvas = RID();
} }
for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *E = canvas->occluders.front(); E; E = E->next()) { for (RendererCanvasRender::LightOccluderInstance *E : canvas->occluders) {
E->get()->canvas = RID(); E->canvas = RID();
} }
canvas_owner.free(p_rid); canvas_owner.free(p_rid);

View File

@ -5464,8 +5464,8 @@ bool RendererSceneRenderRD::free(RID p_rid) {
LightInstance *light_instance = light_instance_owner.get_or_null(p_rid); LightInstance *light_instance = light_instance_owner.get_or_null(p_rid);
//remove from shadow atlases.. //remove from shadow atlases..
for (RBSet<RID>::Element *E = light_instance->shadow_atlases.front(); E; E = E->next()) { for (const RID &E : light_instance->shadow_atlases) {
ShadowAtlas *shadow_atlas = shadow_atlas_owner.get_or_null(E->get()); ShadowAtlas *shadow_atlas = shadow_atlas_owner.get_or_null(E);
ERR_CONTINUE(!shadow_atlas->shadow_owners.has(p_rid)); ERR_CONTINUE(!shadow_atlas->shadow_owners.has(p_rid));
uint32_t key = shadow_atlas->shadow_owners[p_rid]; uint32_t key = shadow_atlas->shadow_owners[p_rid];
uint32_t q = (key >> ShadowAtlas::QUADRANT_SHIFT) & 0x3; uint32_t q = (key >> ShadowAtlas::QUADRANT_SHIFT) & 0x3;

View File

@ -1979,8 +1979,8 @@ void MaterialStorage::global_variable_set(const StringName &p_name, const Varian
} else { } else {
//texture //texture
MaterialStorage *material_storage = MaterialStorage::get_singleton(); MaterialStorage *material_storage = MaterialStorage::get_singleton();
for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) { for (const RID &E : gv.texture_materials) {
Material *material = material_storage->get_material(E->get()); Material *material = material_storage->get_material(E);
ERR_CONTINUE(!material); ERR_CONTINUE(!material);
material_storage->_material_queue_update(material, false, true); material_storage->_material_queue_update(material, false, true);
} }
@ -2011,8 +2011,8 @@ void MaterialStorage::global_variable_set_override(const StringName &p_name, con
} else { } else {
//texture //texture
MaterialStorage *material_storage = MaterialStorage::get_singleton(); MaterialStorage *material_storage = MaterialStorage::get_singleton();
for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) { for (const RID &E : gv.texture_materials) {
Material *material = material_storage->get_material(E->get()); Material *material = material_storage->get_material(E);
ERR_CONTINUE(!material); ERR_CONTINUE(!material);
material_storage->_material_queue_update(material, false, true); 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; shader->data = nullptr;
} }
for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { for (Material *E : shader->owners) {
Material *material = E->get(); Material *material = E;
material->shader_type = new_type; material->shader_type = new_type;
if (material->data) { if (material->data) {
memdelete(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 shader->type = SHADER_TYPE_MAX; //invalid
} }
for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { for (Material *E : shader->owners) {
Material *material = E->get(); Material *material = E;
if (shader->data) { if (shader->data) {
material->data = material_get_data_request_function(new_type)(shader->data); material->data = material_get_data_request_function(new_type)(shader->data);
material->data->self = material->self; 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); shader->data->set_code(p_code);
} }
for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { for (Material *E : shader->owners) {
Material *material = E->get(); Material *material = E;
material->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MATERIAL); material->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MATERIAL);
_material_queue_update(material, true, true); _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) { if (shader->data) {
shader->data->set_default_texture_param(p_name, p_texture, p_index); shader->data->set_default_texture_param(p_name, p_texture, p_index);
} }
for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { for (Material *E : shader->owners) {
Material *material = E->get(); Material *material = E;
_material_queue_update(material, false, true); _material_queue_update(material, false, true);
} }
} }

View File

@ -215,8 +215,8 @@ void MeshStorage::mesh_free(RID p_rid) {
ERR_PRINT("deleting mesh with active instances"); ERR_PRINT("deleting mesh with active instances");
} }
if (mesh->shadow_owners.size()) { if (mesh->shadow_owners.size()) {
for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) { for (Mesh *E : mesh->shadow_owners) {
Mesh *shadow_owner = E->get(); Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID(); shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); 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); mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) { for (Mesh *E : mesh->shadow_owners) {
Mesh *shadow_owner = E->get(); Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID(); shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); 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->has_bone_weights = false;
mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) { for (Mesh *E : mesh->shadow_owners) {
Mesh *shadow_owner = E->get(); Mesh *shadow_owner = E;
shadow_owner->shadow_mesh = RID(); shadow_owner->shadow_mesh = RID();
shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
} }

View File

@ -838,8 +838,8 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta
} }
uint32_t collision_3d_textures_used = 0; uint32_t collision_3d_textures_used = 0;
for (const RBSet<RID>::Element *E = p_particles->collisions.front(); E; E = E->next()) { for (const RID &E : p_particles->collisions) {
ParticlesCollisionInstance *pci = particles_collision_instance_owner.get_or_null(E->get()); ParticlesCollisionInstance *pci = particles_collision_instance_owner.get_or_null(E);
if (!pci || !pci->active) { if (!pci || !pci->active) {
continue; continue;
} }

View File

@ -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()); 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()) { for (Instance *E : instance->visibility_dependencies) {
Instance *dep_instance = E->get(); Instance *dep_instance = E;
ERR_CONTINUE(dep_instance->array_index == -1); ERR_CONTINUE(dep_instance->array_index == -1);
ERR_CONTINUE(dep_instance->scenario->instance_data[dep_instance->array_index].parent_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; 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) { while (instance) {
if (!instance->visibility_dependencies.is_empty()) { if (!instance->visibility_dependencies.is_empty()) {
uint32_t depth = 0; uint32_t depth = 0;
for (RBSet<Instance *>::Element *E = instance->visibility_dependencies.front(); E; E = E->next()) { for (const Instance *E : instance->visibility_dependencies) {
depth = MAX(depth, E->get()->visibility_dependencies_depth); depth = MAX(depth, E->visibility_dependencies_depth);
} }
instance->visibility_dependencies_depth = depth + 1; instance->visibility_dependencies_depth = depth + 1;
} else { } else {
@ -1559,8 +1559,8 @@ void RendererSceneCull::_update_instance(Instance *p_instance) {
InstanceLightmapData *lightmap_data = static_cast<InstanceLightmapData *>(p_instance->base_data); InstanceLightmapData *lightmap_data = static_cast<InstanceLightmapData *>(p_instance->base_data);
//erase dependencies, since no longer a lightmap //erase dependencies, since no longer a lightmap
for (RBSet<Instance *>::Element *E = lightmap_data->geometries.front(); E; E = E->next()) { for (Instance *E : lightmap_data->geometries) {
Instance *geom = E->get(); Instance *geom = E;
_instance_queue_update(geom, true, false); _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 //make sure lights are updated if it casts shadow
if (geom->can_cast_shadows) { if (geom->can_cast_shadows) {
for (RBSet<Instance *>::Element *E = geom->lights.front(); E; E = E->next()) { for (const Instance *E : geom->lights) {
InstanceLightData *light = static_cast<InstanceLightData *>(E->get()->base_data); InstanceLightData *light = static_cast<InstanceLightData *>(E->base_data);
light->shadow_dirty = true; 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.parent_array_index = p_instance->visibility_parent ? p_instance->visibility_parent->array_index : -1;
idata.visibility_index = p_instance->visibility_index; idata.visibility_index = p_instance->visibility_index;
for (RBSet<Instance *>::Element *E = p_instance->visibility_dependencies.front(); E; E = E->next()) { for (Instance *E : p_instance->visibility_dependencies) {
Instance *dep_instance = E->get(); Instance *dep_instance = E;
if (dep_instance->array_index != -1) { if (dep_instance->array_index != -1) {
dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = p_instance->array_index; 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; 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()) { for (Instance *E : swapped_instance->visibility_dependencies) {
Instance *dep_instance = E->get(); Instance *dep_instance = E;
if (dep_instance != p_instance && dep_instance->array_index != -1) { 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; 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); 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()) { for (Instance *E : p_instance->visibility_dependencies) {
Instance *dep_instance = E->get(); Instance *dep_instance = E;
if (dep_instance->array_index != -1) { if (dep_instance->array_index != -1) {
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 = -1;
if ((1 << dep_instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) { 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; float accum_blend = 0.0;
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(p_instance->base_data); InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(p_instance->base_data);
for (RBSet<Instance *>::Element *E = geom->lightmap_captures.front(); E; E = E->next()) { for (Instance *E : geom->lightmap_captures) {
Instance *lightmap = E->get(); Instance *lightmap = E;
bool interior = RSG::light_storage->lightmap_is_interior(lightmap->base); 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); InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0; uint32_t idx = 0;
for (RBSet<Instance *>::Element *E = geom->lights.front(); E; E = E->next()) { for (const Instance *E : geom->lights) {
InstanceLightData *light = static_cast<InstanceLightData *>(E->get()->base_data); InstanceLightData *light = static_cast<InstanceLightData *>(E->base_data);
instance_pair_buffer[idx++] = light->instance; instance_pair_buffer[idx++] = light->instance;
if (idx == MAX_INSTANCE_PAIRS) { if (idx == MAX_INSTANCE_PAIRS) {
break; break;
@ -2767,8 +2767,8 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data); InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0; uint32_t idx = 0;
for (RBSet<Instance *>::Element *E = geom->reflection_probes.front(); E; E = E->next()) { for (const Instance *E : geom->reflection_probes) {
InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(E->get()->base_data); InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(E->base_data);
instance_pair_buffer[idx++] = reflection_probe->instance; instance_pair_buffer[idx++] = reflection_probe->instance;
if (idx == MAX_INSTANCE_PAIRS) { 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); InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0; uint32_t idx = 0;
for (RBSet<Instance *>::Element *E = geom->decals.front(); E; E = E->next()) { for (const Instance *E : geom->decals) {
InstanceDecalData *decal = static_cast<InstanceDecalData *>(E->get()->base_data); InstanceDecalData *decal = static_cast<InstanceDecalData *>(E->base_data);
instance_pair_buffer[idx++] = decal->instance; instance_pair_buffer[idx++] = decal->instance;
if (idx == MAX_INSTANCE_PAIRS) { 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) { if (idata.flags & InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY) {
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data); InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0; uint32_t idx = 0;
for (RBSet<Instance *>::Element *E = geom->voxel_gi_instances.front(); E; E = E->next()) { for (const Instance *E : geom->voxel_gi_instances) {
InstanceVoxelGIData *voxel_gi = static_cast<InstanceVoxelGIData *>(E->get()->base_data); InstanceVoxelGIData *voxel_gi = static_cast<InstanceVoxelGIData *>(E->base_data);
instance_pair_buffer[idx++] = voxel_gi->probe_instance; instance_pair_buffer[idx++] = voxel_gi->probe_instance;
if (idx == MAX_INSTANCE_PAIRS) { if (idx == MAX_INSTANCE_PAIRS) {
@ -3420,8 +3420,8 @@ void RendererSceneCull::render_probes() {
const RID *instance_caches = probe->light_instances.ptr(); const RID *instance_caches = probe->light_instances.ptr();
int idx = 0; //must count visible lights int idx = 0; //must count visible lights
for (RBSet<Instance *>::Element *E = probe->lights.front(); E; E = E->next()) { for (Instance *E : probe->lights) {
Instance *instance = E->get(); Instance *instance = E;
InstanceLightData *instance_light = (InstanceLightData *)instance->base_data; InstanceLightData *instance_light = (InstanceLightData *)instance->base_data;
if (!instance->visible) { if (!instance->visible) {
continue; continue;
@ -3502,8 +3502,8 @@ void RendererSceneCull::render_probes() {
RID *instance_caches = probe->light_instances.ptrw(); RID *instance_caches = probe->light_instances.ptrw();
int idx = 0; //must count visible lights int idx = 0; //must count visible lights
for (RBSet<Instance *>::Element *E = probe->lights.front(); E; E = E->next()) { for (Instance *E : probe->lights) {
Instance *instance = E->get(); Instance *instance = E;
InstanceLightData *instance_light = (InstanceLightData *)instance->base_data; InstanceLightData *instance_light = (InstanceLightData *)instance->base_data;
if (!instance->visible) { if (!instance->visible) {
continue; continue;
@ -3557,8 +3557,8 @@ void RendererSceneCull::render_probes() {
RID instance_pair_buffer[MAX_INSTANCE_PAIRS]; RID instance_pair_buffer[MAX_INSTANCE_PAIRS];
for (RBSet<Instance *>::Element *E = probe->dynamic_geometries.front(); E; E = E->next()) { for (Instance *E : probe->dynamic_geometries) {
Instance *ins = E->get(); Instance *ins = E;
if (!ins->visible) { if (!ins->visible) {
continue; 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)) { 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; uint32_t idx = 0;
for (RBSet<Instance *>::Element *F = geom->voxel_gi_instances.front(); F; F = F->next()) { for (const Instance *F : geom->voxel_gi_instances) {
InstanceVoxelGIData *voxel_gi2 = static_cast<InstanceVoxelGIData *>(F->get()->base_data); InstanceVoxelGIData *voxel_gi2 = static_cast<InstanceVoxelGIData *>(F->base_data);
instance_pair_buffer[idx++] = voxel_gi2->probe_instance; instance_pair_buffer[idx++] = voxel_gi2->probe_instance;
if (idx == MAX_INSTANCE_PAIRS) { 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) { if (can_cast_shadows != geom->can_cast_shadows) {
//ability to cast shadows change, let lights now //ability to cast shadows change, let lights now
for (RBSet<Instance *>::Element *E = geom->lights.front(); E; E = E->next()) { for (const Instance *E : geom->lights) {
InstanceLightData *light = static_cast<InstanceLightData *>(E->get()->base_data); InstanceLightData *light = static_cast<InstanceLightData *>(E->base_data);
light->shadow_dirty = true; light->shadow_dirty = true;
} }

View File

@ -85,8 +85,8 @@ public:
void update_end() { //call after updating dependencies void update_end() { //call after updating dependencies
List<Pair<Dependency *, DependencyTracker *>> to_clean_up; List<Pair<Dependency *, DependencyTracker *>> to_clean_up;
for (RBSet<Dependency *>::Element *E = dependencies.front(); E; E = E->next()) { for (Dependency *E : dependencies) {
Dependency *dep = E->get(); Dependency *dep = E;
HashMap<DependencyTracker *, uint32_t>::Iterator F = dep->instances.find(this); HashMap<DependencyTracker *, uint32_t>::Iterator F = dep->instances.find(this);
ERR_CONTINUE(!F); ERR_CONTINUE(!F);
if (F->value != instance_version) { if (F->value != instance_version) {
@ -105,8 +105,8 @@ public:
} }
void clear() { // clear all dependencies void clear() { // clear all dependencies
for (RBSet<Dependency *>::Element *E = dependencies.front(); E; E = E->next()) { for (Dependency *E : dependencies) {
Dependency *dep = E->get(); Dependency *dep = E;
dep->instances.erase(this); dep->instances.erase(this);
} }
dependencies.clear(); dependencies.clear();

View File

@ -247,15 +247,15 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas); RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas);
Transform2D xf = _canvas_get_transform(p_viewport, canvas, &E.value, clip_rect.size); 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()) { for (RendererCanvasRender::LightOccluderInstance *F : canvas->occluders) {
if (!F->get()->enabled) { if (!F->enabled) {
continue; 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)) { if (sdf_rect.intersects_transformed(F->xform_cache, F->aabb_cache)) {
F->get()->next = occluders; F->next = occluders;
occluders = F->get(); occluders = F;
} }
} }
} }
@ -281,8 +281,8 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
// Find lights in canvas. // Find lights in canvas.
for (RBSet<RendererCanvasRender::Light *>::Element *F = canvas->lights.front(); F; F = F->next()) { for (RendererCanvasRender::Light *F : canvas->lights) {
RendererCanvasRender::Light *cl = F->get(); RendererCanvasRender::Light *cl = F;
if (cl->enabled && cl->texture.is_valid()) { if (cl->enabled && cl->texture.is_valid()) {
//not super efficient.. //not super efficient..
Size2 tsize = RSG::texture_storage->texture_size_with_proxy(cl->texture); 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()) { for (RendererCanvasRender::Light *F : canvas->directional_lights) {
RendererCanvasRender::Light *cl = F->get(); RendererCanvasRender::Light *cl = F;
if (cl->enabled) { if (cl->enabled) {
cl->filter_next_ptr = directional_lights; cl->filter_next_ptr = directional_lights;
directional_lights = cl; directional_lights = cl;
@ -349,14 +349,14 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas); RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas);
Transform2D xf = _canvas_get_transform(p_viewport, canvas, &E.value, clip_rect.size); 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()) { for (RendererCanvasRender::LightOccluderInstance *F : canvas->occluders) {
if (!F->get()->enabled) { if (!F->enabled) {
continue; continue;
} }
F->get()->xform_cache = xf * F->get()->xform; F->xform_cache = xf * F->xform;
if (shadow_rect.intersects_transformed(F->get()->xform_cache, F->get()->aabb_cache)) { if (shadow_rect.intersects_transformed(F->xform_cache, F->aabb_cache)) {
F->get()->next = occluders; F->next = occluders;
occluders = F->get(); occluders = F;
} }
} }
} }
@ -429,19 +429,19 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas); RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas);
Transform2D xf = _canvas_get_transform(p_viewport, canvas, &E.value, clip_rect.size); 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()) { for (RendererCanvasRender::LightOccluderInstance *F : canvas->occluders) {
if (!F->get()->enabled) { if (!F->enabled) {
continue; continue;
} }
F->get()->xform_cache = xf * F->get()->xform; F->xform_cache = xf * F->xform;
Transform2D localizer = F->get()->xform_cache.affine_inverse(); Transform2D localizer = F->xform_cache.affine_inverse();
for (int j = 0; j < point_count; j++) { for (int j = 0; j < point_count; j++) {
xf_points[j] = localizer.xform(points[j]); xf_points[j] = localizer.xform(points[j]);
} }
if (F->get()->aabb_cache.intersects_filled_polygon(xf_points, point_count)) { if (F->aabb_cache.intersects_filled_polygon(xf_points, point_count)) {
F->get()->next = occluders; F->next = occluders;
occluders = F->get(); occluders = F;
} }
} }
} }

View File

@ -303,8 +303,8 @@ void ShaderCompiler::_dump_function_deps(const SL::ShaderNode *p_node, const Str
Vector<StringName> uses_functions; Vector<StringName> uses_functions;
for (RBSet<StringName>::Element *E = p_node->functions[fidx].uses_function.front(); E; E = E->next()) { for (const StringName &E : p_node->functions[fidx].uses_function) {
uses_functions.push_back(E->get()); uses_functions.push_back(E);
} }
uses_functions.sort_custom<StringName::AlphCompare>(); //ensure order is deterministic so the same shader is always produced uses_functions.sort_custom<StringName::AlphCompare>(); //ensure order is deterministic so the same shader is always produced

View File

@ -4036,8 +4036,8 @@ void ShaderLanguage::get_keyword_list(List<String> *r_keywords) {
idx++; idx++;
} }
for (RBSet<String>::Element *E = kws.front(); E; E = E->next()) { for (const String &E : kws) {
r_keywords->push_back(E->get()); r_keywords->push_back(E);
} }
} }
@ -4066,8 +4066,8 @@ void ShaderLanguage::get_builtin_funcs(List<String> *r_keywords) {
idx++; idx++;
} }
for (RBSet<String>::Element *E = kws.front(); E; E = E->next()) { for (const String &E : kws) {
r_keywords->push_back(E->get()); 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_filter = p_filter;
arg->tex_argument_repeat = p_repeat; arg->tex_argument_repeat = p_repeat;
for (KeyValue<StringName, RBSet<int>> &E : arg->tex_argument_connect) { for (KeyValue<StringName, RBSet<int>> &E : arg->tex_argument_connect) {
for (RBSet<int>::Element *F = E.value.front(); F; F = F->next()) { for (const int &F : E.value) {
if (!_propagate_function_call_sampler_uniform_settings(E.key, F->get(), p_filter, p_repeat)) { if (!_propagate_function_call_sampler_uniform_settings(E.key, F, p_filter, p_repeat)) {
return false; return false;
} }
} }
@ -4375,8 +4375,8 @@ bool ShaderLanguage::_propagate_function_call_sampler_builtin_reference(StringNa
arg->tex_builtin = p_builtin; arg->tex_builtin = p_builtin;
for (KeyValue<StringName, RBSet<int>> &E : arg->tex_argument_connect) { for (KeyValue<StringName, RBSet<int>> &E : arg->tex_argument_connect) {
for (RBSet<int>::Element *F = E.value.front(); F; F = F->next()) { for (const int &F : E.value) {
if (!_propagate_function_call_sampler_builtin_reference(E.key, F->get(), p_builtin)) { if (!_propagate_function_call_sampler_builtin_reference(E.key, F, p_builtin)) {
return false; 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 { String ShaderLanguage::_get_shader_type_list(const RBSet<String> &p_shader_types) const {
// Return a list of shader types as an human-readable string // Return a list of shader types as an human-readable string
String valid_types; 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()) { if (!valid_types.is_empty()) {
valid_types += ", "; valid_types += ", ";
} }
valid_types += "'" + E->get() + "'"; valid_types += "'" + E + "'";
} }
return valid_types; return valid_types;