diff options
Diffstat (limited to 'editor')
63 files changed, 295 insertions, 296 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 0b4f4964c1..1e3140e202 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -898,7 +898,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { } // 6-(undo) reinsert overlapped keys - for (AnimMoveRestore &amr : to_restore) { + for (const AnimMoveRestore &amr : to_restore) { undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, 1); } @@ -1090,7 +1090,7 @@ void AnimationBezierTrackEdit::duplicate_selection() { //reselect duplicated selection.clear(); - for (Pair<int, float> &E : new_selection_values) { + for (const Pair<int, float> &E : new_selection_values) { int track = E.first; float time = E.second; diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 2adfc29f74..91835c1866 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -598,7 +598,7 @@ public: if (ap) { List<StringName> anims; ap->get_animation_list(&anims); - for (StringName &E : anims) { + for (const StringName &E : anims) { if (animations != String()) { animations += ","; } @@ -3356,7 +3356,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) { } insert_frame = Engine::get_singleton()->get_frames_drawn(); - for (InsertData &E : insert_data) { + for (const InsertData &E : insert_data) { //prevent insertion of multiple tracks if (E.path == p_id.path) { return; //already inserted a track for this on this frame @@ -3843,7 +3843,7 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b List<PropertyInfo> pinfo; property_info_base.get_property_list(&pinfo); - for (PropertyInfo &E : pinfo) { + for (const PropertyInfo &E : pinfo) { if (E.name == leftover_path[leftover_path.size() - 1]) { return E; } @@ -4675,7 +4675,7 @@ void AnimationTrackEditor::_add_method_key(const String &p_method) { List<MethodInfo> minfo; base->get_method_list(&minfo); - for (MethodInfo &E : minfo) { + for (const MethodInfo &E : minfo) { if (E.name == p_method) { Dictionary d; d["method"] = p_method; @@ -5150,7 +5150,7 @@ void AnimationTrackEditor::_anim_duplicate_keys(bool transpose) { //reselect duplicated Map<SelectedKey, KeyInfo> new_selection; - for (Pair<int, float> &E : new_selection_values) { + for (const Pair<int, float> &E : new_selection_values) { int track = E.first; float time = E.second; @@ -5541,7 +5541,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { if (cleanup_all->is_pressed()) { List<StringName> names; AnimationPlayerEditor::singleton->get_player()->get_animation_list(&names); - for (StringName &E : names) { + for (const StringName &E : names) { _cleanup_animation(AnimationPlayerEditor::singleton->get_player()->get_animation(E)); } } else { diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 012276fe10..03695419cb 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -854,7 +854,7 @@ void CodeTextEditor::_complete_request() { return; } - for (ScriptCodeCompletionOption &e : entries) { + for (const ScriptCodeCompletionOption &e : entries) { Color font_color = completion_font_color; if (e.insert_text.begins_with("\"") || e.insert_text.begins_with("\'")) { font_color = completion_string_color; diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index f5cfe0fe57..c773f51342 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -1023,7 +1023,7 @@ void ConnectionsDock::update_tree() { List<Object::Connection> connections; selectedNode->get_signal_connection_list(signal_name, &connections); - for (Object::Connection &F : connections) { + for (const Object::Connection &F : connections) { Connection cn = F; if (!(cn.flags & CONNECT_PERSIST)) { continue; diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index abe17bf427..3389b53317 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -447,7 +447,7 @@ Variant CreateDialog::instance_selected() { List<PropertyInfo> pinfo; ((Object *)obj)->get_property_list(&pinfo); - for (PropertyInfo &pi : pinfo) { + for (const PropertyInfo &pi : pinfo) { if (pi.type == Variant::OBJECT && pi.usage & PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT) { Object *prop = ClassDB::instantiate(pi.class_name); ((Object *)obj)->set(pi.name, prop); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 8af59a62de..9856fbec74 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -347,7 +347,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da uint64_t total = 0; - for (DebuggerMarshalls::ResourceInfo &E : usage.infos) { + for (const DebuggerMarshalls::ResourceInfo &E : usage.infos) { TreeItem *it = vmem_tree->create_item(root); String type = E.type; int bytes = E.vram; diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 3306fc3b44..069ae2c7f2 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -55,7 +55,7 @@ void DependencyEditor::_load_pressed(Object *p_item, int p_cell, int p_button) { search->clear_filters(); List<String> ext; ResourceLoader::get_recognized_extensions_for_type(ti->get_metadata(0), &ext); - for (String &E : ext) { + for (const String &E : ext) { search->add_filter("*" + E); } search->popup_file_dialog(); @@ -120,7 +120,7 @@ void DependencyEditor::_fix_all() { Map<String, Map<String, String>> candidates; - for (String &E : missing) { + for (const String &E : missing) { String base = E.get_file(); if (!candidates.has(base)) { candidates[base] = Map<String, String>(); @@ -166,7 +166,7 @@ void DependencyEditor::_update_list() { bool broken = false; - for (String &n : deps) { + for (const String &n : deps) { TreeItem *item = tree->create_item(root); String path; String type; @@ -748,7 +748,7 @@ void OrphanResourcesDialog::_find_to_delete(TreeItem *p_item, List<String> &path void OrphanResourcesDialog::_delete_confirm() { DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES); - for (String &E : paths) { + for (const String &E : paths) { da->remove(E); EditorFileSystem::get_singleton()->update_file(E); } diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index 9258ff8043..cbd4a1b916 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -266,7 +266,7 @@ void DocTools::generate(bool p_basic_types) { } List<PropertyInfo>::Element *EO = own_properties.front(); - for (PropertyInfo &E : properties) { + for (const PropertyInfo &E : properties) { bool inherited = EO == nullptr; if (EO && EO->get() == E) { inherited = false; @@ -367,7 +367,7 @@ void DocTools::generate(bool p_basic_types) { ClassDB::get_method_list(name, &method_list, true); method_list.sort(); - for (MethodInfo &E : method_list) { + for (const MethodInfo &E : method_list) { if (E.name == "" || (E.name[0] == '_' && !(E.flags & METHOD_FLAG_VIRTUAL))) { continue; //hidden, don't count } @@ -455,7 +455,7 @@ void DocTools::generate(bool p_basic_types) { List<String> constant_list; ClassDB::get_integer_constant_list(name, &constant_list, true); - for (String &E : constant_list) { + for (const String &E : constant_list) { DocData::ConstantDoc constant; constant.name = E; constant.value = itos(ClassDB::get_integer_constant(name, E)); @@ -469,7 +469,7 @@ void DocTools::generate(bool p_basic_types) { { List<StringName> l; Theme::get_default()->get_constant_list(cname, &l); - for (StringName &E : l) { + for (const StringName &E : l) { DocData::PropertyDoc pd; pd.name = E; pd.type = "int"; @@ -479,7 +479,7 @@ void DocTools::generate(bool p_basic_types) { l.clear(); Theme::get_default()->get_color_list(cname, &l); - for (StringName &E : l) { + for (const StringName &E : l) { DocData::PropertyDoc pd; pd.name = E; pd.type = "Color"; @@ -489,7 +489,7 @@ void DocTools::generate(bool p_basic_types) { l.clear(); Theme::get_default()->get_icon_list(cname, &l); - for (StringName &E : l) { + for (const StringName &E : l) { DocData::PropertyDoc pd; pd.name = E; pd.type = "Texture2D"; @@ -497,7 +497,7 @@ void DocTools::generate(bool p_basic_types) { } l.clear(); Theme::get_default()->get_font_list(cname, &l); - for (StringName &E : l) { + for (const StringName &E : l) { DocData::PropertyDoc pd; pd.name = E; pd.type = "Font"; @@ -505,7 +505,7 @@ void DocTools::generate(bool p_basic_types) { } l.clear(); Theme::get_default()->get_font_size_list(cname, &l); - for (StringName &E : l) { + for (const StringName &E : l) { DocData::PropertyDoc pd; pd.name = E; pd.type = "int"; @@ -513,7 +513,7 @@ void DocTools::generate(bool p_basic_types) { } l.clear(); Theme::get_default()->get_stylebox_list(cname, &l); - for (StringName &E : l) { + for (const StringName &E : l) { DocData::PropertyDoc pd; pd.name = E; pd.type = "StyleBox"; @@ -621,7 +621,7 @@ void DocTools::generate(bool p_basic_types) { method_list.push_back(mi); } - for (MethodInfo &mi : method_list) { + for (const MethodInfo &mi : method_list) { DocData::MethodDoc method; method.name = mi.name; @@ -674,7 +674,7 @@ void DocTools::generate(bool p_basic_types) { List<PropertyInfo> properties; v.get_property_list(&properties); - for (PropertyInfo &pi : properties) { + for (const PropertyInfo &pi : properties) { DocData::PropertyDoc property; property.name = pi.name; property.type = Variant::get_type_name(pi.type); @@ -686,7 +686,7 @@ void DocTools::generate(bool p_basic_types) { List<StringName> constants; Variant::get_constants_for_type(Variant::Type(i), &constants); - for (StringName &E : constants) { + for (const StringName &E : constants) { DocData::ConstantDoc constant; constant.name = E; Variant value = Variant::get_constant_value(Variant::Type(i), E); @@ -721,7 +721,7 @@ void DocTools::generate(bool p_basic_types) { Engine::get_singleton()->get_singletons(&singletons); //servers (this is kind of hackish) - for (Engine::Singleton &s : singletons) { + for (const Engine::Singleton &s : singletons) { DocData::PropertyDoc pd; if (!s.ptr) { continue; @@ -740,7 +740,7 @@ void DocTools::generate(bool p_basic_types) { List<StringName> utility_functions; Variant::get_utility_function_list(&utility_functions); utility_functions.sort_custom<StringName::AlphCompare>(); - for (StringName &E : utility_functions) { + for (const StringName &E : utility_functions) { DocData::MethodDoc md; md.name = E; //return @@ -790,7 +790,7 @@ void DocTools::generate(bool p_basic_types) { List<MethodInfo> minfo; lang->get_public_functions(&minfo); - for (MethodInfo &mi : minfo) { + for (const MethodInfo &mi : minfo) { DocData::MethodDoc md; md.name = mi.name; @@ -823,7 +823,7 @@ void DocTools::generate(bool p_basic_types) { List<Pair<String, Variant>> cinfo; lang->get_public_constants(&cinfo); - for (Pair<String, Variant> &E : cinfo) { + for (const Pair<String, Variant> &E : cinfo) { DocData::ConstantDoc cd; cd.name = E.first; cd.value = E.second; diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 5a85c8b31b..4a19f007d4 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -920,7 +920,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { List<StringName> effects; ClassDB::get_inheriters_from_class("AudioEffect", &effects); effects.sort_custom<StringName::AlphCompare>(); - for (StringName &E : effects) { + for (const StringName &E : effects) { if (!ClassDB::can_instantiate(E)) { continue; } @@ -1331,7 +1331,7 @@ EditorAudioBuses::EditorAudioBuses() { file_dialog = memnew(EditorFileDialog); List<String> ext; ResourceLoader::get_recognized_extensions_for_type("AudioBusLayout", &ext); - for (String &E : ext) { + for (const String &E : ext) { file_dialog->add_filter("*." + E + "; Audio Bus Layout"); } add_child(file_dialog); diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index e81f788290..fad76682b5 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -46,11 +46,11 @@ void EditorAutoloadSettings::_notification(int p_what) { ResourceLoader::get_recognized_extensions_for_type("Script", &afn); ResourceLoader::get_recognized_extensions_for_type("PackedScene", &afn); - for (String &E : afn) { + for (const String &E : afn) { file_dialog->add_filter("*." + E); } - for (AutoLoadInfo &info : autoload_cache) { + for (const AutoLoadInfo &info : autoload_cache) { if (info.node && info.in_editor) { get_tree()->get_root()->call_deferred(SNAME("add_child"), info.node); } @@ -101,7 +101,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin for (int i = 0; i < ScriptServer::get_language_count(); i++) { List<String> keywords; ScriptServer::get_language(i)->get_reserved_words(&keywords); - for (String &E : keywords) { + for (const String &E : keywords) { if (E == p_name) { if (r_error) { *r_error = TTR("Invalid name.") + "\n" + TTR("Keyword cannot be used as an autoload name."); @@ -378,7 +378,7 @@ void EditorAutoloadSettings::update_autoload() { Map<String, AutoLoadInfo> to_remove; List<AutoLoadInfo *> to_add; - for (AutoLoadInfo &info : autoload_cache) { + for (const AutoLoadInfo &info : autoload_cache) { to_remove.insert(info.name, info); } @@ -390,7 +390,7 @@ void EditorAutoloadSettings::update_autoload() { List<PropertyInfo> props; ProjectSettings::get_singleton()->get_property_list(&props); - for (PropertyInfo &pi : props) { + for (const PropertyInfo &pi : props) { if (!pi.name.begins_with("autoload/")) { continue; } @@ -643,7 +643,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant & int i = 0; - for (AutoLoadInfo &F : autoload_cache) { + for (const AutoLoadInfo &F : autoload_cache) { orders.write[i++] = F.order; } @@ -655,7 +655,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant & i = 0; - for (AutoLoadInfo &F : autoload_cache) { + for (const AutoLoadInfo &F : autoload_cache) { undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + F.name, orders[i++]); undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + F.name, F.order); } @@ -758,7 +758,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() { // Make first cache List<PropertyInfo> props; ProjectSettings::get_singleton()->get_property_list(&props); - for (PropertyInfo &pi : props) { + for (const PropertyInfo &pi : props) { if (!pi.name.begins_with("autoload/")) { continue; } @@ -894,7 +894,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() { } EditorAutoloadSettings::~EditorAutoloadSettings() { - for (AutoLoadInfo &info : autoload_cache) { + for (const AutoLoadInfo &info : autoload_cache) { if (info.node && !info.in_editor) { memdelete(info.node); } diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 9204974d1a..c62e5b75b2 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -299,7 +299,7 @@ void EditorData::copy_object_params(Object *p_object) { List<PropertyInfo> pinfo; p_object->get_property_list(&pinfo); - for (PropertyInfo &E : pinfo) { + for (const PropertyInfo &E : pinfo) { if (!(E.usage & PROPERTY_USAGE_EDITOR) || E.name == "script" || E.name == "scripts") { continue; } @@ -404,7 +404,7 @@ void EditorData::restore_editor_global_states() { void EditorData::paste_object_params(Object *p_object) { ERR_FAIL_NULL(p_object); undo_redo.create_action(TTR("Paste Params")); - for (PropertyData &E : clipboard) { + for (const PropertyData &E : clipboard) { String name = E.name; undo_redo.add_do_property(p_object, name, E.value); undo_redo.add_undo_property(p_object, name, p_object->get(name)); @@ -616,7 +616,7 @@ bool EditorData::check_and_update_scene(int p_idx) { //transfer selection List<Node *> new_selection; - for (Node *E : edited_scene.write[p_idx].selection) { + for (const Node *E : edited_scene.write[p_idx].selection) { NodePath p = edited_scene[p_idx].root->get_path_to(E); Node *new_node = new_scene->get_node(p); if (new_node) { @@ -964,7 +964,7 @@ void EditorData::script_class_save_icon_paths() { _script_class_icon_paths.get_key_list(&keys); Dictionary d; - for (StringName &E : keys) { + for (const StringName &E : keys) { if (ScriptServer::is_global_class(E)) { d[E] = _script_class_icon_paths[E]; } @@ -996,7 +996,7 @@ void EditorData::script_class_load_icon_paths() { List<Variant> keys; d.get_key_list(&keys); - for (Variant &E : keys) { + for (const Variant &E : keys) { String name = E.operator String(); _script_class_icon_paths[name] = d[name]; @@ -1076,7 +1076,7 @@ bool EditorSelection::is_selected(Node *p_node) const { Array EditorSelection::_get_transformable_selected_nodes() { Array ret; - for (Node *E : selected_node_list) { + for (const Node *E : selected_node_list) { ret.push_back(E); } diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index bec63fc078..b374f56f6d 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -436,7 +436,7 @@ Ref<EditorExportPreset> EditorExportPlatform::create_preset() { List<ExportOption> options; get_export_options(&options); - for (ExportOption &E : options) { + for (const ExportOption &E : options) { preset->properties.push_back(E.option); preset->values[E.option.name] = E.default_value; } @@ -679,7 +679,7 @@ EditorExportPlatform::FeatureContainers EditorExportPlatform::get_feature_contai platform->get_preset_features(p_preset, &feature_list); FeatureContainers result; - for (String &E : feature_list) { + for (const String &E : feature_list) { result.features.insert(E); result.features_pv.push_back(E); } @@ -752,7 +752,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & List<PropertyInfo> props; ProjectSettings::get_singleton()->get_property_list(&props); - for (PropertyInfo &pi : props) { + for (const PropertyInfo &pi : props) { if (!pi.name.begins_with("autoload/")) { continue; } @@ -897,7 +897,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & Set<String> remap_features; - for (String &F : remaps) { + for (const String &F : remaps) { String remap = F; String feature = remap.get_slice(".", 1); if (features.has(feature)) { @@ -911,7 +911,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & err = OK; - for (String &F : remaps) { + for (const String &F : remaps) { String remap = F; if (remap == "path") { String remapped_path = config->get_value("remap", remap); @@ -1647,7 +1647,7 @@ void EditorExport::load_config() { config->get_section_keys(option_section, &options); - for (String &E : options) { + for (const String &E : options) { Variant value = config->get_value(option_section, E); preset->set(E, value); @@ -1689,7 +1689,7 @@ void EditorExport::update_export_presets() { preset->properties.clear(); preset->values.clear(); - for (EditorExportPlatform::ExportOption &E : options) { + for (const EditorExportPlatform::ExportOption &E : options) { preset->properties.push_back(E.option); StringName option_name = E.option.name; diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 1bc852000d..22f44a54bb 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -527,7 +527,7 @@ void EditorFeatureProfileManager::_fill_classes_from(TreeItem *p_parent, const S ClassDB::get_direct_inheriters_from_class(p_class, &child_classes); child_classes.sort_custom<StringName::AlphCompare>(); - for (StringName &name : child_classes) { + for (const StringName &name : child_classes) { if (String(name).begins_with("Editor") || ClassDB::get_api_type(name) != ClassDB::API_CORE) { continue; } @@ -596,7 +596,7 @@ void EditorFeatureProfileManager::_class_list_item_selected() { TreeItem *properties = property_list->create_item(root); properties->set_text(0, TTR("Class Properties:")); - for (PropertyInfo &E : props) { + for (const PropertyInfo &E : props) { String name = E.name; if (!(E.usage & PROPERTY_USAGE_EDITOR)) { continue; diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index f11e8d350d..5ccbed1b49 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -830,7 +830,7 @@ void EditorFileDialog::update_file_list() { while (!files.is_empty()) { bool match = patterns.is_empty(); - for (String &E : patterns) { + for (const String &E : patterns) { if (files.front()->get().matchn(E)) { match = true; break; diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index d290db6431..4540f75968 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -484,7 +484,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo memdelete(md5s); //imported files are gone, reimport - for (String &E : to_check) { + for (const String &E : to_check) { if (!FileAccess::exists(E)) { return true; } @@ -524,7 +524,7 @@ bool EditorFileSystem::_update_scan_actions() { Vector<String> reimports; Vector<String> reloads; - for (ItemAction &ia : scan_actions) { + for (const ItemAction &ia : scan_actions) { switch (ia.action) { case ItemAction::ACTION_NONE: { } break; @@ -1072,7 +1072,7 @@ void EditorFileSystem::_delete_internal_files(String p_file) { List<String> paths; ResourceFormatImporter::get_singleton()->get_internal_resource_path_list(p_file, &paths); DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES); - for (String &E : paths) { + for (const String &E : paths) { da->remove(E); } da->remove(p_file + ".import"); @@ -1413,7 +1413,7 @@ Vector<String> EditorFileSystem::_get_dependencies(const String &p_path) { ResourceLoader::get_dependencies(p_path, &deps); Vector<String> ret; - for (String &E : deps) { + for (const String &E : deps) { ret.push_back(E); } @@ -1609,14 +1609,14 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector List<ResourceImporter::ImportOption> options; importer->get_import_options(&options); //set default values - for (ResourceImporter::ImportOption &E : options) { + for (const ResourceImporter::ImportOption &E : options) { source_file_options[p_files[i]][E.option.name] = E.default_value; } if (config->has_section("params")) { List<String> sk; config->get_section_keys("params", &sk); - for (String ¶m : sk) { + for (const String ¶m : sk) { Variant value = config->get_value("params", param); //override with whathever is in file source_file_options[p_files[i]][param] = value; @@ -1690,7 +1690,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector List<ResourceImporter::ImportOption> options; importer->get_import_options(&options); //set default values - for (ResourceImporter::ImportOption &F : options) { + for (const ResourceImporter::ImportOption &F : options) { String base = F.option.name; Variant v = F.default_value; if (source_file_options[file].has(base)) { @@ -1773,7 +1773,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName if (cf->has_section("params")) { List<String> sk; cf->get_section_keys("params", &sk); - for (String &E : sk) { + for (const String &E : sk) { params[E] = cf->get_value("params", E); } } @@ -1823,7 +1823,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName List<ResourceImporter::ImportOption> opts; importer->get_import_options(&opts); - for (ResourceImporter::ImportOption &E : opts) { + for (const ResourceImporter::ImportOption &E : opts) { if (!params.has(E.option.name)) { //this one is not present params[E.option.name] = E.default_value; } @@ -1835,7 +1835,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName List<Variant> v; d.get_key_list(&v); - for (Variant &E : v) { + for (const Variant &E : v) { params[E] = d[E]; } } @@ -1882,7 +1882,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName //no path } else if (import_variants.size()) { //import with variants - for (String &E : import_variants) { + for (const String &E : import_variants) { String path = base_path.c_escape() + "." + E + "." + importer->get_save_extension(); f->store_line("path." + E + "=\"" + path + "\""); @@ -1908,7 +1908,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName if (gen_files.size()) { Array genf; - for (String &E : gen_files) { + for (const String &E : gen_files) { genf.push_back(E); dest_paths.push_back(E); } @@ -1934,7 +1934,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName //store options in provided order, to avoid file changing. Order is also important because first match is accepted first. - for (ResourceImporter::ImportOption &E : opts) { + for (const ResourceImporter::ImportOption &E : opts) { String base = E.option.name; String value; VariantWriter::write_to_string(params[base], value); @@ -2171,7 +2171,7 @@ void EditorFileSystem::_move_group_files(EditorFileSystemDirectory *efd, const S List<String> sk; config->get_section_keys("params", &sk); - for (String ¶m : sk) { + for (const String ¶m : sk) { //not very clean, but should work String value = config->get_value("params", param); if (value == p_group_file) { @@ -2245,13 +2245,13 @@ void EditorFileSystem::_update_extensions() { List<String> extensionsl; ResourceLoader::get_recognized_extensions_for_type("", &extensionsl); - for (String &E : extensionsl) { + for (const String &E : extensionsl) { valid_extensions.insert(E); } extensionsl.clear(); ResourceFormatImporter::get_singleton()->get_recognized_extensions(&extensionsl); - for (String &E : extensionsl) { + for (const String &E : extensionsl) { import_extensions.insert(E); } } diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp index 7b7cf0bf48..29e3236ac2 100644 --- a/editor/editor_folding.cpp +++ b/editor/editor_folding.cpp @@ -109,7 +109,7 @@ void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p List<PropertyInfo> plist; p_node->get_property_list(&plist); - for (PropertyInfo &E : plist) { + for (const PropertyInfo &E : plist) { if (E.usage & PROPERTY_USAGE_EDITOR) { if (E.type == Variant::OBJECT) { RES res = p_node->get(E.name); @@ -228,7 +228,7 @@ void EditorFolding::_do_object_unfolds(Object *p_object, Set<RES> &resources) { Set<String> unfold_group; - for (PropertyInfo &E : plist) { + for (const PropertyInfo &E : plist) { if (E.usage & PROPERTY_USAGE_CATEGORY) { group = ""; group_base = ""; diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 934ede2304..cdbe505441 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1508,7 +1508,7 @@ String EditorInspector::get_selected_path() const { } void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Ref<EditorInspectorPlugin> ped) { - for (EditorInspectorPlugin::AddedEditor &F : ped->added_editors) { + for (const EditorInspectorPlugin::AddedEditor &F : ped->added_editors) { EditorProperty *ep = Object::cast_to<EditorProperty>(F.property_editor); current_vbox->add_child(F.property_editor); @@ -1952,7 +1952,7 @@ void EditorInspector::update_tree() { List<EditorInspectorPlugin::AddedEditor> editors = ped->added_editors; //make a copy, since plugins may be used again in a sub-inspector ped->added_editors.clear(); - for (EditorInspectorPlugin::AddedEditor &F : editors) { + for (const EditorInspectorPlugin::AddedEditor &F : editors) { EditorProperty *ep = Object::cast_to<EditorProperty>(F.property_editor); if (ep) { @@ -2391,7 +2391,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) { Variant to_create; List<PropertyInfo> pinfo; object->get_property_list(&pinfo); - for (PropertyInfo &E : pinfo) { + for (const PropertyInfo &E : pinfo) { if (E.name == p_path) { Callable::CallError ce; Variant::construct(E.type, to_create, nullptr, 0, ce); diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp index 1f70c59e66..0c8660c216 100644 --- a/editor/editor_layouts_dialog.cpp +++ b/editor/editor_layouts_dialog.cpp @@ -92,7 +92,7 @@ void EditorLayoutsDialog::_post_popup() { List<String> layouts; config.ptr()->get_sections(&layouts); - for (String &E : layouts) { + for (const String &E : layouts) { layout_names->add_item(E); } } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 5aaca0efdd..cbf8611c9a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -914,7 +914,7 @@ void EditorNode::_resources_reimported(const Vector<String> &p_resources) { } } - for (String &E : scenes) { + for (const String &E : scenes) { reload_scene(E); } @@ -1143,7 +1143,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String file->clear_filters(); List<String> preferred; - for (String &E : extensions) { + for (const String &E : extensions) { if (p_resource->is_class("Script") && (E == "tres" || E == "res")) { //this serves no purpose and confused people continue; @@ -1259,7 +1259,7 @@ void EditorNode::_get_scene_metadata(const String &p_file) { cf->get_section_keys("editor_states", &esl); Dictionary md; - for (String &E : esl) { + for (const String &E : esl) { Variant st = cf->get_value("editor_states", E); if (st.get_type() != Variant::NIL) { md[E] = st; @@ -1295,7 +1295,7 @@ void EditorNode::_set_scene_metadata(const String &p_file, int p_idx) { List<Variant> keys; md.get_key_list(&keys); - for (Variant &E : keys) { + for (const Variant &E : keys) { cf->set_value("editor_states", E, md[E]); } @@ -1334,7 +1334,7 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool> bool ret_changed = false; List<PropertyInfo> pi; obj->get_property_list(&pi); - for (PropertyInfo &E : pi) { + for (const PropertyInfo &E : pi) { if (!(E.usage & PROPERTY_USAGE_STORAGE)) { continue; } @@ -1364,7 +1364,7 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool> Dictionary d = obj->get(E.name); List<Variant> keys; d.get_key_list(&keys); - for (Variant &F : keys) { + for (const Variant &F : keys) { Variant v = d[F]; RES res = v; if (_find_and_save_resource(res, processed, flags)) { @@ -1520,7 +1520,7 @@ static bool _find_edited_resources(const Ref<Resource> &p_resource, Set<Ref<Reso p_resource->get_property_list(&plist); - for (PropertyInfo &E : plist) { + for (const PropertyInfo &E : plist) { if (E.type == Variant::OBJECT && E.usage & PROPERTY_USAGE_STORAGE && !(E.usage & PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT)) { RES res = p_resource->get(E.name); if (res.is_null()) { @@ -1883,7 +1883,7 @@ void EditorNode::_dialog_action(String p_file) { // erase List<String> keys; config->get_section_keys(p_file, &keys); - for (String &E : keys) { + for (const String &E : keys) { config->set_value(p_file, E, Variant()); } @@ -2532,7 +2532,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { Ref<MeshLibrary> ml(memnew(MeshLibrary)); ResourceSaver::get_recognized_extensions(ml, &extensions); file_export_lib->clear_filters(); - for (String &E : extensions) { + for (const String &E : extensions) { file_export_lib->add_filter("*." + E); } @@ -4054,7 +4054,7 @@ void EditorNode::_build_icon_type_cache() { List<StringName> tl; StringName ei = "EditorIcons"; theme_base->get_theme()->get_icon_list(ei, &tl); - for (StringName &E : tl) { + for (const StringName &E : tl) { if (!ClassDB::class_exists(E)) { continue; } @@ -4783,7 +4783,7 @@ void EditorNode::_update_layouts_menu() { List<String> layouts; config.ptr()->get_sections(&layouts); - for (String &layout : layouts) { + for (const String &layout : layouts) { if (layout == TTR("Default")) { editor_layouts->remove_item(editor_layouts->get_item_index(SETTINGS_LAYOUT_DEFAULT)); overridden_default_layout = editor_layouts->get_item_count(); @@ -6738,7 +6738,7 @@ EditorNode::EditorNode() { file_script->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); List<String> sexts; ResourceLoader::get_recognized_extensions_for_type("Script", &sexts); - for (String &E : sexts) { + for (const String &E : sexts) { file_script->add_filter("*." + E); } gui_base->add_child(file_script); diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp index c52861a2a2..f3b3eedccc 100644 --- a/editor/editor_path.cpp +++ b/editor/editor_path.cpp @@ -40,7 +40,7 @@ void EditorPath::_add_children_to_popup(Object *p_obj, int p_depth) { List<PropertyInfo> pinfo; p_obj->get_property_list(&pinfo); - for (PropertyInfo &E : pinfo) { + for (const PropertyInfo &E : pinfo) { if (!(E.usage & PROPERTY_USAGE_EDITOR)) { continue; } diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 967f2aa47b..7d809ea656 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -221,7 +221,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) { } Set<String> valid_extensions; - for (String &E : extensions) { + for (const String &E : extensions) { valid_extensions.insert(E); } @@ -260,7 +260,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) { List<PropertyInfo> property_list; edited_resource->get_property_list(&property_list); List<Pair<String, Variant>> propvalues; - for (PropertyInfo &pi : property_list) { + for (const PropertyInfo &pi : property_list) { Pair<String, Variant> p; if (pi.usage & PROPERTY_USAGE_STORAGE) { p.first = pi.name; @@ -275,7 +275,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) { Ref<Resource> unique_resource = Ref<Resource>(Object::cast_to<Resource>(inst)); ERR_FAIL_COND(unique_resource.is_null()); - for (Pair<String, Variant> &p : propvalues) { + for (const Pair<String, Variant> &p : propvalues) { unique_resource->set(p.first, p.second); } @@ -465,11 +465,11 @@ void EditorResourcePicker::_get_allowed_types(bool p_with_convert, Set<String> * List<StringName> inheriters; ClassDB::get_inheriters_from_class(base, &inheriters); - for (StringName &E : inheriters) { + for (const StringName &E : inheriters) { p_vector->insert(E); } - for (StringName &E : global_classes) { + for (const StringName &E : global_classes) { if (EditorNode::get_editor_data().script_class_is_parent(E, base)) { p_vector->insert(E); } diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp index b446f922f6..4fadbf5922 100644 --- a/editor/editor_run.cpp +++ b/editor/editor_run.cpp @@ -228,7 +228,7 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L } printf("Running: %s", exec.utf8().get_data()); - for (String &E : args) { + for (const String &E : args) { printf(" %s", E.utf8().get_data()); }; printf("\n"); @@ -267,7 +267,7 @@ void EditorRun::stop_child_process(OS::ProcessID p_pid) { void EditorRun::stop() { if (status != STATUS_STOP && pids.size() > 0) { - for (OS::ProcessID &E : pids) { + for (const OS::ProcessID &E : pids) { OS::get_singleton()->kill(E); } } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 4616861982..a52b14643e 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -759,7 +759,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { List<String> keys; p_extra_config->get_section_keys("presets", &keys); - for (String &key : keys) { + for (const String &key : keys) { Variant val = p_extra_config->get_value("presets", key); set(key, val); } @@ -1013,7 +1013,7 @@ void EditorSettings::setup_network() { String selected = "127.0.0.1"; // Check that current remote_host is a valid interface address and populate hints. - for (IPAddress &ip : local_ip) { + for (const IPAddress &ip : local_ip) { // link-local IPv6 addresses don't work, skipping them if (String(ip).begins_with("fe80:0:0:0:")) { // fe80::/64 continue; @@ -1299,7 +1299,7 @@ void EditorSettings::list_text_editor_themes() { memdelete(d); custom_themes.sort(); - for (String &E : custom_themes) { + for (const String &E : custom_themes) { themes += "," + E; } } @@ -1328,7 +1328,7 @@ void EditorSettings::load_text_editor_theme() { List<String> keys; cf->get_section_keys("color_theme", &keys); - for (String &key : keys) { + for (const String &key : keys) { String val = cf->get_value("color_theme", key); // don't load if it's not already there! diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 225eac36a5..dbbbb03864 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -135,7 +135,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory _sort_file_info_list(file_list); // Build the tree. - for (FileInfo &fi : file_list) { + for (const FileInfo &fi : file_list) { TreeItem *file_item = tree->create_item(subdirectory_item); file_item->set_text(0, fi.name); file_item->set_structured_text_bidi_override(0, STRUCTURED_TEXT_FILE); @@ -964,7 +964,7 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit List<String> importer_exts; ResourceImporterScene::get_singleton()->get_recognized_extensions(&importer_exts); String extension = fpath.get_extension(); - for (String &E : importer_exts) { + for (const String &E : importer_exts) { if (extension.nocasecmp_to(E) == 0) { is_imported = true; break; @@ -1413,7 +1413,7 @@ void FileSystemDock::_make_scene_confirm() { ResourceSaver::get_recognized_extensions(sd, &extensions); bool extension_correct = false; - for (String &E : extensions) { + for (const String &E : extensions) { if (E == extension) { extension_correct = true; break; diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index deedbe104c..113306fc8a 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -285,7 +285,7 @@ void GroupDialog::_load_groups(Node *p_current) { List<Node::GroupInfo> gi; p_current->get_groups(&gi); - for (Node::GroupInfo &E : gi) { + for (const Node::GroupInfo &E : gi) { if (!E.persistent) { continue; } @@ -627,7 +627,7 @@ void GroupsEditor::update_tree() { TreeItem *root = tree->create_item(); - for (GroupInfo &gi : groups) { + for (const GroupInfo &gi : groups) { if (!gi.persistent) { continue; } diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index d67950ec9e..e9160f0414 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -312,7 +312,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<E List<StringName> anims; ap->get_animation_list(&anims); - for (StringName &E : anims) { + for (const StringName &E : anims) { Ref<Animation> anim = ap->get_animation(E); ERR_CONTINUE(anim.is_null()); for (int i = 0; i < anim->get_track_count(); i++) { @@ -659,7 +659,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref< } int idx = 0; - for (Ref<Shape3D> &E : shapes) { + for (const Ref<Shape3D> &E : shapes) { CollisionShape3D *cshape = memnew(CollisionShape3D); cshape->set_shape(E); base->add_child(cshape); @@ -712,7 +712,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref< //fill node settings for this node with default values List<ImportOption> iopts; get_internal_import_options(INTERNAL_IMPORT_CATEGORY_ANIMATION_NODE, &iopts); - for (ImportOption &E : iopts) { + for (const ImportOption &E : iopts) { if (!node_settings.has(E.option.name)) { node_settings[E.option.name] = E.default_value; } @@ -756,7 +756,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref< } else { List<StringName> anims; ap->get_animation_list(&anims); - for (StringName &name : anims) { + for (const StringName &name : anims) { Ref<Animation> anim = ap->get_animation(name); if (p_animation_data.has(name)) { Dictionary anim_settings = p_animation_data[name]; @@ -764,7 +764,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref< //fill with default values List<ImportOption> iopts; get_internal_import_options(INTERNAL_IMPORT_CATEGORY_ANIMATION, &iopts); - for (ImportOption &F : iopts) { + for (const ImportOption &F : iopts) { if (!anim_settings.has(F.option.name)) { anim_settings[F.option.name] = F.default_value; } @@ -935,7 +935,7 @@ void ResourceImporterScene::_create_clips(AnimationPlayer *anim, const Array &p_ void ResourceImporterScene::_optimize_animations(AnimationPlayer *anim, float p_max_lin_error, float p_max_ang_error, float p_max_angle) { List<StringName> anim_names; anim->get_animation_list(&anim_names); - for (StringName &E : anim_names) { + for (const StringName &E : anim_names) { Ref<Animation> a = anim->get_animation(E); a->optimize(p_max_lin_error, p_max_ang_error, Math::deg2rad(p_max_angle)); } @@ -1045,7 +1045,7 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in String script_ext_hint; - for (String &E : script_extentions) { + for (const String &E : script_extentions) { if (script_ext_hint != "") { script_ext_hint += ","; } @@ -1088,7 +1088,7 @@ Node *ResourceImporterScene::import_scene_from_other_importer(EditorSceneImporte List<String> extensions; E->get()->get_extensions(&extensions); - for (String &F : extensions) { + for (const String &F : extensions) { if (F.to_lower() == ext) { importer = E; break; @@ -1118,7 +1118,7 @@ Ref<Animation> ResourceImporterScene::import_animation_from_other_importer(Edito List<String> extensions; E->get()->get_extensions(&extensions); - for (String &F : extensions) { + for (const String &F : extensions) { if (F.to_lower() == ext) { importer = E; break; diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index ad271eaf04..19a8f209bb 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -305,7 +305,7 @@ void SceneImportSettings::_fill_scene(Node *p_node, TreeItem *p_parent_item) { if (anim_node) { List<StringName> animations; anim_node->get_animation_list(&animations); - for (StringName &E : animations) { + for (const StringName &E : animations) { _fill_animation(scene_tree, anim_node->get_animation(E), E, item); } } @@ -394,7 +394,7 @@ void SceneImportSettings::_load_default_subresource_settings(Map<StringName, Var d = d[p_import_id]; List<ResourceImporterScene::ImportOption> options; ResourceImporterScene::get_singleton()->get_internal_import_options(p_category, &options); - for (ResourceImporterScene::ImportOption &E : options) { + for (const ResourceImporterScene::ImportOption &E : options) { String key = E.option.name; if (d.has(key)) { settings[key] = d[key]; @@ -440,7 +440,7 @@ void SceneImportSettings::open_settings(const String &p_path) { if (err == OK) { List<String> keys; config->get_section_keys("params", &keys); - for (String &E : keys) { + for (const String &E : keys) { Variant value = config->get_value("params", E); if (E == "_subresources") { base_subresource_settings = value; @@ -605,7 +605,7 @@ void SceneImportSettings::_select(Tree *p_from, String p_type, String p_id) { scene_import_settings_data->defaults.clear(); scene_import_settings_data->current.clear(); - for (ResourceImporter::ImportOption &E : options) { + for (const ResourceImporter::ImportOption &E : options) { scene_import_settings_data->defaults[E.option.name] = E.default_value; //needed for visibility toggling (fails if something is missing) if (scene_import_settings_data->settings->has(E.option.name)) { diff --git a/editor/import/scene_importer_mesh.cpp b/editor/import/scene_importer_mesh.cpp index 5b8f7015fe..0d14347225 100644 --- a/editor/import/scene_importer_mesh.cpp +++ b/editor/import/scene_importer_mesh.cpp @@ -79,7 +79,7 @@ void EditorSceneImporterMesh::add_surface(Mesh::PrimitiveType p_primitive, const List<Variant> lods; p_lods.get_key_list(&lods); - for (Variant &E : lods) { + for (const Variant &E : lods) { ERR_CONTINUE(!E.is_num()); Surface::LOD lod; lod.distance = E; diff --git a/editor/import_defaults_editor.cpp b/editor/import_defaults_editor.cpp index 0b12f86882..7c06ef4516 100644 --- a/editor/import_defaults_editor.cpp +++ b/editor/import_defaults_editor.cpp @@ -125,7 +125,7 @@ void ImportDefaultsEditor::_update_importer() { d = ProjectSettings::get_singleton()->get("importer_defaults/" + importer->get_importer_name()); } - for (ResourceImporter::ImportOption &E : options) { + for (const ResourceImporter::ImportOption &E : options) { settings->properties.push_back(E.option); if (d.has(E.option.name)) { settings->values[E.option.name] = d[E.option.name]; diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 3927832eb9..1f8fefbe6e 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -119,7 +119,7 @@ void ImportDock::set_edit_path(const String &p_path) { import_as->clear(); - for (Pair<String, String> &E : importer_names) { + for (const Pair<String, String> &E : importer_names) { import_as->add_item(E.first); import_as->set_item_metadata(import_as->get_item_count() - 1, E.second); if (E.second == importer_name) { @@ -153,7 +153,7 @@ void ImportDock::_update_options(const Ref<ConfigFile> &p_config) { params->checking = params->paths.size() > 1; params->checked.clear(); - for (ResourceImporter::ImportOption &E : options) { + for (const ResourceImporter::ImportOption &E : options) { params->properties.push_back(E.option); if (p_config.is_valid() && p_config->has_section_key("params", E.option.name)) { params->values[E.option.name] = p_config->get_value("params", E.option.name); @@ -201,7 +201,7 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) { List<String> keys; config->get_section_keys("params", &keys); - for (String &E : keys) { + for (const String &E : keys) { if (!value_frequency.has(E)) { value_frequency[E] = Dictionary(); } @@ -226,7 +226,7 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) { params->checking = true; params->checked.clear(); - for (ResourceImporter::ImportOption &E : options) { + for (const ResourceImporter::ImportOption &E : options) { params->properties.push_back(E.option); if (value_frequency.has(E.option.name)) { @@ -235,7 +235,7 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) { List<Variant> v; d.get_key_list(&v); Variant value; - for (Variant &F : v) { + for (const Variant &F : v) { int f = d[F]; if (f > freq) { value = F; @@ -262,7 +262,7 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) { import_as->clear(); - for (Pair<String, String> &E : importer_names) { + for (const Pair<String, String> &E : importer_names) { import_as->add_item(E.first); import_as->set_item_metadata(import_as->get_item_count() - 1, E.second); if (E.second == params->importer->get_importer_name()) { @@ -363,7 +363,7 @@ void ImportDock::_preset_selected(int p_idx) { if (params->checking) { params->checked.clear(); } - for (Variant &E : v) { + for (const Variant &E : v) { params->values[E] = d[E]; if (params->checking) { params->checked.insert(E); @@ -384,7 +384,7 @@ void ImportDock::_preset_selected(int p_idx) { if (params->checking) { params->checked.clear(); } - for (ResourceImporter::ImportOption &E : options) { + for (const ResourceImporter::ImportOption &E : options) { params->values[E.option.name] = E.default_value; if (params->checking) { params->checked.insert(E.option.name); @@ -486,7 +486,7 @@ void ImportDock::_reimport() { if (params->checking && config->get_value("remap", "importer") == params->importer->get_importer_name()) { //update only what is edited (checkboxes) if the importer is the same - for (PropertyInfo &E : params->properties) { + for (const PropertyInfo &E : params->properties) { if (params->checked.has(E.name)) { config->set_value("params", E.name, params->values[E.name]); } @@ -498,7 +498,7 @@ void ImportDock::_reimport() { config->erase_section("params"); } - for (PropertyInfo &E : params->properties) { + for (const PropertyInfo &E : params->properties) { config->set_value("params", E.name, params->values[E.name]); } } diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index b1c601a41c..1973494a2a 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -87,7 +87,7 @@ void InspectorDock::_menu_option(int p_option) { List<PropertyInfo> props; current->get_property_list(&props); Map<RES, RES> duplicates; - for (PropertyInfo &E : props) { + for (const PropertyInfo &E : props) { if (!(E.usage & PROPERTY_USAGE_STORAGE)) { continue; } diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp index d4b712b6a3..b32ea67d4d 100644 --- a/editor/localization_editor.cpp +++ b/editor/localization_editor.cpp @@ -43,13 +43,13 @@ void LocalizationEditor::_notification(int p_what) { List<String> tfn; ResourceLoader::get_recognized_extensions_for_type("Translation", &tfn); - for (String &E : tfn) { + for (const String &E : tfn) { translation_file_open->add_filter("*." + E); } List<String> rfn; ResourceLoader::get_recognized_extensions_for_type("Resource", &rfn); - for (String &E : rfn) { + for (const String &E : rfn) { translation_res_file_open_dialog->add_filter("*." + E); translation_res_option_file_open_dialog->add_filter("*." + E); } @@ -430,7 +430,7 @@ void LocalizationEditor::_update_pot_file_extensions() { pot_file_open_dialog->clear_filters(); List<String> translation_parse_file_extensions; EditorTranslationParser::get_singleton()->get_recognized_extensions(&translation_parse_file_extensions); - for (String &E : translation_parse_file_extensions) { + for (const String &E : translation_parse_file_extensions) { pot_file_open_dialog->add_filter("*." + E); } } @@ -560,7 +560,7 @@ void LocalizationEditor::update_translations() { List<Variant> rk; remaps.get_key_list(&rk); Vector<String> keys; - for (Variant &E : rk) { + for (const Variant &E : rk) { keys.push_back(E); } keys.sort(); diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp index 910b242c41..fd4a4334fc 100644 --- a/editor/multi_node_edit.cpp +++ b/editor/multi_node_edit.cpp @@ -143,7 +143,7 @@ void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const { List<PropertyInfo> plist; n->get_property_list(&plist, true); - for (PropertyInfo &F : plist) { + for (const PropertyInfo &F : plist) { if (F.name == "script") { continue; //added later manually, since this is intercepted before being set (check Variant Object::get() ) } @@ -164,7 +164,7 @@ void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const { nc++; } - for (PLData *E : data_list) { + for (const PLData *E : data_list) { if (nc == E->uses) { p_list->push_back(E->info); } diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index ab11680e2f..ad2d9866fa 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -72,14 +72,14 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven List<StringName> names; ap->get_animation_list(&names); - for (StringName &E : names) { + for (const StringName &E : names) { animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E); animations_to_add.push_back(E); } } } - for (StringName &E : classes) { + for (const StringName &E : classes) { String name = String(E).replace_first("AnimationNode", ""); if (name == "Animation") { continue; @@ -373,7 +373,7 @@ void AnimationNodeBlendSpace1DEditor::_add_menu_type(int p_index) { open_file->clear_filters(); List<String> filters; ResourceLoader::get_recognized_extensions_for_type("AnimationRootNode", &filters); - for (String &E : filters) { + for (const String &E : filters) { open_file->add_filter("*." + E); } open_file->popup_file_dialog(); diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 3fb90eb4ff..49fcac512b 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -96,14 +96,14 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven if (ap) { List<StringName> names; ap->get_animation_list(&names); - for (StringName &E : names) { + for (const StringName &E : names) { animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E); animations_to_add.push_back(E); } } } - for (StringName &E : classes) { + for (const StringName &E : classes) { String name = String(E).replace_first("AnimationNode", ""); if (name == "Animation") { continue; // nope @@ -295,7 +295,7 @@ void AnimationNodeBlendSpace2DEditor::_add_menu_type(int p_index) { open_file->clear_filters(); List<String> filters; ResourceLoader::get_recognized_extensions_for_type("AnimationRootNode", &filters); - for (String &E : filters) { + for (const String &E : filters) { open_file->add_filter("*." + E); } open_file->popup_file_dialog(); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 705a1d0fc0..c94014944c 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -121,7 +121,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { List<StringName> nodes; blend_tree->get_node_list(&nodes); - for (StringName &E : nodes) { + for (const StringName &E : nodes) { GraphNode *node = memnew(GraphNode); graph->add_child(node); @@ -155,7 +155,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { List<PropertyInfo> pinfo; agnode->get_parameter_list(&pinfo); - for (PropertyInfo &F : pinfo) { + for (const PropertyInfo &F : pinfo) { if (!(F.usage & PROPERTY_USAGE_EDITOR)) { continue; } @@ -212,7 +212,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { List<StringName> anims; ap->get_animation_list(&anims); - for (StringName &F : anims) { + for (const StringName &F : anims) { mb->get_popup()->add_item(F); options.push_back(F); } @@ -246,7 +246,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { List<AnimationNodeBlendTree::NodeConnection> connections; blend_tree->get_node_connections(&connections); - for (AnimationNodeBlendTree::NodeConnection &E : connections) { + for (const AnimationNodeBlendTree::NodeConnection &E : connections) { StringName from = E.output_node; StringName to = E.input_node; int to_idx = E.input_index; @@ -274,7 +274,7 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) { open_file->clear_filters(); List<String> filters; ResourceLoader::get_recognized_extensions_for_type("AnimationNode", &filters); - for (String &E : filters) { + for (const String &E : filters) { open_file->add_filter("*." + E); } open_file->popup_file_dialog(); @@ -394,7 +394,7 @@ void AnimationNodeBlendTreeEditor::_delete_request(const String &p_which) { List<AnimationNodeBlendTree::NodeConnection> conns; blend_tree->get_node_connections(&conns); - for (AnimationNodeBlendTree::NodeConnection &E : conns) { + for (const AnimationNodeBlendTree::NodeConnection &E : conns) { if (E.output_node == p_which || E.input_node == p_which) { undo_redo->add_undo_method(blend_tree.ptr(), "connect_node", E.input_node, E.input_index, E.output_node); } @@ -423,7 +423,7 @@ void AnimationNodeBlendTreeEditor::_delete_nodes_request() { undo_redo->create_action(TTR("Delete Node(s)")); - for (StringName &F : to_erase) { + for (const StringName &F : to_erase) { _delete_request(F); } @@ -517,7 +517,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano List<StringName> animations; player->get_animation_list(&animations); - for (StringName &E : animations) { + for (const StringName &E : animations) { Ref<Animation> anim = player->get_animation(E); for (int i = 0; i < anim->get_track_count(); i++) { String track_path = anim->track_get_path(i); @@ -718,7 +718,7 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) { List<AnimationNodeBlendTree::NodeConnection> conns; blend_tree->get_node_connections(&conns); - for (AnimationNodeBlendTree::NodeConnection &E : conns) { + for (const AnimationNodeBlendTree::NodeConnection &E : conns) { float activity = 0; StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + E.input_node; if (AnimationTreeEditor::get_singleton()->get_tree() && !AnimationTreeEditor::get_singleton()->get_tree()->is_state_invalid()) { @@ -828,7 +828,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima List<AnimationNodeBlendTree::NodeConnection> connections; blend_tree->get_node_connections(&connections); - for (AnimationNodeBlendTree::NodeConnection &E : connections) { + for (const AnimationNodeBlendTree::NodeConnection &E : connections) { StringName from = E.output_node; StringName to = E.input_node; int to_idx = E.input_index; diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 1bdbc2980c..4ba9147955 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -350,7 +350,7 @@ void AnimationPlayerEditor::_animation_load() { List<String> extensions; ResourceLoader::get_recognized_extensions_for_type("Animation", &extensions); - for (String &E : extensions) { + for (const String &E : extensions) { file->add_filter("*." + E + " ; " + E.to_upper()); } @@ -584,7 +584,7 @@ void AnimationPlayerEditor::_animation_blend() { blend_editor.next->clear(); blend_editor.next->add_item("", i); - for (StringName &to : anims) { + for (const StringName &to : anims) { TreeItem *blend = blend_editor.tree->create_item(root); blend->set_editable(0, false); blend->set_editable(1, true); @@ -829,7 +829,7 @@ void AnimationPlayerEditor::_update_player() { } int active_idx = -1; - for (StringName &E : animlist) { + for (const StringName &E : animlist) { Ref<Texture2D> icon; if (E == player->get_autoplay()) { if (E == "RESET") { @@ -965,7 +965,7 @@ void AnimationPlayerEditor::_animation_duplicate() { Ref<Animation> new_anim = memnew(Animation); List<PropertyInfo> plist; anim->get_property_list(&plist); - for (PropertyInfo &E : plist) { + for (const PropertyInfo &E : plist) { if (E.usage & PROPERTY_USAGE_STORAGE) { new_anim->set(E.name, anim->get(E.name)); } diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index bee6af3cbb..a1f96f21bf 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -93,14 +93,14 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv if (ap) { List<StringName> names; ap->get_animation_list(&names); - for (StringName &E : names) { + for (const StringName &E : names) { animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E); animations_to_add.push_back(E); } } } - for (StringName &E : classes) { + for (const StringName &E : classes) { String name = String(E).replace_first("AnimationNode", ""); if (name == "Animation") { continue; // nope @@ -318,7 +318,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv float best_d_x = 1e20; float best_d_y = 1e20; - for (StringName &E : nodes) { + for (const StringName &E : nodes) { if (E == selected_node) { continue; } @@ -409,7 +409,7 @@ void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) { open_file->clear_filters(); List<String> filters; ResourceLoader::get_recognized_extensions_for_type("AnimationRootNode", &filters); - for (String &E : filters) { + for (const String &E : filters) { open_file->add_filter("*." + E); } open_file->popup_file_dialog(); @@ -606,7 +606,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() { } //pre pass nodes so we know the rectangles - for (StringName &E : nodes) { + for (const StringName &E : nodes) { Ref<AnimationNode> anode = state_machine->get_node(E); String name = E; bool needs_editor = EditorNode::get_singleton()->item_has_editor(anode.ptr()); diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 67d5600a3c..cd84be0c25 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -215,7 +215,7 @@ Vector<String> AnimationTreeEditor::get_animation_list() { List<StringName> anims; ap->get_animation_list(&anims); Vector<String> ret; - for (StringName &E : anims) { + for (const StringName &E : anims) { ret.push_back(E); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 8b9e76b402..869a582d96 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -399,7 +399,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig if ((is_snap_active && snap_other_nodes && (p_modes & SNAP_OTHER_NODES)) || (p_forced_modes & SNAP_OTHER_NODES)) { Transform2D to_snap_transform = Transform2D(); List<const CanvasItem *> exceptions = List<const CanvasItem *>(); - for (CanvasItem *E : p_other_nodes_exceptions) { + for (const CanvasItem *E : p_other_nodes_exceptions) { exceptions.push_back(E); } if (p_self_canvas_item) { @@ -842,7 +842,7 @@ void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_ite undo_redo->add_do_method(canvas_item, "_edit_set_state", canvas_item->_edit_get_state()); undo_redo->add_undo_method(canvas_item, "_edit_set_state", se->undo_state); if (commit_bones) { - for (Dictionary &F : se->pre_drag_bones_undo_state) { + for (const Dictionary &F : se->pre_drag_bones_undo_state) { canvas_item = Object::cast_to<CanvasItem>(canvas_item->get_parent()); undo_redo->add_do_method(canvas_item, "_edit_set_state", canvas_item->_edit_get_state()); undo_redo->add_undo_method(canvas_item, "_edit_set_state", F); @@ -3555,7 +3555,7 @@ void CanvasItemEditor::_draw_hover() { Point2 pos = transform.xform(hovering_results[i].position) - Point2(0, item_size.y) + (Point2(node_icon->get_size().x, -node_icon->get_size().y) / 4); // Rectify the position to avoid overlapping items - for (Rect2 &E : previous_rects) { + for (const Rect2 &E : previous_rects) { if (E.intersects(Rect2(pos, item_size))) { pos.y = E.get_position().y - item_size.y; } @@ -4699,7 +4699,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { } undo_redo->create_action(TTR("Paste Pose")); - for (PoseClipboard &E : pose_clipboard) { + for (const PoseClipboard &E : pose_clipboard) { Node2D *n2d = Object::cast_to<Node2D>(ObjectDB::get_instance(E.id)); if (!n2d) { continue; diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 7e0eb89359..6f246c1661 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -253,7 +253,7 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) { file = memnew(EditorFileDialog); List<String> ext; ImageLoader::get_recognized_extensions(&ext); - for (String &E : ext) { + for (const String &E : ext) { file->add_filter("*." + E + "; " + E.to_upper()); } file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 19204e3bf8..81c340e9a4 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -490,7 +490,7 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size Set<String> control_flow_keywords; Set<String> keywords; - for (String &E : kwors) { + for (const String &E : kwors) { if (scr->get_language()->is_control_flow_keyword(E)) { control_flow_keywords.insert(E); } else { diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp index 4412d51077..5184e837ce 100644 --- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp @@ -361,7 +361,7 @@ GPUParticles2DEditorPlugin::GPUParticles2DEditorPlugin(EditorNode *p_node) { file = memnew(EditorFileDialog); List<String> ext; ImageLoader::get_recognized_extensions(&ext); - for (String &E : ext) { + for (const String &E : ext) { file->add_filter("*." + E + "; " + E.to_upper()); } file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 32d5865d0b..94966d4fe6 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -265,7 +265,7 @@ Ref<Resource> StandardMaterial3DConversionPlugin::convert(const Ref<Resource> &p List<PropertyInfo> params; RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms); - for (PropertyInfo &E : params) { + for (const PropertyInfo &E : params) { // Texture parameter has to be treated specially since StandardMaterial3D saved it // as RID but ShaderMaterial needs Texture itself Ref<Texture2D> texture = mat->get_texture_by_name(E.name); @@ -309,7 +309,7 @@ Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_ List<PropertyInfo> params; RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms); - for (PropertyInfo &E : params) { + for (const PropertyInfo &E : params) { Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name); smat->set_shader_param(E.name, value); } @@ -346,7 +346,7 @@ Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p List<PropertyInfo> params; RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms); - for (PropertyInfo &E : params) { + for (const PropertyInfo &E : params) { Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name); smat->set_shader_param(E.name, value); } @@ -383,7 +383,7 @@ Ref<Resource> ProceduralSkyMaterialConversionPlugin::convert(const Ref<Resource> List<PropertyInfo> params; RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms); - for (PropertyInfo &E : params) { + for (const PropertyInfo &E : params) { Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name); smat->set_shader_param(E.name, value); } @@ -420,7 +420,7 @@ Ref<Resource> PanoramaSkyMaterialConversionPlugin::convert(const Ref<Resource> & List<PropertyInfo> params; RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms); - for (PropertyInfo &E : params) { + for (const PropertyInfo &E : params) { Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name); smat->set_shader_param(E.name, value); } @@ -457,7 +457,7 @@ Ref<Resource> PhysicalSkyMaterialConversionPlugin::convert(const Ref<Resource> & List<PropertyInfo> params; RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms); - for (PropertyInfo &E : params) { + for (const PropertyInfo &E : params) { Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name); smat->set_shader_param(E.name, value); } diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index 393aaff207..2138f943da 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -4746,7 +4746,7 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Vector3 *tw = tmeshfaces.ptrw(); int tidx = 0; - for (Face3 &f : faces) { + for (const Face3 &f : faces) { for (int j = 0; j < 3; j++) { tw[tidx++] = f.vertex[j]; _EdgeKey ek; diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index 0cb5a2e1e4..cbea2405b8 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -181,13 +181,13 @@ void ResourcePreloaderEditor::_update_library() { preloader->get_resource_list(&rnames); List<String> names; - for (StringName &E : rnames) { + for (const StringName &E : rnames) { names.push_back(E); } names.sort(); - for (String &E : names) { + for (const String &E : names) { TreeItem *ti = tree->create_item(root); ti->set_cell_mode(0, TreeItem::CELL_MODE_STRING); ti->set_editable(0, true); diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index 95e23d0c57..ed91f174d1 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -70,7 +70,7 @@ void EditorPropertyRootMotion::_node_assign() { List<StringName> animations; player->get_animation_list(&animations); - for (StringName &E : animations) { + for (const StringName &E : animations) { Ref<Animation> anim = player->get_animation(E); for (int i = 0; i < anim->get_track_count(); i++) { paths.insert(anim->track_get_path(i)); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index ab783c87e9..668a15da37 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -103,7 +103,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { const Color type_color = EDITOR_GET("text_editor/highlighting/engine_type_color"); List<StringName> types; ClassDB::get_class_list(&types); - for (StringName &E : types) { + for (const StringName &E : types) { String n = E; if (n.begins_with("_")) { n = n.substr(1, n.length()); @@ -115,7 +115,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { const Color usertype_color = EDITOR_GET("text_editor/highlighting/user_type_color"); List<StringName> global_classes; ScriptServer::get_global_class_list(&global_classes); - for (StringName &E : global_classes) { + for (const StringName &E : global_classes) { highlighter->add_keyword_color(E, usertype_color); } @@ -134,7 +134,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { const Color basetype_color = EDITOR_GET("text_editor/highlighting/base_type_color"); List<String> core_types; script->get_language()->get_core_type_words(&core_types); - for (String &E : core_types) { + for (const String &E : core_types) { highlighter->add_keyword_color(E, basetype_color); } @@ -143,7 +143,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color"); List<String> keywords; script->get_language()->get_reserved_words(&keywords); - for (String &E : keywords) { + for (const String &E : keywords) { if (script->get_language()->is_control_flow_keyword(E)) { highlighter->add_keyword_color(E, control_flow_keyword_color); } else { @@ -157,7 +157,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { if (instance_base != StringName()) { List<PropertyInfo> plist; ClassDB::get_property_list(instance_base, &plist); - for (PropertyInfo &E : plist) { + for (const PropertyInfo &E : plist) { String name = E.name; if (E.usage & PROPERTY_USAGE_CATEGORY || E.usage & PROPERTY_USAGE_GROUP || E.usage & PROPERTY_USAGE_SUBGROUP) { continue; @@ -170,7 +170,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { List<String> clist; ClassDB::get_integer_constant_list(instance_base, &clist); - for (String &E : clist) { + for (const String &E : clist) { highlighter->add_member_keyword_color(E, member_variable_color); } } @@ -179,7 +179,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { const Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color"); List<String> comments; script->get_language()->get_comment_delimiters(&comments); - for (String &comment : comments) { + for (const String &comment : comments) { String beg = comment.get_slice(" ", 0); String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String(); highlighter->add_color_region(beg, end, comment_color, end == ""); @@ -189,7 +189,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { const Color string_color = EDITOR_GET("text_editor/highlighting/string_color"); List<String> strings; script->get_language()->get_string_delimiters(&strings); - for (String &string : strings) { + for (const String &string : strings) { String beg = string.get_slice(" ", 0); String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String(); highlighter->add_color_region(beg, end, string_color, end == ""); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index f9a0f307c3..65459d159d 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -50,7 +50,7 @@ void ConnectionInfoDialog::popup_connections(String p_method, Vector<Node *> p_n List<Connection> all_connections; p_nodes[i]->get_signals_connected_to_this(&all_connections); - for (Connection &connection : all_connections) { + for (const Connection &connection : all_connections) { if (connection.callable.get_method() != p_method) { continue; } @@ -114,7 +114,7 @@ Vector<String> ScriptTextEditor::get_functions() { if (script->get_language()->validate(text, script->get_path(), &fnc)) { //if valid rewrite functions to latest functions.clear(); - for (String &E : fnc) { + for (const String &E : fnc) { functions.push_back(E); } } @@ -201,7 +201,7 @@ void ScriptTextEditor::_set_theme_for_script() { List<String> strings; script->get_language()->get_string_delimiters(&strings); text_edit->clear_string_delimiters(); - for (String &string : strings) { + for (const String &string : strings) { String beg = string.get_slice(" ", 0); String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String(); text_edit->add_string_delimiter(beg, end, end == ""); @@ -210,7 +210,7 @@ void ScriptTextEditor::_set_theme_for_script() { List<String> comments; script->get_language()->get_comment_delimiters(&comments); text_edit->clear_comment_delimiters(); - for (String &comment : comments) { + for (const String &comment : comments) { String beg = comment.get_slice(" ", 0); String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String(); text_edit->add_comment_delimiter(beg, end, end == ""); @@ -413,7 +413,7 @@ void ScriptTextEditor::_validate_script() { } functions.clear(); - for (String &E : fnc) { + for (const String &E : fnc) { functions.push_back(E); } script_is_valid = true; @@ -428,7 +428,7 @@ void ScriptTextEditor::_validate_script() { Node *base = get_tree()->get_edited_scene_root(); if (base && missing_connections.size() > 0) { warnings_panel->push_table(1); - for (Connection &connection : missing_connections) { + for (const Connection &connection : missing_connections) { String base_path = base->get_name(); String source_path = base == connection.signal.get_object() ? base_path : base_path + "/" + base->get_path_to(Object::cast_to<Node>(connection.signal.get_object())); String target_path = base == connection.callable.get_object() ? base_path : base_path + "/" + base->get_path_to(Object::cast_to<Node>(connection.callable.get_object())); @@ -450,7 +450,7 @@ void ScriptTextEditor::_validate_script() { // Add script warnings. warnings_panel->push_table(3); - for (ScriptLanguage::Warning &w : warnings) { + for (const ScriptLanguage::Warning &w : warnings) { Dictionary ignore_meta; ignore_meta["line"] = w.start_line; ignore_meta["code"] = w.string_code.to_lower(); @@ -480,7 +480,7 @@ void ScriptTextEditor::_validate_script() { errors_panel->clear(); errors_panel->push_table(2); - for (ScriptLanguage::ScriptError &err : errors) { + for (const ScriptLanguage::ScriptError &err : errors) { errors_panel->push_cell(); errors_panel->push_meta(err.line - 1); errors_panel->push_color(warnings_panel->get_theme_color(SNAME("error_color"), SNAME("Editor"))); @@ -501,7 +501,7 @@ void ScriptTextEditor::_validate_script() { if (errors.is_empty()) { te->set_line_background_color(i, Color(0, 0, 0, 0)); } else { - for (ScriptLanguage::ScriptError &E : errors) { + for (const ScriptLanguage::ScriptError &E : errors) { bool error_line = i == E.line - 1; te->set_line_background_color(i, error_line ? marked_line_color : Color(0, 0, 0, 0)); if (error_line) { @@ -900,7 +900,7 @@ void ScriptTextEditor::_update_connected_methods() { List<Connection> connections; nodes[i]->get_signals_connected_to_this(&connections); - for (Connection &connection : connections) { + for (const Connection &connection : connections) { if (!(connection.flags & CONNECT_PERSIST)) { continue; } @@ -1275,7 +1275,7 @@ void ScriptTextEditor::_edit_option_toggle_inline_comment() { List<String> comment_delimiters; script->get_language()->get_comment_delimiters(&comment_delimiters); - for (String &script_delimiter : comment_delimiters) { + for (const String &script_delimiter : comment_delimiters) { if (script_delimiter.find(" ") == -1) { delimiter = script_delimiter; break; diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 137c61e767..2c45b96106 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -118,7 +118,7 @@ void ShaderTextEditor::_load_theme_settings() { const Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color"); const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color"); - for (String &E : keywords) { + for (const String &E : keywords) { if (ShaderLanguage::is_control_flow_keyword(E)) { syntax_highlighter->add_keyword_color(E, control_flow_keyword_color); } else { @@ -144,7 +144,7 @@ void ShaderTextEditor::_load_theme_settings() { const Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color"); - for (String &E : built_ins) { + for (const String &E : built_ins) { syntax_highlighter->add_keyword_color(E, member_variable_color); } diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 486a40a4fd..a5d0ebbc12 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -788,7 +788,7 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) { anim_names.sort_custom<StringName::AlphCompare>(); - for (StringName &E : anim_names) { + for (const StringName &E : anim_names) { String name = E; TreeItem *it = animations->create_item(anim_root); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 34227ee894..b277f2ab42 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -144,7 +144,7 @@ void TextureRegionEditor::_region_draw() { } } } else if (snap_mode == SNAP_AUTOSLICE) { - for (Rect2 &r : autoslice_cache) { + for (const Rect2 &r : autoslice_cache) { Vector2 endpoints[4] = { mtx.basis_xform(r.position), mtx.basis_xform(r.position + Vector2(r.size.x, 0)), @@ -327,7 +327,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) { } if (edited_margin < 0 && snap_mode == SNAP_AUTOSLICE) { Vector2 point = mtx.affine_inverse().xform(Vector2(mb->get_position().x, mb->get_position().y)); - for (Rect2 &E : autoslice_cache) { + for (const Rect2 &E : autoslice_cache) { if (E.has_point(point)) { rect = E; if (Input::get_singleton()->is_key_pressed(KEY_CTRL) && !(Input::get_singleton()->is_key_pressed(KEY_SHIFT | KEY_ALT))) { diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 37e17f8d82..6bd901cead 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -65,7 +65,7 @@ void ThemeItemImportTree::_update_items_tree() { tree_icon_items.clear(); tree_stylebox_items.clear(); - for (StringName &E : types) { + for (const StringName &E : types) { String type_name = (String)E; TreeItem *type_node = import_items_tree->create_item(root); @@ -93,7 +93,7 @@ void ThemeItemImportTree::_update_items_tree() { bool data_type_has_filtered_items = false; - for (StringName &F : names) { + for (const StringName &F : names) { String item_name = (String)F; bool is_item_matching_filter = (item_name.findn(filter_text) > -1); if (!filter_text.is_empty() && !is_matching_filter && !is_item_matching_filter) { @@ -182,7 +182,7 @@ void ThemeItemImportTree::_update_items_tree() { bool data_type_any_checked_with_data = false; filtered_names.sort_custom<StringName::AlphCompare>(); - for (StringName &F : filtered_names) { + for (const StringName &F : filtered_names) { TreeItem *item_node = import_items_tree->create_item(data_type_node); item_node->set_meta("_can_be_imported", true); item_node->set_text(0, F); @@ -1236,7 +1236,7 @@ void ThemeItemEditorDialog::_update_edit_types() { bool item_reselected = false; edit_type_list->clear(); int e_idx = 0; - for (StringName &E : theme_types) { + for (const StringName &E : theme_types) { Ref<Texture2D> item_icon; if (E == "") { item_icon = get_theme_icon(SNAME("NodeDisabled"), SNAME("EditorIcons")); @@ -1318,7 +1318,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) { color_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Color Items")); names.sort_custom<StringName::AlphCompare>(); - for (StringName &E : names) { + for (const StringName &E : names) { TreeItem *item = edit_items_tree->create_item(color_root); item->set_text(0, E); item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item")); @@ -1339,7 +1339,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) { constant_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Constant Items")); names.sort_custom<StringName::AlphCompare>(); - for (StringName &E : names) { + for (const StringName &E : names) { TreeItem *item = edit_items_tree->create_item(constant_root); item->set_text(0, E); item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item")); @@ -1360,7 +1360,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) { font_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Font Items")); names.sort_custom<StringName::AlphCompare>(); - for (StringName &E : names) { + for (const StringName &E : names) { TreeItem *item = edit_items_tree->create_item(font_root); item->set_text(0, E); item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item")); @@ -1381,7 +1381,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) { font_size_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Font Size Items")); names.sort_custom<StringName::AlphCompare>(); - for (StringName &E : names) { + for (const StringName &E : names) { TreeItem *item = edit_items_tree->create_item(font_size_root); item->set_text(0, E); item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item")); @@ -1402,7 +1402,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) { icon_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Icon Items")); names.sort_custom<StringName::AlphCompare>(); - for (StringName &E : names) { + for (const StringName &E : names) { TreeItem *item = edit_items_tree->create_item(icon_root); item->set_text(0, E); item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item")); @@ -1423,7 +1423,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) { stylebox_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All StyleBox Items")); names.sort_custom<StringName::AlphCompare>(); - for (StringName &E : names) { + for (const StringName &E : names) { TreeItem *item = edit_items_tree->create_item(stylebox_root); item->set_text(0, E); item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item")); @@ -1507,7 +1507,7 @@ void ThemeItemEditorDialog::_remove_data_type_items(Theme::DataType p_data_type, edited_theme->_freeze_change_propagation(); edited_theme->get_theme_item_list(p_data_type, p_item_type, &names); - for (StringName &E : names) { + for (const StringName &E : names) { edited_theme->clear_theme_item(p_data_type, E, p_item_type); } @@ -1526,7 +1526,7 @@ void ThemeItemEditorDialog::_remove_class_items() { names.clear(); Theme::get_default()->get_theme_item_list(data_type, edited_item_type, &names); - for (StringName &E : names) { + for (const StringName &E : names) { if (edited_theme->has_theme_item_nocheck(data_type, E, edited_item_type)) { edited_theme->clear_theme_item(data_type, E, edited_item_type); } @@ -1550,7 +1550,7 @@ void ThemeItemEditorDialog::_remove_custom_items() { names.clear(); edited_theme->get_theme_item_list(data_type, edited_item_type, &names); - for (StringName &E : names) { + for (const StringName &E : names) { if (!Theme::get_default()->has_theme_item_nocheck(data_type, E, edited_item_type)) { edited_theme->clear_theme_item(data_type, E, edited_item_type); } @@ -1574,7 +1574,7 @@ void ThemeItemEditorDialog::_remove_all_items() { names.clear(); edited_theme->get_theme_item_list(data_type, edited_item_type, &names); - for (StringName &E : names) { + for (const StringName &E : names) { edited_theme->clear_theme_item(data_type, E, edited_item_type); } } @@ -1927,7 +1927,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog() { import_another_theme_dialog->set_title(TTR("Select Another Theme Resource:")); List<String> ext; ResourceLoader::get_recognized_extensions_for_type("Theme", &ext); - for (String &E : ext) { + for (const String &E : ext) { import_another_theme_dialog->add_filter("*." + E + "; Theme Resource"); } import_another_file_hb->add_child(import_another_theme_dialog); @@ -1969,7 +1969,7 @@ void ThemeTypeDialog::_update_add_type_options(const String &p_filter) { names.sort_custom<StringName::AlphCompare>(); Vector<StringName> unique_names; - for (StringName &E : names) { + for (const StringName &E : names) { // Filter out undesired values. if (!p_filter.is_subsequence_ofi(String(E))) { continue; @@ -2132,7 +2132,7 @@ void ThemeTypeEditor::_update_type_list() { bool item_reselected = false; int e_idx = 0; - for (StringName &E : theme_types) { + for (const StringName &E : theme_types) { Ref<Texture2D> item_icon; if (E == "") { item_icon = get_theme_icon(SNAME("NodeDisabled"), SNAME("EditorIcons")); @@ -2182,7 +2182,7 @@ OrderedHashMap<StringName, bool> ThemeTypeEditor::_get_type_items(String p_type_ (Theme::get_default().operator->()->*get_list_func)(default_type, &names); names.sort_custom<StringName::AlphCompare>(); - for (StringName &E : names) { + for (const StringName &E : names) { items[E] = false; } } @@ -2191,7 +2191,7 @@ OrderedHashMap<StringName, bool> ThemeTypeEditor::_get_type_items(String p_type_ names.clear(); (edited_theme.operator->()->*get_list_func)(p_type_name, &names); names.sort_custom<StringName::AlphCompare>(); - for (StringName &E : names) { + for (const StringName &E : names) { items[E] = true; } } @@ -2203,7 +2203,7 @@ OrderedHashMap<StringName, bool> ThemeTypeEditor::_get_type_items(String p_type_ keys.sort_custom<StringName::AlphCompare>(); OrderedHashMap<StringName, bool> ordered_items; - for (StringName &E : keys) { + for (const StringName &E : keys) { ordered_items[E] = items[E]; } @@ -2580,7 +2580,7 @@ void ThemeTypeEditor::_add_default_type_items() { { names.clear(); Theme::get_default()->get_icon_list(default_type, &names); - for (StringName &E : names) { + for (const StringName &E : names) { if (!edited_theme->has_icon(E, edited_type)) { edited_theme->set_icon(E, edited_type, Ref<Texture2D>()); } @@ -2589,7 +2589,7 @@ void ThemeTypeEditor::_add_default_type_items() { { names.clear(); Theme::get_default()->get_stylebox_list(default_type, &names); - for (StringName &E : names) { + for (const StringName &E : names) { if (!edited_theme->has_stylebox(E, edited_type)) { edited_theme->set_stylebox(E, edited_type, Ref<StyleBox>()); } @@ -2598,7 +2598,7 @@ void ThemeTypeEditor::_add_default_type_items() { { names.clear(); Theme::get_default()->get_font_list(default_type, &names); - for (StringName &E : names) { + for (const StringName &E : names) { if (!edited_theme->has_font(E, edited_type)) { edited_theme->set_font(E, edited_type, Ref<Font>()); } @@ -2607,7 +2607,7 @@ void ThemeTypeEditor::_add_default_type_items() { { names.clear(); Theme::get_default()->get_font_size_list(default_type, &names); - for (StringName &E : names) { + for (const StringName &E : names) { if (!edited_theme->has_font_size(E, edited_type)) { edited_theme->set_font_size(E, edited_type, Theme::get_default()->get_font_size(E, default_type)); } @@ -2616,7 +2616,7 @@ void ThemeTypeEditor::_add_default_type_items() { { names.clear(); Theme::get_default()->get_color_list(default_type, &names); - for (StringName &E : names) { + for (const StringName &E : names) { if (!edited_theme->has_color(E, edited_type)) { edited_theme->set_color(E, edited_type, Theme::get_default()->get_color(E, default_type)); } @@ -2625,7 +2625,7 @@ void ThemeTypeEditor::_add_default_type_items() { { names.clear(); Theme::get_default()->get_constant_list(default_type, &names); - for (StringName &E : names) { + for (const StringName &E : names) { if (!edited_theme->has_constant(E, edited_type)) { edited_theme->set_constant(E, edited_type, Theme::get_default()->get_constant(E, default_type)); } @@ -2882,7 +2882,7 @@ void ThemeTypeEditor::_update_stylebox_from_leading() { List<StringName> names; edited_theme->get_stylebox_list(edited_type, &names); List<Ref<StyleBox>> styleboxes; - for (StringName &E : names) { + for (const StringName &E : names) { if (E == leading_stylebox.item_name) { continue; } @@ -2895,7 +2895,7 @@ void ThemeTypeEditor::_update_stylebox_from_leading() { List<PropertyInfo> props; leading_stylebox.stylebox->get_property_list(&props); - for (PropertyInfo &E : props) { + for (const PropertyInfo &E : props) { if (!(E.usage & PROPERTY_USAGE_STORAGE)) { continue; } @@ -3301,7 +3301,7 @@ ThemeEditor::ThemeEditor() { preview_scene_dialog->set_title(TTR("Select UI Scene:")); List<String> ext; ResourceLoader::get_recognized_extensions_for_type("PackedScene", &ext); - for (String &E : ext) { + for (const String &E : ext) { preview_scene_dialog->add_filter("*." + E + "; Scene"); } main_hs->add_child(preview_scene_dialog); @@ -3343,11 +3343,11 @@ bool ThemeEditorPlugin::handles(Object *p_node) const { List<StringName> names; edited_theme->get_font_type_list(&types); - for (StringName &E : types) { + for (const StringName &E : types) { names.clear(); edited_theme->get_font_list(E, &names); - for (StringName &F : names) { + for (const StringName &F : names) { if (font_item == edited_theme->get_font(F, E)) { belongs_to_theme = true; break; @@ -3360,11 +3360,11 @@ bool ThemeEditorPlugin::handles(Object *p_node) const { List<StringName> names; edited_theme->get_stylebox_type_list(&types); - for (StringName &E : types) { + for (const StringName &E : types) { names.clear(); edited_theme->get_stylebox_list(E, &names); - for (StringName &F : names) { + for (const StringName &F : names) { if (stylebox_item == edited_theme->get_stylebox(F, E)) { belongs_to_theme = true; break; @@ -3377,11 +3377,11 @@ bool ThemeEditorPlugin::handles(Object *p_node) const { List<StringName> names; edited_theme->get_icon_type_list(&types); - for (StringName &E : types) { + for (const StringName &E : types) { names.clear(); edited_theme->get_icon_list(E, &names); - for (StringName &F : names) { + for (const StringName &F : names) { if (icon_item == edited_theme->get_icon(F, E)) { belongs_to_theme = true; break; diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index ab26e1c380..432f48fa85 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -303,7 +303,7 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro } // Add only properties that are common to all tiles. - for (PLData *E : data_list) { + for (const PLData *E : data_list) { if (E->uses == tiles.size()) { p_list->push_back(E->property_info); } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 7e3244dddf..46818afe45 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -666,7 +666,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { if (valid_left) { name_left = vsnode->get_input_port_name(i); port_left = vsnode->get_input_port_type(i); - for (VisualShader::Connection &E : connections) { + for (const VisualShader::Connection &E : connections) { if (E.to_node == p_id && E.to_port == j) { port_left_used = true; } @@ -899,7 +899,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { expression_box->set_syntax_highlighter(expression_syntax_highlighter); expression_box->add_theme_color_override("background_color", background_color); - for (String &E : VisualShaderEditor::get_singleton()->keyword_list) { + for (const String &E : VisualShaderEditor::get_singleton()->keyword_list) { if (ShaderLanguage::is_control_flow_keyword(E)) { expression_syntax_highlighter->add_keyword_color(E, control_flow_keyword_color); } else { @@ -1470,7 +1470,7 @@ void VisualShaderEditor::_update_graph() { graph_plugin->make_dirty(false); - for (VisualShader::Connection &E : connections) { + for (const VisualShader::Connection &E : connections) { int from = E.from_node; int from_idx = E.from_port; int to = E.to_node; @@ -1634,7 +1634,7 @@ void VisualShaderEditor::_expand_output_port(int p_node, int p_port, bool p_expa List<VisualShader::Connection> conns; visual_shader->get_node_connections(type, &conns); - for (VisualShader::Connection &E : conns) { + for (const VisualShader::Connection &E : conns) { int from_node = E.from_node; int from_port = E.from_port; int to_node = E.to_node; @@ -1708,7 +1708,7 @@ void VisualShaderEditor::_remove_input_port(int p_node, int p_port) { List<VisualShader::Connection> conns; visual_shader->get_node_connections(type, &conns); - for (VisualShader::Connection &E : conns) { + for (const VisualShader::Connection &E : conns) { int from_node = E.from_node; int from_port = E.from_port; int to_node = E.to_node; @@ -1757,7 +1757,7 @@ void VisualShaderEditor::_remove_output_port(int p_node, int p_port) { List<VisualShader::Connection> conns; visual_shader->get_node_connections(type, &conns); - for (VisualShader::Connection &E : conns) { + for (const VisualShader::Connection &E : conns) { int from_node = E.from_node; int from_port = E.from_port; int to_node = E.to_node; @@ -2518,7 +2518,7 @@ void VisualShaderEditor::_nodes_dragged() { undo_redo->create_action(TTR("Node(s) Moved")); - for (DragOp &E : drag_buffer) { + for (const DragOp &E : drag_buffer) { undo_redo->add_do_method(visual_shader.ptr(), "set_node_position", E.type, E.node, E.to); undo_redo->add_undo_method(visual_shader.ptr(), "set_node_position", E.type, E.node, E.from); undo_redo->add_do_method(graph_plugin.ptr(), "set_node_position", E.type, E.node, E.to); @@ -2544,7 +2544,7 @@ void VisualShaderEditor::_connection_request(const String &p_from, int p_from_in List<VisualShader::Connection> conns; visual_shader->get_node_connections(type, &conns); - for (VisualShader::Connection &E : conns) { + for (const VisualShader::Connection &E : conns) { if (E.to_node == to && E.to_port == p_to_index) { undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port); undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port); @@ -2598,7 +2598,7 @@ void VisualShaderEditor::_delete_nodes(int p_type, const List<int> &p_nodes) { visual_shader->get_node_connections(type, &conns); for (const int &F : p_nodes) { - for (VisualShader::Connection &E : conns) { + for (const VisualShader::Connection &E : conns) { if (E.from_node == F || E.to_node == F) { undo_redo->add_do_method(graph_plugin.ptr(), "disconnect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port); } @@ -2639,7 +2639,7 @@ void VisualShaderEditor::_delete_nodes(int p_type, const List<int> &p_nodes) { List<VisualShader::Connection> used_conns; for (const int &F : p_nodes) { - for (VisualShader::Connection &E : conns) { + for (const VisualShader::Connection &E : conns) { if (E.from_node == F || E.to_node == F) { bool cancel = false; for (List<VisualShader::Connection>::Element *R = used_conns.front(); R; R = R->next()) { @@ -3094,7 +3094,7 @@ void VisualShaderEditor::_notification(int p_what) { preview_text->add_theme_color_override("background_color", background_color); - for (String &E : keyword_list) { + for (const String &E : keyword_list) { if (ShaderLanguage::is_control_flow_keyword(E)) { syntax_highlighter->add_keyword_color(E, control_flow_keyword_color); } else { @@ -3249,7 +3249,7 @@ void VisualShaderEditor::_dup_paste_nodes(int p_type, int p_pasted_type, List<in List<VisualShader::Connection> conns; visual_shader->get_node_connections(pasted_type, &conns); - for (VisualShader::Connection &E : conns) { + for (const VisualShader::Connection &E : conns) { if (unsupported_set.has(E.from_node) || unsupported_set.has(E.to_node)) { continue; } @@ -3399,7 +3399,7 @@ void VisualShaderEditor::_input_select_item(Ref<VisualShaderNodeInput> p_input, if (type_changed) { List<VisualShader::Connection> conns; visual_shader->get_node_connections(type, &conns); - for (VisualShader::Connection &E : conns) { + for (const VisualShader::Connection &E : conns) { if (E.from_node == id) { if (visual_shader->is_port_types_compatible(p_input->get_input_type_by_name(p_name), visual_shader->get_node(type, E.to_node)->get_input_port_type(E.to_port))) { undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port); @@ -3445,7 +3445,7 @@ void VisualShaderEditor::_uniform_select_item(Ref<VisualShaderNodeUniformRef> p_ if (type_changed) { List<VisualShader::Connection> conns; visual_shader->get_node_connections(type, &conns); - for (VisualShader::Connection &E : conns) { + for (const VisualShader::Connection &E : conns) { if (E.from_node == id) { if (visual_shader->is_port_types_compatible(p_uniform_ref->get_uniform_type_by_name(p_name), visual_shader->get_node(type, E.to_node)->get_input_port_type(E.to_port))) { continue; @@ -4825,7 +4825,7 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par Vector<PropertyInfo> pinfo; - for (PropertyInfo &E : props) { + for (const PropertyInfo &E : props) { for (int i = 0; i < properties.size(); i++) { if (E.name == String(properties[i])) { pinfo.push_back(E); @@ -4894,7 +4894,7 @@ void EditorPropertyShaderMode::_option_selected(int p_which) { VisualShader::Type type = VisualShader::Type(i); List<VisualShader::Connection> conns; visual_shader->get_node_connections(type, &conns); - for (VisualShader::Connection &E : conns) { + for (const VisualShader::Connection &E : conns) { if (E.to_node == VisualShader::NODE_ID_OUTPUT) { undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port); } @@ -4918,7 +4918,7 @@ void EditorPropertyShaderMode::_option_selected(int p_which) { List<PropertyInfo> props; visual_shader->get_property_list(&props); - for (PropertyInfo &E : props) { + for (const PropertyInfo &E : props) { if (E.name.begins_with("flags/") || E.name.begins_with("modes/")) { undo_redo->add_undo_property(visual_shader.ptr(), E.name, visual_shader->get(E.name)); } @@ -5024,7 +5024,7 @@ void VisualShaderNodePortPreview::_shader_changed() { if (src_mat && src_mat->get_shader().is_valid()) { List<PropertyInfo> params; src_mat->get_shader()->get_param_list(¶ms); - for (PropertyInfo &E : params) { + for (const PropertyInfo &E : params) { material->set(E.name, src_mat->get(E.name)); } } diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 3f320ef12a..fcb714bdf7 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -340,7 +340,7 @@ void ProjectExportDialog::_update_feature_list() { } } - for (String &E : features) { + for (const String &E : features) { fset.insert(E); } diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 4f9d849bc0..fd4f22425f 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1238,14 +1238,14 @@ void ProjectList::load_projects() { Set<String> favorites; // Find favourites... - for (PropertyInfo &E : properties) { + for (const PropertyInfo &E : properties) { String property_key = E.name; if (property_key.begins_with("favorite_projects/")) { favorites.insert(property_key); } } - for (PropertyInfo &E : properties) { + for (const PropertyInfo &E : properties) { // This is actually something like "projects/C:::Documents::Godot::Projects::MyGame" String property_key = E.name; if (!property_key.begins_with("projects/")) { @@ -1582,7 +1582,7 @@ int ProjectList::refresh_project(const String &dir_path) { String favorite_property_key = "favorite_projects/" + project_key; bool found = false; - for (PropertyInfo &E : properties) { + for (const PropertyInfo &E : properties) { String prop = E.name; if (!found && prop == property_key) { found = true; @@ -2188,7 +2188,7 @@ void ProjectManager::_scan_begin(const String &p_base) { _scan_dir(p_base, &projects); print_line("Found " + itos(projects.size()) + " projects."); - for (String &E : projects) { + for (const String &E : projects) { String proj = get_project_key_from_path(E); EditorSettings::get_singleton()->set("projects/" + proj, E); } @@ -2625,7 +2625,7 @@ ProjectManager::ProjectManager() { Vector<String> editor_languages; List<PropertyInfo> editor_settings_properties; EditorSettings::get_singleton()->get_property_list(&editor_settings_properties); - for (PropertyInfo &pi : editor_settings_properties) { + for (const PropertyInfo &pi : editor_settings_properties) { if (pi.name == "interface/editor/editor_language") { editor_languages = pi.hint_string.split(","); break; diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index bc44fccfa0..b8ccab78dd 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -229,7 +229,7 @@ void ProjectSettingsEditor::_add_feature_overrides() { for (int i = 0; i < ee->get_export_platform_count(); i++) { List<String> p; ee->get_export_platform(i)->get_platform_features(&p); - for (String &E : p) { + for (const String &E : p) { presets.insert(E); } } @@ -237,7 +237,7 @@ void ProjectSettingsEditor::_add_feature_overrides() { for (int i = 0; i < ee->get_export_preset_count(); i++) { List<String> p; ee->get_export_preset(i)->get_platform()->get_preset_features(ee->get_export_preset(i), &p); - for (String &E : p) { + for (const String &E : p) { presets.insert(E); } @@ -391,7 +391,7 @@ void ProjectSettingsEditor::_action_reordered(const String &p_action_name, const undo_redo->create_action(TTR("Update Input Action Order")); - for (PropertyInfo &prop : props) { + for (const PropertyInfo &prop : props) { // Skip builtins and non-inputs if (ProjectSettings::get_singleton()->is_builtin_setting(prop.name) || !prop.name.begins_with("input/")) { continue; @@ -444,7 +444,7 @@ void ProjectSettingsEditor::_update_action_map_editor() { ProjectSettings::get_singleton()->get_property_list(&props); const Ref<Texture2D> builtin_icon = get_theme_icon(SNAME("PinPressed"), SNAME("EditorIcons")); - for (PropertyInfo &E : props) { + for (const PropertyInfo &E : props) { const String property_name = E.name; if (!property_name.begins_with("input/")) { diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 6fc77500c3..7338588d56 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -143,7 +143,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { } Set<String> valid_extensions; - for (String &E : extensions) { + for (const String &E : extensions) { valid_extensions.insert(E); } @@ -179,7 +179,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { res_orig->get_property_list(&property_list); List<Pair<String, Variant>> propvalues; - for (PropertyInfo &pi : property_list) { + for (const PropertyInfo &pi : property_list) { Pair<String, Variant> p; if (pi.usage & PROPERTY_USAGE_STORAGE) { p.first = pi.name; @@ -197,7 +197,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { ERR_FAIL_COND(res.is_null()); - for (Pair<String, Variant> &p : propvalues) { + for (const Pair<String, Variant> &p : propvalues) { res->set(p.first, p.second); } @@ -1291,7 +1291,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { ResourceLoader::get_recognized_extensions_for_type(type, &extensions); file->clear_filters(); - for (String &E : extensions) { + for (const String &E : extensions) { file->add_filter("*." + E + " ; " + E.to_upper()); } @@ -1319,7 +1319,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { res_orig->get_property_list(&property_list); List<Pair<String, Variant>> propvalues; - for (PropertyInfo &pi : property_list) { + for (const PropertyInfo &pi : property_list) { Pair<String, Variant> p; if (pi.usage & PROPERTY_USAGE_STORAGE) { p.first = pi.name; @@ -1333,7 +1333,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { ERR_FAIL_COND(res.is_null()); - for (Pair<String, Variant> &p : propvalues) { + for (const Pair<String, Variant> &p : propvalues) { res->set(p.first, p.second); } diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index 471fec76f2..a1deae92a4 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -156,7 +156,7 @@ void PropertySelector::_update_search() { search_options->get_theme_icon(SNAME("PackedColorArray"), SNAME("EditorIcons")) }; - for (PropertyInfo &E : props) { + for (const PropertyInfo &E : props) { if (E.usage == PROPERTY_USAGE_CATEGORY) { if (category && category->get_first_child() == nullptr) { memdelete(category); //old category was unused diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 2586a36966..c4d47c7594 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1531,7 +1531,7 @@ void SceneTreeDock::perform_node_renames(Node *p_base, Map<Node *, NodePath> *p_ List<PropertyInfo> properties; p_base->get_property_list(&properties); - for (PropertyInfo &E : properties) { + for (const PropertyInfo &E : properties) { if (!(E.usage & (PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR))) { continue; } @@ -1557,7 +1557,7 @@ void SceneTreeDock::perform_node_renames(Node *p_base, Map<Node *, NodePath> *p_ Map<Node *, NodePath>::Element *found_root_path = p_renames->find(root); NodePath new_root_path = found_root_path ? found_root_path->get() : root->get_path(); if (!new_root_path.is_empty()) { // No renaming if root node is deleted. - for (StringName &E : anims) { + for (const StringName &E : anims) { Ref<Animation> anim = ap->get_animation(E); if (!r_rem_anims->has(anim)) { r_rem_anims->insert(anim, Set<int>()); @@ -2271,7 +2271,7 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop List<PropertyInfo> pinfo; n->get_property_list(&pinfo); - for (PropertyInfo &E : pinfo) { + for (const PropertyInfo &E : pinfo) { if (!(E.usage & PROPERTY_USAGE_STORAGE)) { continue; } @@ -2308,12 +2308,11 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop List<MethodInfo> sl; n->get_signal_list(&sl); - for (MethodInfo &E : sl) { + for (const MethodInfo &E : sl) { List<Object::Connection> cl; n->get_signal_connection_list(E.name, &cl); - for (Object::Connection &F : cl) { - Object::Connection &c = F; + for (const Object::Connection &c : cl) { if (!(c.flags & Object::CONNECT_PERSIST)) { continue; } @@ -2519,13 +2518,13 @@ void SceneTreeDock::_files_dropped(Vector<String> p_files, NodePath p_to, int p_ List<PropertyInfo> pinfo; node->get_property_list(&pinfo); - for (PropertyInfo &p : pinfo) { + for (const PropertyInfo &p : pinfo) { if (!(p.usage & PROPERTY_USAGE_EDITOR) || !(p.usage & PROPERTY_USAGE_STORAGE) || p.hint != PROPERTY_HINT_RESOURCE_TYPE) { continue; } Vector<String> valid_types = p.hint_string.split(","); - for (String &prop_type : valid_types) { + for (const String &prop_type : valid_types) { if (res_type == prop_type || ClassDB::is_parent_class(res_type, prop_type) || EditorNode::get_editor_data().script_class_is_parent(res_type, prop_type)) { valid_properties.push_back(p.name); break; @@ -2539,7 +2538,7 @@ void SceneTreeDock::_files_dropped(Vector<String> p_files, NodePath p_to, int p_ bool capitalize = bool(EDITOR_GET("interface/inspector/capitalize_properties")); menu_properties->clear(); - for (String &p : valid_properties) { + for (const String &p : valid_properties) { menu_properties->add_item(capitalize ? p.capitalize() : p); menu_properties->set_item_metadata(menu_properties->get_item_count() - 1, p); } @@ -2597,7 +2596,7 @@ void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) { List<PropertyInfo> pinfo; p_obj->get_property_list(&pinfo); - for (PropertyInfo &E : pinfo) { + for (const PropertyInfo &E : pinfo) { if (!(E.usage & PROPERTY_USAGE_EDITOR)) { continue; } @@ -3052,7 +3051,7 @@ void SceneTreeDock::_create_remap_for_node(Node *p_node, Map<RES, RES> &r_remap) p_node->get_property_list(&props); bool is_instantiated = EditorPropertyRevert::may_node_be_in_instance(p_node); - for (PropertyInfo &E : props) { + for (const PropertyInfo &E : props) { if (!(E.usage & PROPERTY_USAGE_STORAGE)) { continue; } @@ -3088,7 +3087,7 @@ void SceneTreeDock::_create_remap_for_resource(RES p_resource, Map<RES, RES> &r_ List<PropertyInfo> props; p_resource->get_property_list(&props); - for (PropertyInfo &E : props) { + for (const PropertyInfo &E : props) { if (!(E.usage & PROPERTY_USAGE_STORAGE)) { continue; } diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 90481b2107..9a4b38db74 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -205,7 +205,7 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must bool found = false; bool match = false; int index = 0; - for (String &E : extensions) { + for (const String &E : extensions) { if (E.nocasecmp_to(extension) == 0) { //FIXME (?) - changing language this way doesn't update controls, needs rework //language_menu->select(index); // change Language option by extension @@ -373,7 +373,7 @@ void ScriptCreateDialog::_lang_changed(int l) { ScriptServer::get_language(m)->get_recognized_extensions(&extensions); } - for (String &E : extensions) { + for (const String &E : extensions) { if (E.nocasecmp_to(extension) == 0) { path = path.get_basename() + selected_ext; _path_changed(path); @@ -534,7 +534,7 @@ void ScriptCreateDialog::_browse_path(bool browse_parent, bool p_save) { int lang = language_menu->get_selected(); ScriptServer::get_language(lang)->get_recognized_extensions(&extensions); - for (String &E : extensions) { + for (const String &E : extensions) { file_browse->add_filter("*." + E); } diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 89e102ee22..aefa8e434e 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -324,7 +324,7 @@ void EditorSettingsDialog::_update_shortcuts() { List<String> slist; EditorSettings::get_singleton()->get_shortcut_list(&slist); - for (String &E : slist) { + for (const String &E : slist) { Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(E); if (!sc->has_meta("original")) { continue; |