Merge pull request #102354 from YYF233333/style_iterator

Use iterator pattern instead of manually traverse `List::Element *`
This commit is contained in:
Rémi Verschelde 2025-03-28 14:31:40 +01:00
commit e81eb3f1e9
No known key found for this signature in database
GPG key ID: C3336907360768E1
36 changed files with 150 additions and 173 deletions

View file

@ -1438,8 +1438,8 @@ void ProjectSettings::_add_builtin_input_map() {
Array events; Array events;
// Convert list of input events into array // Convert list of input events into array
for (List<Ref<InputEvent>>::Element *I = E.value.front(); I; I = I->next()) { for (const Ref<InputEvent> &event : E.value) {
events.push_back(I->get()); events.push_back(event);
} }
Dictionary action; Dictionary action;

View file

@ -466,8 +466,8 @@ bool OS::is_restart_on_exit_set() const {
Vector<String> OS::get_restart_on_exit_arguments() const { Vector<String> OS::get_restart_on_exit_arguments() const {
List<String> args = ::OS::get_singleton()->get_restart_on_exit_arguments(); List<String> args = ::OS::get_singleton()->get_restart_on_exit_arguments();
Vector<String> args_vector; Vector<String> args_vector;
for (List<String>::Element *E = args.front(); E; E = E->next()) { for (const String &arg : args) {
args_vector.push_back(E->get()); args_vector.push_back(arg);
} }
return args_vector; return args_vector;
@ -1879,8 +1879,8 @@ Vector<String> Engine::get_singleton_list() const {
List<::Engine::Singleton> singletons; List<::Engine::Singleton> singletons;
::Engine::get_singleton()->get_singletons(&singletons); ::Engine::get_singleton()->get_singletons(&singletons);
Vector<String> ret; Vector<String> ret;
for (List<::Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) { for (const ::Engine::Singleton &E : singletons) {
ret.push_back(E->get().name); ret.push_back(E.name);
} }
return ret; return ret;
} }

View file

@ -975,14 +975,14 @@ Dictionary GDExtensionAPIDump::generate_extension_api(bool p_include_docs) {
Array values; Array values;
List<StringName> enum_constant_list; List<StringName> enum_constant_list;
ClassDB::get_enum_constants(class_name, F, &enum_constant_list, true); ClassDB::get_enum_constants(class_name, F, &enum_constant_list, true);
for (List<StringName>::Element *G = enum_constant_list.front(); G; G = G->next()) { for (const StringName &enum_constant : enum_constant_list) {
Dictionary d3; Dictionary d3;
d3["name"] = String(G->get()); d3["name"] = String(enum_constant);
d3["value"] = ClassDB::get_integer_constant(class_name, G->get()); d3["value"] = ClassDB::get_integer_constant(class_name, enum_constant);
if (p_include_docs) { if (p_include_docs) {
for (const DocData::ConstantDoc &constant_doc : class_doc->constants) { for (const DocData::ConstantDoc &constant_doc : class_doc->constants) {
if (constant_doc.name == G->get()) { if (constant_doc.name == enum_constant) {
d3["description"] = fix_doc_description(constant_doc.description); d3["description"] = fix_doc_description(constant_doc.description);
break; break;
} }

View file

@ -103,9 +103,7 @@ Vector<Vector<Vector2>> Geometry2D::decompose_many_polygons_in_convex(const Vect
decomp.resize(out_poly.size()); decomp.resize(out_poly.size());
int idx = 0; int idx = 0;
for (List<TPPLPoly>::Element *I = out_poly.front(); I; I = I->next()) { for (TPPLPoly &tp : out_poly) {
TPPLPoly &tp = I->get();
decomp.write[idx].resize(tp.GetNumPoints()); decomp.write[idx].resize(tp.GetNumPoints());
for (int64_t i = 0; i < tp.GetNumPoints(); i++) { for (int64_t i = 0; i < tp.GetNumPoints(); i++) {

View file

@ -1089,8 +1089,8 @@ TypedArray<Dictionary> Object::_get_method_list_bind() const {
get_method_list(&ml); get_method_list(&ml);
TypedArray<Dictionary> ret; TypedArray<Dictionary> ret;
for (List<MethodInfo>::Element *E = ml.front(); E; E = E->next()) { for (const MethodInfo &mi : ml) {
Dictionary d = E->get(); Dictionary d = mi;
//va.push_back(d); //va.push_back(d);
ret.push_back(d); ret.push_back(d);
} }

View file

@ -53,8 +53,7 @@ void TranslationPO::print_translation_map() {
List<StringName> id_l; List<StringName> id_l;
inner_map.get_key_list(&id_l); inner_map.get_key_list(&id_l);
for (List<StringName>::Element *E2 = id_l.front(); E2; E2 = E2->next()) { for (const StringName &id : id_l) {
StringName id = E2->get();
file->store_line("msgid: " + String::utf8(String(id).utf8())); file->store_line("msgid: " + String::utf8(String(id).utf8()));
for (int i = 0; i < inner_map[id].size(); i++) { for (int i = 0; i < inner_map[id].size(); i++) {
file->store_line("msgstr[" + String::num_int64(i) + "]: " + String::utf8(String(inner_map[id][i]).utf8())); file->store_line("msgstr[" + String::num_int64(i) + "]: " + String::utf8(String(inner_map[id][i]).utf8()));

View file

@ -1468,8 +1468,8 @@ void TextureStorage::texture_debug_usage(List<RS::TextureInfo> *r_info) {
List<RID> textures; List<RID> textures;
texture_owner.get_owned_list(&textures); texture_owner.get_owned_list(&textures);
for (List<RID>::Element *E = textures.front(); E; E = E->next()) { for (const RID &rid : textures) {
Texture *t = texture_owner.get_or_null(E->get()); Texture *t = texture_owner.get_or_null(rid);
if (!t) { if (!t) {
continue; continue;
} }

View file

@ -1251,12 +1251,12 @@ void AnimationMultiTrackKeyEdit::_get_property_list(List<PropertyInfo> *p_list)
if (ap) { if (ap) {
List<StringName> anims; List<StringName> anims;
ap->get_animation_list(&anims); ap->get_animation_list(&anims);
for (List<StringName>::Element *G = anims.front(); G; G = G->next()) { for (const StringName &anim : anims) {
if (!animations.is_empty()) { if (!animations.is_empty()) {
animations += ","; animations += ",";
} }
animations += String(G->get()); animations += String(anim);
} }
} }
} }

View file

@ -1463,8 +1463,8 @@ void ConnectionsDock::update_tree() {
List<MethodInfo> base_signals; List<MethodInfo> base_signals;
base->get_script_signal_list(&base_signals); base->get_script_signal_list(&base_signals);
HashSet<String> base_signal_names; HashSet<String> base_signal_names;
for (List<MethodInfo>::Element *F = base_signals.front(); F; F = F->next()) { for (const MethodInfo &signal : base_signals) {
base_signal_names.insert(F->get().name); base_signal_names.insert(signal.name);
} }
for (List<MethodInfo>::Element *F = class_signals.front(); F; F = F->next()) { for (List<MethodInfo>::Element *F = class_signals.front(); F; F = F->next()) {
if (base_signal_names.has(F->get().name)) { if (base_signal_names.has(F->get().name)) {

View file

@ -83,8 +83,7 @@ void CreateDialog::_fill_type_list() {
EditorData &ed = EditorNode::get_editor_data(); EditorData &ed = EditorNode::get_editor_data();
for (List<StringName>::Element *I = complete_type_list.front(); I; I = I->next()) { for (const StringName &type : complete_type_list) {
StringName type = I->get();
if (!_should_hide_type(type)) { if (!_should_hide_type(type)) {
type_list.push_back(type); type_list.push_back(type);
@ -216,8 +215,7 @@ void CreateDialog::_update_search() {
float highest_score = 0.0f; float highest_score = 0.0f;
StringName best_match; StringName best_match;
for (List<StringName>::Element *I = type_list.front(); I; I = I->next()) { for (const StringName &candidate : type_list) {
StringName candidate = I->get();
if (empty_search || search_text.is_subsequence_ofn(candidate)) { if (empty_search || search_text.is_subsequence_ofn(candidate)) {
_add_type(candidate, ClassDB::class_exists(candidate) ? TypeCategory::CPP_TYPE : TypeCategory::OTHER_TYPE); _add_type(candidate, ClassDB::class_exists(candidate) ? TypeCategory::CPP_TYPE : TypeCategory::OTHER_TYPE);

View file

@ -144,9 +144,7 @@ Dictionary DebugAdapterParser::req_initialize(const Dictionary &p_params) const
// Send all current breakpoints // Send all current breakpoints
List<String> breakpoints; List<String> breakpoints;
ScriptEditor::get_singleton()->get_breakpoints(&breakpoints); ScriptEditor::get_singleton()->get_breakpoints(&breakpoints);
for (List<String>::Element *E = breakpoints.front(); E; E = E->next()) { for (const String &breakpoint : breakpoints) {
String breakpoint = E->get();
String path = breakpoint.left(breakpoint.find_char(':', 6)); // Skip initial part of path, aka "res://" String path = breakpoint.left(breakpoint.find_char(':', 6)); // Skip initial part of path, aka "res://"
int line = breakpoint.substr(path.size()).to_int(); int line = breakpoint.substr(path.size()).to_int();

View file

@ -906,66 +906,66 @@ void DebugAdapterProtocol::notify_process() {
String launch_mode = _current_peer->attached ? "attach" : "launch"; String launch_mode = _current_peer->attached ? "attach" : "launch";
Dictionary event = parser->ev_process(launch_mode); Dictionary event = parser->ev_process(launch_mode);
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
E->get()->res_queue.push_back(event); peer->res_queue.push_back(event);
} }
} }
void DebugAdapterProtocol::notify_terminated() { void DebugAdapterProtocol::notify_terminated() {
Dictionary event = parser->ev_terminated(); Dictionary event = parser->ev_terminated();
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
if ((_current_request == "launch" || _current_request == "restart") && _current_peer == E->get()) { if ((_current_request == "launch" || _current_request == "restart") && _current_peer == peer) {
continue; continue;
} }
E->get()->res_queue.push_back(event); peer->res_queue.push_back(event);
} }
} }
void DebugAdapterProtocol::notify_exited(const int &p_exitcode) { void DebugAdapterProtocol::notify_exited(const int &p_exitcode) {
Dictionary event = parser->ev_exited(p_exitcode); Dictionary event = parser->ev_exited(p_exitcode);
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
if ((_current_request == "launch" || _current_request == "restart") && _current_peer == E->get()) { if ((_current_request == "launch" || _current_request == "restart") && _current_peer == peer) {
continue; continue;
} }
E->get()->res_queue.push_back(event); peer->res_queue.push_back(event);
} }
} }
void DebugAdapterProtocol::notify_stopped_paused() { void DebugAdapterProtocol::notify_stopped_paused() {
Dictionary event = parser->ev_stopped_paused(); Dictionary event = parser->ev_stopped_paused();
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
E->get()->res_queue.push_back(event); peer->res_queue.push_back(event);
} }
} }
void DebugAdapterProtocol::notify_stopped_exception(const String &p_error) { void DebugAdapterProtocol::notify_stopped_exception(const String &p_error) {
Dictionary event = parser->ev_stopped_exception(p_error); Dictionary event = parser->ev_stopped_exception(p_error);
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
E->get()->res_queue.push_back(event); peer->res_queue.push_back(event);
} }
} }
void DebugAdapterProtocol::notify_stopped_breakpoint(const int &p_id) { void DebugAdapterProtocol::notify_stopped_breakpoint(const int &p_id) {
Dictionary event = parser->ev_stopped_breakpoint(p_id); Dictionary event = parser->ev_stopped_breakpoint(p_id);
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
E->get()->res_queue.push_back(event); peer->res_queue.push_back(event);
} }
} }
void DebugAdapterProtocol::notify_stopped_step() { void DebugAdapterProtocol::notify_stopped_step() {
Dictionary event = parser->ev_stopped_step(); Dictionary event = parser->ev_stopped_step();
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
E->get()->res_queue.push_back(event); peer->res_queue.push_back(event);
} }
} }
void DebugAdapterProtocol::notify_continued() { void DebugAdapterProtocol::notify_continued() {
Dictionary event = parser->ev_continued(); Dictionary event = parser->ev_continued();
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
if (_current_request == "continue" && E->get() == _current_peer) { if (_current_request == "continue" && peer == _current_peer) {
continue; continue;
} }
E->get()->res_queue.push_back(event); peer->res_queue.push_back(event);
} }
reset_stack_info(); reset_stack_info();
@ -973,15 +973,14 @@ void DebugAdapterProtocol::notify_continued() {
void DebugAdapterProtocol::notify_output(const String &p_message, RemoteDebugger::MessageType p_type) { void DebugAdapterProtocol::notify_output(const String &p_message, RemoteDebugger::MessageType p_type) {
Dictionary event = parser->ev_output(p_message, p_type); Dictionary event = parser->ev_output(p_message, p_type);
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
E->get()->res_queue.push_back(event); peer->res_queue.push_back(event);
} }
} }
void DebugAdapterProtocol::notify_custom_data(const String &p_msg, const Array &p_data) { void DebugAdapterProtocol::notify_custom_data(const String &p_msg, const Array &p_data) {
Dictionary event = parser->ev_custom_data(p_msg, p_data); Dictionary event = parser->ev_custom_data(p_msg, p_data);
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
Ref<DAPeer> peer = E->get();
if (peer->supportsCustomData) { if (peer->supportsCustomData) {
peer->res_queue.push_back(event); peer->res_queue.push_back(event);
} }
@ -990,11 +989,11 @@ void DebugAdapterProtocol::notify_custom_data(const String &p_msg, const Array &
void DebugAdapterProtocol::notify_breakpoint(const DAP::Breakpoint &p_breakpoint, const bool &p_enabled) { void DebugAdapterProtocol::notify_breakpoint(const DAP::Breakpoint &p_breakpoint, const bool &p_enabled) {
Dictionary event = parser->ev_breakpoint(p_breakpoint, p_enabled); Dictionary event = parser->ev_breakpoint(p_breakpoint, p_enabled);
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
if (_current_request == "setBreakpoints" && E->get() == _current_peer) { if (_current_request == "setBreakpoints" && peer == _current_peer) {
continue; continue;
} }
E->get()->res_queue.push_back(event); peer->res_queue.push_back(event);
} }
} }
@ -1013,8 +1012,7 @@ Array DebugAdapterProtocol::update_breakpoints(const String &p_path, const Array
} }
// Remove breakpoints // Remove breakpoints
for (List<DAP::Breakpoint>::Element *E = breakpoint_list.front(); E; E = E->next()) { for (const DAP::Breakpoint &b : breakpoint_list) {
DAP::Breakpoint b = E->get();
if (b.source.path == p_path && !p_lines.has(b.line)) { if (b.source.path == p_path && !p_lines.has(b.line)) {
EditorDebuggerNode::get_singleton()->get_default_debugger()->_set_breakpoint(p_path, b.line, false); EditorDebuggerNode::get_singleton()->get_default_debugger()->_set_breakpoint(p_path, b.line, false);
} }
@ -1133,8 +1131,7 @@ void DebugAdapterProtocol::on_debug_stack_frame_vars(const int &p_size) {
frame.id = _current_frame; frame.id = _current_frame;
ERR_FAIL_COND(!stackframe_list.has(frame)); ERR_FAIL_COND(!stackframe_list.has(frame));
List<int> scope_ids = stackframe_list.find(frame)->value; List<int> scope_ids = stackframe_list.find(frame)->value;
for (List<int>::Element *E = scope_ids.front(); E; E = E->next()) { for (const int var_id : scope_ids) {
int var_id = E->get();
if (variable_list.has(var_id)) { if (variable_list.has(var_id)) {
variable_list.find(var_id)->value.clear(); variable_list.find(var_id)->value.clear();
} else { } else {
@ -1195,8 +1192,7 @@ void DebugAdapterProtocol::poll() {
on_client_connected(); on_client_connected();
} }
List<Ref<DAPeer>> to_delete; List<Ref<DAPeer>> to_delete;
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
Ref<DAPeer> peer = E->get();
peer->connection->poll(); peer->connection->poll();
StreamPeerTCP::Status status = peer->connection->get_status(); StreamPeerTCP::Status status = peer->connection->get_status();
if (status == StreamPeerTCP::STATUS_NONE || status == StreamPeerTCP::STATUS_ERROR) { if (status == StreamPeerTCP::STATUS_NONE || status == StreamPeerTCP::STATUS_ERROR) {
@ -1214,8 +1210,8 @@ void DebugAdapterProtocol::poll() {
} }
} }
for (List<Ref<DAPeer>>::Element *E = to_delete.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : to_delete) {
on_client_disconnected(E->get()); on_client_disconnected(peer);
} }
to_delete.clear(); to_delete.clear();
} }
@ -1228,8 +1224,8 @@ Error DebugAdapterProtocol::start(int p_port, const IPAddress &p_bind_ip) {
} }
void DebugAdapterProtocol::stop() { void DebugAdapterProtocol::stop() {
for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) { for (const Ref<DAPeer> &peer : clients) {
E->get()->connection->disconnect_from_host(); peer->connection->disconnect_from_host();
} }
clients.clear(); clients.clear();

View file

@ -394,9 +394,9 @@ static Variant get_documentation_default_value(const StringName &p_class_name, c
// Cannot get default value of classes that can't be instantiated // Cannot get default value of classes that can't be instantiated
List<StringName> inheriting_classes; List<StringName> inheriting_classes;
ClassDB::get_direct_inheriters_from_class(p_class_name, &inheriting_classes); ClassDB::get_direct_inheriters_from_class(p_class_name, &inheriting_classes);
for (List<StringName>::Element *E2 = inheriting_classes.front(); E2; E2 = E2->next()) { for (const StringName &class_name : inheriting_classes) {
if (ClassDB::can_instantiate(E2->get())) { if (ClassDB::can_instantiate(class_name)) {
default_value = ClassDB::class_get_default_property_value(E2->get(), p_property_name, &r_default_value_valid); default_value = ClassDB::class_get_default_property_value(class_name, p_property_name, &r_default_value_valid);
if (r_default_value_valid) { if (r_default_value_valid) {
break; break;
} }
@ -657,10 +657,10 @@ void DocTools::generate(BitField<GenerateFlags> p_flags) {
ClassDB::get_signal_list(name, &signal_list, true); ClassDB::get_signal_list(name, &signal_list, true);
if (signal_list.size()) { if (signal_list.size()) {
for (List<MethodInfo>::Element *EV = signal_list.front(); EV; EV = EV->next()) { for (const MethodInfo &mi : signal_list) {
DocData::MethodDoc signal; DocData::MethodDoc signal;
signal.name = EV->get().name; signal.name = mi.name;
for (const PropertyInfo &arginfo : EV->get().arguments) { for (const PropertyInfo &arginfo : mi.arguments) {
DocData::ArgumentDoc argument; DocData::ArgumentDoc argument;
DocData::argument_doc_from_arginfo(argument, arginfo); DocData::argument_doc_from_arginfo(argument, arginfo);

View file

@ -598,8 +598,7 @@ void EditorData::instantiate_object_properties(Object *p_object) {
List<PropertyInfo> pinfo; List<PropertyInfo> pinfo;
p_object->get_property_list(&pinfo); p_object->get_property_list(&pinfo);
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { for (const PropertyInfo &pi : pinfo) {
PropertyInfo pi = E->get();
if (pi.type == Variant::OBJECT && pi.usage & PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT) { if (pi.type == Variant::OBJECT && pi.usage & PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT) {
Object *prop = ClassDB::instantiate(pi.class_name); Object *prop = ClassDB::instantiate(pi.class_name);
p_object->set(pi.name, prop); p_object->set(pi.name, prop);

View file

@ -1151,15 +1151,15 @@ int EditorFileSystem::_scan_new_dir(ScannedDirectory *p_dir, Ref<DirAccess> &da)
int nb_files_total_scan = 0; int nb_files_total_scan = 0;
for (List<String>::Element *E = dirs.front(); E; E = E->next()) { for (const String &dir : dirs) {
if (da->change_dir(E->get()) == OK) { if (da->change_dir(dir) == OK) {
String d = da->get_current_dir(); String d = da->get_current_dir();
if (d == cd || !d.begins_with(cd)) { if (d == cd || !d.begins_with(cd)) {
da->change_dir(cd); //avoid recursion da->change_dir(cd); //avoid recursion
} else { } else {
ScannedDirectory *sd = memnew(ScannedDirectory); ScannedDirectory *sd = memnew(ScannedDirectory);
sd->name = E->get(); sd->name = dir;
sd->full_path = p_dir->full_path.path_join(sd->name); sd->full_path = p_dir->full_path.path_join(sd->name);
nb_files_total_scan += _scan_new_dir(sd, da); nb_files_total_scan += _scan_new_dir(sd, da);
@ -1169,7 +1169,7 @@ int EditorFileSystem::_scan_new_dir(ScannedDirectory *p_dir, Ref<DirAccess> &da)
da->change_dir(".."); da->change_dir("..");
} }
} else { } else {
ERR_PRINT("Cannot go into subdir '" + E->get() + "'."); ERR_PRINT("Cannot go into subdir '" + dir + "'.");
} }
} }

View file

@ -780,9 +780,7 @@ bool EditorProperty::use_keying_next() const {
List<PropertyInfo> plist; List<PropertyInfo> plist;
object->get_property_list(&plist, true); object->get_property_list(&plist, true);
for (List<PropertyInfo>::Element *I = plist.front(); I; I = I->next()) { for (const PropertyInfo &p : plist) {
PropertyInfo &p = I->get();
if (p.name == property) { if (p.name == property) {
return (p.usage & PROPERTY_USAGE_KEYING_INCREMENTS); return (p.usage & PROPERTY_USAGE_KEYING_INCREMENTS);
} }

View file

@ -1642,22 +1642,22 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
} }
for (int i = 0; i < snapshots.size(); i++) { for (int i = 0; i < snapshots.size(); i++) {
for (List<int>::Element *ET = nm.anim_tracks.front(); ET; ET = ET->next()) { for (const int track_id : nm.anim_tracks) {
//apply tracks //apply tracks
if (p_clip == -1) { if (p_clip == -1) {
if (track_filter.has(ET->get())) { if (track_filter.has(track_id)) {
continue; continue;
} }
} else { } else {
if (!track_filter.has(ET->get())) { if (!track_filter.has(track_id)) {
continue; continue;
} }
} }
found_anim = true; found_anim = true;
const Collada::AnimationTrack &at = collada.state.animation_tracks[ET->get()]; const Collada::AnimationTrack &at = collada.state.animation_tracks[track_id];
int xform_idx = -1; int xform_idx = -1;
for (int j = 0; j < cn->xform_list.size(); j++) { for (int j = 0; j < cn->xform_list.size(); j++) {

View file

@ -533,8 +533,8 @@ void DynamicFontImportSettingsDialog::_variation_add() {
import_variation_data->owner = this; import_variation_data->owner = this;
ERR_FAIL_COND(import_variation_data.is_null()); ERR_FAIL_COND(import_variation_data.is_null());
for (List<ResourceImporter::ImportOption>::Element *E = options_variations.front(); E; E = E->next()) { for (const ResourceImporter::ImportOption &option : options_variations) {
import_variation_data->defaults[E->get().option.name] = E->get().default_value; import_variation_data->defaults[option.option.name] = option.default_value;
} }
import_variation_data->options = options_variations; import_variation_data->options = options_variations;
@ -1170,8 +1170,8 @@ void DynamicFontImportSettingsDialog::open_settings(const String &p_path) {
text_settings_data->owner = this; text_settings_data->owner = this;
for (List<ResourceImporter::ImportOption>::Element *F = options_text.front(); F; F = F->next()) { for (const ResourceImporter::ImportOption &option : options_text) {
text_settings_data->defaults[F->get().option.name] = F->get().default_value; text_settings_data->defaults[option.option.name] = option.default_value;
} }
text_settings_data->fd = font_main; text_settings_data->fd = font_main;
@ -1190,8 +1190,8 @@ void DynamicFontImportSettingsDialog::open_settings(const String &p_path) {
import_settings_data->settings.clear(); import_settings_data->settings.clear();
import_settings_data->defaults.clear(); import_settings_data->defaults.clear();
for (List<ResourceImporter::ImportOption>::Element *E = options_general.front(); E; E = E->next()) { for (const ResourceImporter::ImportOption &option : options_general) {
import_settings_data->defaults[E->get().option.name] = E->get().default_value; import_settings_data->defaults[option.option.name] = option.default_value;
} }
Ref<ConfigFile> config; Ref<ConfigFile> config;
@ -1203,8 +1203,7 @@ void DynamicFontImportSettingsDialog::open_settings(const String &p_path) {
if (err == OK) { if (err == OK) {
List<String> keys; List<String> keys;
config->get_section_keys("params", &keys); config->get_section_keys("params", &keys);
for (List<String>::Element *E = keys.front(); E; E = E->next()) { for (const String &key : keys) {
String key = E->get();
print_verbose(String(" ") + key + " == " + String(config->get_value("params", key))); print_verbose(String(" ") + key + " == " + String(config->get_value("params", key)));
if (key == "preload") { if (key == "preload") {
Array preload_configurations = config->get_value("params", key); Array preload_configurations = config->get_value("params", key);
@ -1231,8 +1230,8 @@ void DynamicFontImportSettingsDialog::open_settings(const String &p_path) {
ERR_FAIL_COND(import_variation_data_custom.is_null()); ERR_FAIL_COND(import_variation_data_custom.is_null());
import_variation_data_custom->owner = this; import_variation_data_custom->owner = this;
for (List<ResourceImporter::ImportOption>::Element *F = options_variations.front(); F; F = F->next()) { for (const ResourceImporter::ImportOption &option : options_variations) {
import_variation_data_custom->defaults[F->get().option.name] = F->get().default_value; import_variation_data_custom->defaults[option.option.name] = option.default_value;
} }
import_variation_data_custom->fd = font_main; import_variation_data_custom->fd = font_main;

View file

@ -81,16 +81,16 @@ Error ResourceImporterBMFont::import(ResourceUID::ID p_source_id, const String &
ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot load font to file \"" + p_source_file + "\"."); ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot load font to file \"" + p_source_file + "\".");
// Update import settings for the image files used by font. // Update import settings for the image files used by font.
for (List<String>::Element *E = image_files.front(); E; E = E->next()) { for (const String &file : image_files) {
Ref<ConfigFile> config; Ref<ConfigFile> config;
config.instantiate(); config.instantiate();
err = config->load(E->get() + ".import"); err = config->load(file + ".import");
if (err == OK) { if (err == OK) {
config->clear(); config->clear();
config->set_value("remap", "importer", "skip"); config->set_value("remap", "importer", "skip");
config->save(E->get() + ".import"); config->save(file + ".import");
} }
} }

View file

@ -643,14 +643,14 @@ void AnimationNodeStateMachineEditor::_open_menu(const Vector2 &p_position) {
ClassDB::get_inheriters_from_class("AnimationRootNode", &classes); ClassDB::get_inheriters_from_class("AnimationRootNode", &classes);
classes.sort_custom<StringName::AlphCompare>(); classes.sort_custom<StringName::AlphCompare>();
for (List<StringName>::Element *E = classes.front(); E; E = E->next()) { for (const StringName &class_name : classes) {
String name = String(E->get()).replace_first("AnimationNode", ""); String name = String(class_name).replace_first("AnimationNode", "");
if (name == "Animation" || name == "StartState" || name == "EndState") { if (name == "Animation" || name == "StartState" || name == "EndState") {
continue; // nope continue; // nope
} }
int idx = menu->get_item_count(); int idx = menu->get_item_count();
menu->add_item(vformat(TTR("Add %s"), name), idx); menu->add_item(vformat(TTR("Add %s"), name), idx);
menu->set_item_metadata(idx, E->get()); menu->set_item_metadata(idx, class_name);
} }
Ref<AnimationNode> clipb = EditorSettings::get_singleton()->get_resource_clipboard(); Ref<AnimationNode> clipb = EditorSettings::get_singleton()->get_resource_clipboard();
@ -2019,16 +2019,16 @@ void EditorAnimationMultiTransitionEdit::_get_property_list(List<PropertyInfo> *
prop_transition_path.name = itos(i) + "/" + "transition_path"; prop_transition_path.name = itos(i) + "/" + "transition_path";
p_list->push_back(prop_transition_path); p_list->push_back(prop_transition_path);
for (List<PropertyInfo>::Element *F = plist.front(); F; F = F->next()) { for (const PropertyInfo &pi : plist) {
if (F->get().name == "script" || F->get().name == "resource_name" || F->get().name == "resource_path" || F->get().name == "resource_local_to_scene") { if (pi.name == "script" || pi.name == "resource_name" || pi.name == "resource_path" || pi.name == "resource_local_to_scene") {
continue; continue;
} }
if (F->get().usage != PROPERTY_USAGE_DEFAULT) { if (pi.usage != PROPERTY_USAGE_DEFAULT) {
continue; continue;
} }
PropertyInfo prop = F->get(); PropertyInfo prop = pi;
prop.name = itos(i) + "/" + prop.name; prop.name = itos(i) + "/" + prop.name;
p_list->push_back(prop); p_list->push_back(prop);

View file

@ -463,13 +463,13 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
tile_data->get_property_list(&list); tile_data->get_property_list(&list);
HashMap<String, int> counts; // Counts the number of time a property appears (useful for groups that may appear more than once) HashMap<String, int> counts; // Counts the number of time a property appears (useful for groups that may appear more than once)
for (List<PropertyInfo>::Element *E_property = list.front(); E_property; E_property = E_property->next()) { for (const PropertyInfo &property : list) {
// Don't show category for TileData. // Don't show category for TileData.
if (E_property->get().usage & PROPERTY_USAGE_CATEGORY) { if (property.usage & PROPERTY_USAGE_CATEGORY) {
continue; continue;
} }
const String &property_string = E_property->get().name; const String &property_string = property.name;
if (!tile_data->is_allowing_transform() && (property_string == "flip_h" || property_string == "flip_v" || property_string == "transpose")) { if (!tile_data->is_allowing_transform() && (property_string == "flip_h" || property_string == "flip_v" || property_string == "transpose")) {
continue; continue;
} }
@ -480,7 +480,7 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
counts[property_string] += 1; counts[property_string] += 1;
} }
PropertyInfo stored_property_info = E_property->get(); PropertyInfo stored_property_info = property;
stored_property_info.usage |= PROPERTY_USAGE_STORAGE; // Ignore the storage flag in comparing properties. stored_property_info.usage |= PROPERTY_USAGE_STORAGE; // Ignore the storage flag in comparing properties.
PropertyId id = { counts[property_string], property_string }; PropertyId id = { counts[property_string], property_string };

View file

@ -222,8 +222,7 @@ void VersionControlEditorPlugin::_refresh_commit_list() {
List<EditorVCSInterface::Commit> commit_info_list = EditorVCSInterface::get_singleton()->get_previous_commits(commit_list_size_button->get_selected_metadata()); List<EditorVCSInterface::Commit> commit_info_list = EditorVCSInterface::get_singleton()->get_previous_commits(commit_list_size_button->get_selected_metadata());
for (List<EditorVCSInterface::Commit>::Element *e = commit_info_list.front(); e; e = e->next()) { for (const EditorVCSInterface::Commit &commit : commit_info_list) {
EditorVCSInterface::Commit commit = e->get();
TreeItem *item = commit_list->create_item(); TreeItem *item = commit_list->create_item();
// Only display the first line of a commit message // Only display the first line of a commit message
@ -370,8 +369,7 @@ void VersionControlEditorPlugin::_refresh_stage_area() {
unstaged_files->get_root()->clear_children(); unstaged_files->get_root()->clear_children();
List<EditorVCSInterface::StatusFile> status_files = EditorVCSInterface::get_singleton()->get_modified_files_data(); List<EditorVCSInterface::StatusFile> status_files = EditorVCSInterface::get_singleton()->get_modified_files_data();
for (List<EditorVCSInterface::StatusFile>::Element *E = status_files.front(); E; E = E->next()) { for (const EditorVCSInterface::StatusFile &sf : status_files) {
EditorVCSInterface::StatusFile sf = E->get();
if (sf.area == EditorVCSInterface::TREE_AREA_STAGED) { if (sf.area == EditorVCSInterface::TREE_AREA_STAGED) {
_add_new_item(staged_files, sf.file_path, sf.change_type); _add_new_item(staged_files, sf.file_path, sf.change_type);
} else if (sf.area == EditorVCSInterface::TREE_AREA_UNSTAGED) { } else if (sf.area == EditorVCSInterface::TREE_AREA_UNSTAGED) {

View file

@ -4421,8 +4421,8 @@ void VisualShaderEditor::_delete_nodes(int p_type, const List<int> &p_nodes) {
for (const VisualShader::Connection &E : conns) { for (const VisualShader::Connection &E : conns) {
if (E.from_node == F || E.to_node == F) { if (E.from_node == F || E.to_node == F) {
bool cancel = false; bool cancel = false;
for (List<VisualShader::Connection>::Element *R = used_conns.front(); R; R = R->next()) { for (const VisualShader::Connection &R : used_conns) {
if (R->get().from_node == E.from_node && R->get().from_port == E.from_port && R->get().to_node == E.to_node && R->get().to_port == E.to_port) { if (R.from_node == E.from_node && R.from_port == E.from_port && R.to_node == E.to_node && R.to_port == E.to_port) {
cancel = true; // to avoid ERR_ALREADY_EXISTS warning cancel = true; // to avoid ERR_ALREADY_EXISTS warning
break; break;
} }

View file

@ -142,8 +142,8 @@ void ProjectManager::_build_icon_type_cache(Ref<Theme> p_theme) {
} }
List<StringName> tl; List<StringName> tl;
p_theme->get_icon_list(EditorStringName(EditorIcons), &tl); p_theme->get_icon_list(EditorStringName(EditorIcons), &tl);
for (List<StringName>::Element *E = tl.front(); E; E = E->next()) { for (const StringName &name : tl) {
icon_type_cache[E->get()] = p_theme->get_icon(E->get(), EditorStringName(EditorIcons)); icon_type_cache[name] = p_theme->get_icon(name, EditorStringName(EditorIcons));
} }
} }

View file

@ -72,8 +72,8 @@ Error ENetConnection::create_host(int p_max_peers, int p_max_channels, int p_in_
void ENetConnection::destroy() { void ENetConnection::destroy() {
ERR_FAIL_NULL_MSG(host, "Host already destroyed."); ERR_FAIL_NULL_MSG(host, "Host already destroyed.");
for (List<Ref<ENetPacketPeer>>::Element *E = peers.front(); E; E = E->next()) { for (const Ref<ENetPacketPeer> &peer : peers) {
E->get()->_on_disconnect(); peer->_on_disconnect();
} }
peers.clear(); peers.clear();
enet_host_destroy(host); enet_host_destroy(host);

View file

@ -1508,8 +1508,8 @@ static void _find_identifiers(const GDScriptParser::CompletionContext &p_context
List<StringName> utility_func_names; List<StringName> utility_func_names;
Variant::get_utility_function_list(&utility_func_names); Variant::get_utility_function_list(&utility_func_names);
for (List<StringName>::Element *E = utility_func_names.front(); E; E = E->next()) { for (const StringName &util_func_name : utility_func_names) {
ScriptLanguage::CodeCompletionOption option(E->get(), ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION); ScriptLanguage::CodeCompletionOption option(util_func_name, ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION);
option.insert_text += "("; option.insert_text += "(";
option.display += U"(\u2026)"; // As all utility functions contain an argument or more, this is hardcoded here. option.display += U"(\u2026)"; // As all utility functions contain an argument or more, this is hardcoded here.
r_result.insert(option.display, option); r_result.insert(option.display, option);

View file

@ -543,8 +543,8 @@ Vector<LSP::Location> GDScriptWorkspace::find_all_usages(const LSP::DocumentSymb
list_script_files("res://", paths); list_script_files("res://", paths);
Vector<LSP::Location> usages; Vector<LSP::Location> usages;
for (List<String>::Element *PE = paths.front(); PE; PE = PE->next()) { for (const String &path : paths) {
usages.append_array(find_usages_in_file(p_symbol, PE->get())); usages.append_array(find_usages_in_file(p_symbol, path));
} }
return usages; return usages;
} }

View file

@ -1873,7 +1873,7 @@ struct GodotNativeClassInfo {
const DocData::ClassDoc *class_doc = nullptr; const DocData::ClassDoc *class_doc = nullptr;
const ClassDB::ClassInfo *class_info = nullptr; const ClassDB::ClassInfo *class_info = nullptr;
Dictionary to_json() { Dictionary to_json() const {
Dictionary dict; Dictionary dict;
dict["name"] = name; dict["name"] = name;
dict["inherits"] = class_doc->inherits; dict["inherits"] = class_doc->inherits;
@ -1888,11 +1888,11 @@ struct GodotCapabilities {
*/ */
List<GodotNativeClassInfo> native_classes; List<GodotNativeClassInfo> native_classes;
Dictionary to_json() { Dictionary to_json() const {
Dictionary dict; Dictionary dict;
Array classes; Array classes;
for (List<GodotNativeClassInfo>::Element *E = native_classes.front(); E; E = E->next()) { for (const GodotNativeClassInfo &native_class : native_classes) {
classes.push_back(E->get().to_json()); classes.push_back(native_class.to_json());
} }
dict["native_classes"] = classes; dict["native_classes"] = classes;
return dict; return dict;

View file

@ -502,9 +502,7 @@ void NavMeshGenerator2D::generator_bake_from_source_geometry_data(Ref<Navigation
Vector<Vector<int>> new_polygons; Vector<Vector<int>> new_polygons;
HashMap<Vector2, int> points; HashMap<Vector2, int> points;
for (List<TPPLPoly>::Element *I = tppl_out_polygon.front(); I; I = I->next()) { for (const TPPLPoly &tp : tppl_out_polygon) {
TPPLPoly &tp = I->get();
Vector<int> new_polygon; Vector<int> new_polygon;
for (int64_t i = 0; i < tp.GetNumPoints(); i++) { for (int64_t i = 0; i < tp.GetNumPoints(); i++) {

View file

@ -256,8 +256,7 @@ void AnimationPlayer::_process_playback_data(PlaybackData &cd, double p_delta, f
float AnimationPlayer::get_current_blend_amount() { float AnimationPlayer::get_current_blend_amount() {
Playback &c = playback; Playback &c = playback;
float blend = 1.0; float blend = 1.0;
for (List<Blend>::Element *E = c.blend.front(); E; E = E->next()) { for (const Blend &b : c.blend) {
Blend &b = E->get();
blend = blend - b.blend_left; blend = blend - b.blend_left;
} }
return MAX(0, blend); return MAX(0, blend);

View file

@ -2679,11 +2679,11 @@ bool Node::is_part_of_edited_scene() const {
void Node::get_storable_properties(HashSet<StringName> &r_storable_properties) const { void Node::get_storable_properties(HashSet<StringName> &r_storable_properties) const {
ERR_THREAD_GUARD ERR_THREAD_GUARD
List<PropertyInfo> pi; List<PropertyInfo> property_list;
get_property_list(&pi); get_property_list(&property_list);
for (List<PropertyInfo>::Element *E = pi.front(); E; E = E->next()) { for (const PropertyInfo &pi : property_list) {
if ((E->get().usage & PROPERTY_USAGE_STORAGE)) { if ((pi.usage & PROPERTY_USAGE_STORAGE)) {
r_storable_properties.insert(E->get().name); r_storable_properties.insert(pi.name);
} }
} }
} }

View file

@ -396,9 +396,7 @@ void NavigationPolygon::make_polygons_from_outlines() {
vertices.clear(); vertices.clear();
HashMap<Vector2, int> points; HashMap<Vector2, int> points;
for (List<TPPLPoly>::Element *I = out_poly.front(); I; I = I->next()) { for (const TPPLPoly &tp : out_poly) {
TPPLPoly &tp = I->get();
Vector<int> p; Vector<int> p;
for (int64_t i = 0; i < tp.GetNumPoints(); i++) { for (int64_t i = 0; i < tp.GetNumPoints(); i++) {

View file

@ -3105,14 +3105,13 @@ void TextMesh::_generate_glyph_mesh_data(const GlyphMeshKey &p_key, const Glyph
ERR_FAIL_MSG("Convex decomposing failed. Make sure the font doesn't contain self-intersecting lines, as these are not supported in TextMesh."); ERR_FAIL_MSG("Convex decomposing failed. Make sure the font doesn't contain self-intersecting lines, as these are not supported in TextMesh.");
} }
List<TPPLPoly> out_tris; List<TPPLPoly> out_tris;
for (List<TPPLPoly>::Element *I = out_poly.front(); I; I = I->next()) { for (TPPLPoly &tp : out_poly) {
if (tpart.Triangulate_OPT(&(I->get()), &out_tris) == 0) { if (tpart.Triangulate_OPT(&tp, &out_tris) == 0) {
ERR_FAIL_MSG("Triangulation failed. Make sure the font doesn't contain self-intersecting lines, as these are not supported in TextMesh."); ERR_FAIL_MSG("Triangulation failed. Make sure the font doesn't contain self-intersecting lines, as these are not supported in TextMesh.");
} }
} }
for (List<TPPLPoly>::Element *I = out_tris.front(); I; I = I->next()) { for (const TPPLPoly &tp : out_tris) {
TPPLPoly &tp = I->get();
ERR_FAIL_COND(tp.GetNumPoints() != 3); // Triangles only. ERR_FAIL_COND(tp.GetNumPoints() != 3); // Triangles only.
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {

View file

@ -257,10 +257,10 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const {
bool is_none_group_undefined = true; bool is_none_group_undefined = true;
bool is_none_group = true; bool is_none_group = true;
for (List<PropertyInfo>::Element *E = list.front(); E; E = E->next()) { for (const PropertyInfo &pi : list) {
if (E->get().usage == PROPERTY_USAGE_GROUP) { if (pi.usage == PROPERTY_USAGE_GROUP) {
if (!E->get().name.is_empty()) { if (!pi.name.is_empty()) {
Vector<String> vgroup = E->get().name.split("::"); Vector<String> vgroup = pi.name.split("::");
last_group = vgroup[0]; last_group = vgroup[0];
if (vgroup.size() > 1) { if (vgroup.size() > 1) {
last_subgroup = vgroup[1]; last_subgroup = vgroup[1];
@ -322,23 +322,23 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const {
vgroups.push_back(Pair<String, LocalVector<String>>("<None>", { "<None>" })); vgroups.push_back(Pair<String, LocalVector<String>>("<None>", { "<None>" }));
} }
const bool is_uniform_cached = param_cache.has(E->get().name); const bool is_uniform_cached = param_cache.has(pi.name);
bool is_uniform_type_compatible = true; bool is_uniform_type_compatible = true;
if (is_uniform_cached) { if (is_uniform_cached) {
// Check if the uniform Variant type changed, for example vec3 to vec4. // Check if the uniform Variant type changed, for example vec3 to vec4.
const Variant &cached = param_cache.get(E->get().name); const Variant &cached = param_cache.get(pi.name);
if (cached.is_array()) { if (cached.is_array()) {
// Allow some array conversions for backwards compatibility. // Allow some array conversions for backwards compatibility.
is_uniform_type_compatible = Variant::can_convert(E->get().type, cached.get_type()); is_uniform_type_compatible = Variant::can_convert(pi.type, cached.get_type());
} else { } else {
is_uniform_type_compatible = E->get().type == cached.get_type(); is_uniform_type_compatible = pi.type == cached.get_type();
} }
#ifndef DISABLE_DEPRECATED #ifndef DISABLE_DEPRECATED
// PackedFloat32Array -> PackedVector4Array conversion. // PackedFloat32Array -> PackedVector4Array conversion.
if (!is_uniform_type_compatible && E->get().type == Variant::PACKED_VECTOR4_ARRAY && cached.get_type() == Variant::PACKED_FLOAT32_ARRAY) { if (!is_uniform_type_compatible && pi.type == Variant::PACKED_VECTOR4_ARRAY && cached.get_type() == Variant::PACKED_FLOAT32_ARRAY) {
PackedVector4Array varray; PackedVector4Array varray;
PackedFloat32Array array = (PackedFloat32Array)cached; PackedFloat32Array array = (PackedFloat32Array)cached;
@ -346,28 +346,28 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const {
varray.push_back(Vector4(array[i], array[i + 1], array[i + 2], array[i + 3])); varray.push_back(Vector4(array[i], array[i + 1], array[i + 2], array[i + 3]));
} }
param_cache.insert(E->get().name, varray); param_cache.insert(pi.name, varray);
is_uniform_type_compatible = true; is_uniform_type_compatible = true;
} }
#endif #endif
if (is_uniform_type_compatible && E->get().type == Variant::OBJECT && cached.get_type() == Variant::OBJECT) { if (is_uniform_type_compatible && pi.type == Variant::OBJECT && cached.get_type() == Variant::OBJECT) {
// Check if the Object class (hint string) changed, for example Texture2D sampler to Texture3D. // Check if the Object class (hint string) changed, for example Texture2D sampler to Texture3D.
// Allow inheritance, Texture2D type sampler should also accept CompressedTexture2D. // Allow inheritance, Texture2D type sampler should also accept CompressedTexture2D.
Object *cached_obj = cached; Object *cached_obj = cached;
if (!cached_obj->is_class(E->get().hint_string)) { if (!cached_obj->is_class(pi.hint_string)) {
is_uniform_type_compatible = false; is_uniform_type_compatible = false;
} }
} }
} }
PropertyInfo info = E->get(); PropertyInfo info = pi;
info.name = "shader_parameter/" + info.name; info.name = "shader_parameter/" + info.name;
if (!is_uniform_cached || !is_uniform_type_compatible) { if (!is_uniform_cached || !is_uniform_type_compatible) {
// Property has never been edited or its type changed, retrieve with default value. // Property has never been edited or its type changed, retrieve with default value.
Variant default_value = RenderingServer::get_singleton()->shader_get_parameter_default(shader->get_rid(), E->get().name); Variant default_value = RenderingServer::get_singleton()->shader_get_parameter_default(shader->get_rid(), pi.name);
param_cache.insert(E->get().name, default_value); param_cache.insert(pi.name, default_value);
remap_cache.insert(info.name, E->get().name); remap_cache.insert(info.name, pi.name);
} }
groups[last_group][last_subgroup].push_back(info); groups[last_group][last_subgroup].push_back(info);
} }
@ -376,8 +376,8 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const {
String group = group_pair.first; String group = group_pair.first;
for (const String &subgroup : group_pair.second) { for (const String &subgroup : group_pair.second) {
List<PropertyInfo> &prop_infos = groups[group][subgroup]; List<PropertyInfo> &prop_infos = groups[group][subgroup];
for (List<PropertyInfo>::Element *item = prop_infos.front(); item; item = item->next()) { for (const PropertyInfo &item : prop_infos) {
p_list->push_back(item->get()); p_list->push_back(item);
} }
} }
} }

View file

@ -1905,18 +1905,18 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso
List<PropertyInfo> property_list; List<PropertyInfo> property_list;
res->get_property_list(&property_list); res->get_property_list(&property_list);
for (List<PropertyInfo>::Element *PE = property_list.front(); PE; PE = PE->next()) { for (const PropertyInfo &pi : property_list) {
if (skip_editor && PE->get().name.begins_with("__editor")) { if (skip_editor && pi.name.begins_with("__editor")) {
continue; continue;
} }
if (PE->get().name == META_PROPERTY_MISSING_RESOURCES) { if (pi.name == META_PROPERTY_MISSING_RESOURCES) {
continue; continue;
} }
if (PE->get().usage & PROPERTY_USAGE_STORAGE || missing_resource_properties.has(PE->get().name)) { if (pi.usage & PROPERTY_USAGE_STORAGE || missing_resource_properties.has(pi.name)) {
String name = PE->get().name; String name = pi.name;
Variant value; Variant value;
if (PE->get().usage & PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT) { if (pi.usage & PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT) {
NonPersistentKey npk; NonPersistentKey npk;
npk.base = res; npk.base = res;
npk.property = name; npk.property = name;
@ -1927,11 +1927,11 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso
value = res->get(name); value = res->get(name);
} }
if (PE->get().type == Variant::OBJECT && missing_resource_properties.has(PE->get().name)) { if (pi.type == Variant::OBJECT && missing_resource_properties.has(pi.name)) {
// Was this missing resource overridden? If so do not save the old value. // Was this missing resource overridden? If so do not save the old value.
Ref<Resource> ures = value; Ref<Resource> ures = value;
if (ures.is_null()) { if (ures.is_null()) {
value = missing_resource_properties[PE->get().name]; value = missing_resource_properties[pi.name];
} }
} }
@ -1941,7 +1941,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso
continue; continue;
} }
if (PE->get().type == Variant::OBJECT && value.is_zero() && !(PE->get().usage & PROPERTY_USAGE_STORE_IF_NULL)) { if (pi.type == Variant::OBJECT && value.is_zero() && !(pi.usage & PROPERTY_USAGE_STORE_IF_NULL)) {
continue; continue;
} }

View file

@ -1643,8 +1643,8 @@ void TextureStorage::texture_debug_usage(List<RS::TextureInfo> *r_info) {
List<RID> textures; List<RID> textures;
texture_owner.get_owned_list(&textures); texture_owner.get_owned_list(&textures);
for (List<RID>::Element *E = textures.front(); E; E = E->next()) { for (const RID &rid : textures) {
Texture *t = texture_owner.get_or_null(E->get()); Texture *t = texture_owner.get_or_null(rid);
if (!t) { if (!t) {
continue; continue;
} }