From 1638c1b28f4b79546864872ef25b3c28f4860b56 Mon Sep 17 00:00:00 2001 From: Muller-Castro <37383316+Muller-Castro@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:25:58 -0300 Subject: [PATCH] Add const lvalue ref to editor/* container parameters --- editor/animation_track_editor.cpp | 4 +- editor/animation_track_editor.h | 4 +- editor/connections_dialog.cpp | 4 +- editor/connections_dialog.h | 4 +- editor/create_dialog.cpp | 2 +- editor/create_dialog.h | 2 +- editor/debugger/editor_debugger_node.cpp | 4 +- editor/debugger/editor_debugger_node.h | 4 +- editor/debugger/editor_file_server.cpp | 2 +- .../debugger/editor_performance_profiler.cpp | 2 +- editor/debugger/editor_performance_profiler.h | 2 +- editor/debugger/script_editor_debugger.cpp | 2 +- editor/debugger/script_editor_debugger.h | 2 +- editor/editor_autoload_settings.cpp | 6 +-- editor/editor_autoload_settings.h | 6 +-- editor/editor_data.cpp | 2 +- editor/editor_data.h | 2 +- editor/editor_file_system.cpp | 4 +- editor/editor_file_system.h | 4 +- editor/editor_inspector.cpp | 10 ++-- editor/editor_inspector.h | 10 ++-- editor/editor_log.h | 2 +- editor/editor_properties.cpp | 6 +-- editor/editor_properties.h | 6 +-- editor/editor_properties_array_dict.cpp | 2 +- editor/editor_properties_array_dict.h | 2 +- editor/editor_resource_picker.cpp | 2 +- editor/editor_resource_picker.h | 2 +- editor/editor_resource_preview.cpp | 2 +- editor/editor_resource_preview.h | 2 +- editor/editor_settings.cpp | 10 ++-- editor/editor_settings.h | 10 ++-- editor/editor_vcs_interface.cpp | 52 +++++++++---------- editor/editor_vcs_interface.h | 52 +++++++++---------- editor/export/editor_export_platform.cpp | 4 +- editor/export/editor_export_platform.h | 4 +- editor/filesystem_dock.cpp | 10 ++-- editor/filesystem_dock.h | 10 ++-- editor/find_in_files.cpp | 28 +++++----- editor/find_in_files.h | 26 +++++----- editor/gui/editor_file_dialog.cpp | 2 +- editor/gui/editor_file_dialog.h | 2 +- editor/gui/editor_toaster.cpp | 6 +-- editor/gui/editor_toaster.h | 6 +-- editor/gui/scene_tree_editor.cpp | 2 +- editor/gui/scene_tree_editor.h | 2 +- editor/import/3d/collada.cpp | 10 ++-- editor/import/3d/collada.h | 10 ++-- editor/import/3d/editor_import_collada.cpp | 4 +- editor/import/3d/resource_importer_scene.cpp | 6 +-- editor/import/3d/resource_importer_scene.h | 10 ++-- editor/import/3d/scene_import_settings.cpp | 2 +- editor/import/3d/scene_import_settings.h | 2 +- editor/inspector_dock.cpp | 2 +- editor/inspector_dock.h | 2 +- editor/plugins/abstract_polygon_2d_editor.cpp | 4 +- editor/plugins/abstract_polygon_2d_editor.h | 4 +- .../animation_blend_tree_editor_plugin.cpp | 2 +- .../animation_blend_tree_editor_plugin.h | 2 +- editor/plugins/animation_library_editor.cpp | 2 +- editor/plugins/animation_library_editor.h | 2 +- .../animation_state_machine_editor.cpp | 2 +- .../plugins/animation_state_machine_editor.h | 2 +- .../audio_stream_randomizer_editor_plugin.cpp | 2 +- .../audio_stream_randomizer_editor_plugin.h | 2 +- editor/plugins/bone_map_editor_plugin.cpp | 12 ++--- editor/plugins/bone_map_editor_plugin.h | 12 ++--- editor/plugins/canvas_item_editor_plugin.cpp | 4 +- editor/plugins/canvas_item_editor_plugin.h | 4 +- editor/plugins/editor_debugger_plugin.cpp | 2 +- editor/plugins/editor_debugger_plugin.h | 2 +- editor/plugins/font_config_plugin.cpp | 6 +-- editor/plugins/font_config_plugin.h | 6 +-- editor/plugins/gdextension_export_plugin.h | 2 +- editor/plugins/material_editor_plugin.cpp | 2 +- editor/plugins/material_editor_plugin.h | 2 +- .../navigation_obstacle_3d_editor_plugin.cpp | 2 +- .../navigation_obstacle_3d_editor_plugin.h | 2 +- editor/plugins/node_3d_editor_plugin.cpp | 2 +- editor/plugins/node_3d_editor_plugin.h | 2 +- editor/plugins/polygon_3d_editor_plugin.cpp | 2 +- editor/plugins/polygon_3d_editor_plugin.h | 2 +- editor/plugins/script_editor_plugin.cpp | 18 +++---- editor/plugins/script_editor_plugin.h | 20 +++---- editor/plugins/script_text_editor.cpp | 8 +-- editor/plugins/script_text_editor.h | 8 +-- editor/plugins/skeleton_3d_editor_plugin.cpp | 2 +- editor/plugins/skeleton_3d_editor_plugin.h | 2 +- editor/plugins/text_editor.cpp | 2 +- editor/plugins/text_editor.h | 2 +- editor/plugins/text_shader_editor.cpp | 2 +- editor/plugins/text_shader_editor.h | 2 +- editor/plugins/tiles/atlas_merging_dialog.cpp | 4 +- editor/plugins/tiles/atlas_merging_dialog.h | 4 +- editor/plugins/tiles/tile_data_editors.cpp | 28 +++++----- editor/plugins/tiles/tile_data_editors.h | 32 ++++++------ .../plugins/tiles/tile_map_layer_editor.cpp | 4 +- editor/plugins/tiles/tile_map_layer_editor.h | 4 +- .../tiles/tile_set_atlas_source_editor.cpp | 10 ++-- .../tiles/tile_set_atlas_source_editor.h | 10 ++-- editor/plugins/tiles/tile_set_editor.cpp | 4 +- editor/plugins/tiles/tile_set_editor.h | 4 +- ...le_set_scenes_collection_source_editor.cpp | 4 +- ...tile_set_scenes_collection_source_editor.h | 4 +- .../plugins/version_control_editor_plugin.cpp | 18 +++---- .../plugins/version_control_editor_plugin.h | 18 +++---- .../plugins/visual_shader_editor_plugin.cpp | 18 +++---- editor/plugins/visual_shader_editor_plugin.h | 16 +++--- editor/project_converter_3_to_4.cpp | 18 +++---- editor/project_converter_3_to_4.h | 12 ++--- editor/rename_dialog.cpp | 4 +- editor/rename_dialog.h | 4 +- editor/scene_tree_dock.cpp | 12 ++--- editor/scene_tree_dock.h | 12 ++--- editor/script_create_dialog.cpp | 4 +- editor/themes/editor_color_map.cpp | 2 +- editor/themes/editor_color_map.h | 2 +- editor/window_wrapper.cpp | 2 +- editor/window_wrapper.h | 2 +- 119 files changed, 397 insertions(+), 397 deletions(-) diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 1652c0b1f10..6f1439a91f2 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -3828,7 +3828,7 @@ void AnimationTrackEditor::_insert_track(bool p_reset_wanted, bool p_create_bezi } } -void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant p_value) { +void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value) { ERR_FAIL_NULL(root); ERR_FAIL_COND_MSG( (p_type != Animation::TYPE_POSITION_3D && p_type != Animation::TYPE_ROTATION_3D && p_type != Animation::TYPE_SCALE_3D), @@ -4986,7 +4986,7 @@ void AnimationTrackEditor::_fetch_value_track_options(const NodePath &p_path, An } } -void AnimationTrackEditor::_new_track_property_selected(String p_name) { +void AnimationTrackEditor::_new_track_property_selected(const String &p_name) { String full_path = String(adding_track_path) + ":" + p_name; EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index 0d6f93fefc4..d0da7b00623 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -440,7 +440,7 @@ class AnimationTrackEditor : public VBoxContainer { void _add_track(int p_type); void _new_track_node_selected(NodePath p_path); - void _new_track_property_selected(String p_name); + void _new_track_property_selected(const String &p_name); void _update_step_spinbox(); @@ -699,7 +699,7 @@ public: void set_anim_pos(float p_pos); void insert_node_value_key(Node *p_node, const String &p_property, const Variant &p_value, bool p_only_if_exists = false); void insert_value_key(const String &p_property, const Variant &p_value, bool p_advance); - void insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant p_value); + void insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value); bool has_track(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type); void make_insert_queue(); void commit_insert_queue(); diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 9fef2006112..19474d383d7 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -236,7 +236,7 @@ void ConnectDialog::_remove_bind() { /* * Automatically generates a name for the callback method. */ -StringName ConnectDialog::generate_method_callback_name(Node *p_source, String p_signal_name, Node *p_target) { +StringName ConnectDialog::generate_method_callback_name(Node *p_source, const String &p_signal_name, Node *p_target) { String node_name = p_source->get_name(); for (int i = 0; i < node_name.length(); i++) { // TODO: Regex filter may be cleaner. char32_t c = node_name[i]; @@ -645,7 +645,7 @@ void ConnectDialog::init(const ConnectionData &p_cd, const PackedStringArray &p_ source_connection_data = p_cd; } -void ConnectDialog::popup_dialog(const String p_for_signal) { +void ConnectDialog::popup_dialog(const String &p_for_signal) { from_signal->set_text(p_for_signal); warning_label->add_theme_color_override("font_color", warning_label->get_theme_color(SNAME("warning_color"), EditorStringName(Editor))); error_label->add_theme_color_override("font_color", error_label->get_theme_color(SNAME("error_color"), EditorStringName(Editor))); diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index fb163fbb5f4..8aa44dc91d1 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -163,7 +163,7 @@ protected: static void _bind_methods(); public: - static StringName generate_method_callback_name(Node *p_source, String p_signal_name, Node *p_target); + static StringName generate_method_callback_name(Node *p_source, const String &p_signal_name, Node *p_target); Node *get_source() const; ConnectionData get_source_connection_data() const; StringName get_signal_name() const; @@ -184,7 +184,7 @@ public: void init(const ConnectionData &p_cd, const PackedStringArray &p_signal_args, bool p_edit = false); - void popup_dialog(const String p_for_signal); + void popup_dialog(const String &p_for_signal); ConnectDialog(); ~ConnectDialog(); }; diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 604449b04b7..603b3505d46 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -343,7 +343,7 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const String } } -String CreateDialog::_top_result(const Vector p_candidates, const String &p_search_text) const { +String CreateDialog::_top_result(const Vector &p_candidates, const String &p_search_text) const { float highest_score = 0; int highest_index = 0; for (int i = 0; i < p_candidates.size(); i++) { diff --git a/editor/create_dialog.h b/editor/create_dialog.h index 694efd1ee1c..12385747c23 100644 --- a/editor/create_dialog.h +++ b/editor/create_dialog.h @@ -71,7 +71,7 @@ class CreateDialog : public ConfirmationDialog { bool _should_hide_type(const String &p_type) const; void _add_type(const String &p_type, const TypeCategory p_type_category); void _configure_search_option_item(TreeItem *r_item, const String &p_type, const TypeCategory p_type_category); - String _top_result(const Vector p_candidates, const String &p_search_text) const; + String _top_result(const Vector &p_candidates, const String &p_search_text) const; float _score_type(const String &p_type, const String &p_search) const; bool _is_type_preferred(const String &p_type) const; diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 5fe35bde84c..b7719f6c973 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -557,7 +557,7 @@ void EditorDebuggerNode::_paused() { }); } -void EditorDebuggerNode::_breaked(bool p_breaked, bool p_can_debug, String p_message, bool p_has_stackdump, int p_debugger) { +void EditorDebuggerNode::_breaked(bool p_breaked, bool p_can_debug, const String &p_message, bool p_has_stackdump, int p_debugger) { if (get_current_debugger() != get_debugger(p_debugger)) { if (!p_breaked) { return; @@ -582,7 +582,7 @@ void EditorDebuggerNode::set_breakpoint(const String &p_path, int p_line, bool p emit_signal(SNAME("breakpoint_toggled"), p_path, p_line, p_enabled); } -void EditorDebuggerNode::set_breakpoints(const String &p_path, Array p_lines) { +void EditorDebuggerNode::set_breakpoints(const String &p_path, const Array &p_lines) { for (int i = 0; i < p_lines.size(); i++) { set_breakpoint(p_path, p_lines[i], true); } diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h index d30f29c7c67..01aa522f403 100644 --- a/editor/debugger/editor_debugger_node.h +++ b/editor/debugger/editor_debugger_node.h @@ -149,7 +149,7 @@ protected: void _text_editor_stack_clear(const ScriptEditorDebugger *p_debugger); void _stack_frame_selected(int p_debugger); void _error_selected(const String &p_file, int p_line, int p_debugger); - void _breaked(bool p_breaked, bool p_can_debug, String p_message, bool p_has_stackdump, int p_debugger); + void _breaked(bool p_breaked, bool p_can_debug, const String &p_message, bool p_has_stackdump, int p_debugger); void _paused(); void _break_state_changed(); void _menu_option(int p_id); @@ -186,7 +186,7 @@ public: bool is_skip_breakpoints() const; void set_breakpoint(const String &p_path, int p_line, bool p_enabled); - void set_breakpoints(const String &p_path, Array p_lines); + void set_breakpoints(const String &p_path, const Array &p_lines); void reload_all_scripts(); void reload_scripts(const Vector &p_script_paths); diff --git a/editor/debugger/editor_file_server.cpp b/editor/debugger/editor_file_server.cpp index c12cec1e74f..e84eb146363 100644 --- a/editor/debugger/editor_file_server.cpp +++ b/editor/debugger/editor_file_server.cpp @@ -98,7 +98,7 @@ void EditorFileServer::_scan_files_changed(EditorFileSystemDirectory *efd, const } } -static void _add_custom_file(const String f, HashMap &files_to_send, HashMap &cached_files) { +static void _add_custom_file(const String &f, HashMap &files_to_send, HashMap &cached_files) { if (!FileAccess::exists(f)) { return; } diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp index 37e13b59cc6..ffff362a941 100644 --- a/editor/debugger/editor_performance_profiler.cpp +++ b/editor/debugger/editor_performance_profiler.cpp @@ -38,7 +38,7 @@ EditorPerformanceProfiler::Monitor::Monitor() {} -EditorPerformanceProfiler::Monitor::Monitor(String p_name, String p_base, int p_frame_index, Performance::MonitorType p_type, TreeItem *p_item) { +EditorPerformanceProfiler::Monitor::Monitor(const String &p_name, const String &p_base, int p_frame_index, Performance::MonitorType p_type, TreeItem *p_item) { type = p_type; item = p_item; frame_index = p_frame_index; diff --git a/editor/debugger/editor_performance_profiler.h b/editor/debugger/editor_performance_profiler.h index 6211cc39a47..4afe82b4bda 100644 --- a/editor/debugger/editor_performance_profiler.h +++ b/editor/debugger/editor_performance_profiler.h @@ -54,7 +54,7 @@ private: int frame_index = 0; Monitor(); - Monitor(String p_name, String p_base, int p_frame_index, Performance::MonitorType p_type, TreeItem *p_item); + Monitor(const String &p_name, const String &p_base, int p_frame_index, Performance::MonitorType p_type, TreeItem *p_item); void update_value(float p_value); void reset(); }; diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 93dcc341c1c..979834ebab2 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -72,7 +72,7 @@ using CameraOverride = EditorDebuggerNode::CameraOverride; -void ScriptEditorDebugger::_put_msg(String p_message, Array p_data, uint64_t p_thread_id) { +void ScriptEditorDebugger::_put_msg(const String &p_message, const Array &p_data, uint64_t p_thread_id) { ERR_FAIL_COND(p_thread_id == Thread::UNASSIGNED_ID); if (is_session_active()) { Array msg; diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h index 589e82ef25a..bd0b0c7d855 100644 --- a/editor/debugger/script_editor_debugger.h +++ b/editor/debugger/script_editor_debugger.h @@ -222,7 +222,7 @@ private: void _item_menu_id_pressed(int p_option); void _tab_changed(int p_tab); - void _put_msg(String p_message, Array p_data, uint64_t p_thread_id = Thread::MAIN_ID); + void _put_msg(const String &p_message, const Array &p_data, uint64_t p_thread_id = Thread::MAIN_ID); void _export_csv(); void _clear_execution(); diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 4d5393299cd..0e46990b417 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -382,17 +382,17 @@ void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) { add_autoload->set_disabled(false); } -void EditorAutoloadSettings::_autoload_text_submitted(const String p_name) { +void EditorAutoloadSettings::_autoload_text_submitted(const String &p_name) { if (!autoload_add_path->get_text().is_empty() && _autoload_name_is_valid(p_name, nullptr)) { _autoload_add(); } } -void EditorAutoloadSettings::_autoload_path_text_changed(const String p_path) { +void EditorAutoloadSettings::_autoload_path_text_changed(const String &p_path) { add_autoload->set_disabled(!_autoload_name_is_valid(autoload_add_name->get_text(), nullptr)); } -void EditorAutoloadSettings::_autoload_text_changed(const String p_name) { +void EditorAutoloadSettings::_autoload_text_changed(const String &p_name) { String error_string; bool is_name_valid = _autoload_name_is_valid(p_name, &error_string); add_autoload->set_disabled(!is_name_valid); diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h index cd025e0fc7d..11d7cdbe4da 100644 --- a/editor/editor_autoload_settings.h +++ b/editor/editor_autoload_settings.h @@ -83,9 +83,9 @@ class EditorAutoloadSettings : public VBoxContainer { void _autoload_edited(); void _autoload_button_pressed(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button); void _autoload_activated(); - void _autoload_path_text_changed(const String p_path); - void _autoload_text_submitted(const String p_name); - void _autoload_text_changed(const String p_name); + void _autoload_path_text_changed(const String &p_path); + void _autoload_text_submitted(const String &p_name); + void _autoload_text_changed(const String &p_name); void _autoload_open(const String &fpath); void _autoload_file_callback(const String &p_path); Node *_create_autoload(const String &p_path); diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index b4cf6d8de1e..47642c15926 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -266,7 +266,7 @@ Vector EditorData::get_handling_sub_editors(Object *p_object) { return sub_plugins; } -EditorPlugin *EditorData::get_editor_by_name(String p_name) { +EditorPlugin *EditorData::get_editor_by_name(const String &p_name) { for (int i = editor_plugins.size() - 1; i > -1; i--) { if (editor_plugins[i]->get_name() == p_name) { return editor_plugins[i]; diff --git a/editor/editor_data.h b/editor/editor_data.h index d1af400e87e..d71a2b3ed37 100644 --- a/editor/editor_data.h +++ b/editor/editor_data.h @@ -152,7 +152,7 @@ private: public: EditorPlugin *get_handling_main_editor(Object *p_object); Vector get_handling_sub_editors(Object *p_object); - EditorPlugin *get_editor_by_name(String p_name); + EditorPlugin *get_editor_by_name(const String &p_name); void copy_object_params(Object *p_object); void paste_object_params(Object *p_object); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 5021b814ea5..fa6a02f9d45 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -524,7 +524,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo return false; //nothing changed } -bool EditorFileSystem::_scan_import_support(Vector reimports) { +bool EditorFileSystem::_scan_import_support(const Vector &reimports) { if (import_support_queries.size() == 0) { return false; } @@ -1161,7 +1161,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const } } -void EditorFileSystem::_delete_internal_files(String p_file) { +void EditorFileSystem::_delete_internal_files(const String &p_file) { if (FileAccess::exists(p_file + ".import")) { List paths; ResourceFormatImporter::get_singleton()->get_internal_resource_path_list(p_file, &paths); diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index d099a6fedc0..818d7252814 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -221,7 +221,7 @@ class EditorFileSystem : public Node { void _scan_fs_changes(EditorFileSystemDirectory *p_dir, const ScanProgress &p_progress); - void _delete_internal_files(String p_file); + void _delete_internal_files(const String &p_file); HashSet textfile_extensions; HashSet valid_extensions; @@ -298,7 +298,7 @@ class EditorFileSystem : public Node { static ResourceUID::ID _resource_saver_get_resource_id_for_path(const String &p_path, bool p_generate); bool _scan_extensions(); - bool _scan_import_support(Vector reimports); + bool _scan_import_support(const Vector &reimports); Vector> import_support_queries; diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index e4a5ab86d92..02c6925f14a 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -2066,7 +2066,7 @@ void EditorInspectorArray::_new_size_spin_box_value_changed(float p_value) { resize_dialog->get_ok_button()->set_disabled(int(p_value) == count); } -void EditorInspectorArray::_new_size_spin_box_text_submitted(String p_text) { +void EditorInspectorArray::_new_size_spin_box_text_submitted(const String &p_text) { _resize_dialog_confirmed(); } @@ -2306,7 +2306,7 @@ void EditorInspectorArray::_bind_methods() { ADD_SIGNAL(MethodInfo("page_change_request")); } -void EditorInspectorArray::setup_with_move_element_function(Object *p_object, String p_label, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable, bool p_numbered, int p_page_length, const String &p_add_item_text) { +void EditorInspectorArray::setup_with_move_element_function(Object *p_object, const String &p_label, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable, bool p_numbered, int p_page_length, const String &p_add_item_text) { count_property = ""; mode = MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION; array_element_prefix = p_array_element_prefix; @@ -2320,7 +2320,7 @@ void EditorInspectorArray::setup_with_move_element_function(Object *p_object, St _setup(); } -void EditorInspectorArray::setup_with_count_property(Object *p_object, String p_label, const StringName &p_count_property, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable, bool p_numbered, int p_page_length, const String &p_add_item_text, const String &p_swap_method) { +void EditorInspectorArray::setup_with_count_property(Object *p_object, const String &p_label, const StringName &p_count_property, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable, bool p_numbered, int p_page_length, const String &p_add_item_text, const String &p_swap_method) { count_property = p_count_property; mode = MODE_USE_COUNT_PROPERTY; array_element_prefix = p_array_element_prefix; @@ -2412,7 +2412,7 @@ void EditorPaginator::_prev_page_button_pressed() { emit_signal("page_changed", MAX(0, page - 1)); } -void EditorPaginator::_page_line_edit_text_submitted(String p_text) { +void EditorPaginator::_page_line_edit_text_submitted(const String &p_text) { if (p_text.is_valid_int()) { int new_page = p_text.to_int() - 1; new_page = MIN(MAX(0, new_page), max_page); @@ -3829,7 +3829,7 @@ void EditorInspector::_property_changed(const String &p_path, const Variant &p_v } } -void EditorInspector::_multiple_properties_changed(Vector p_paths, Array p_values, bool p_changing) { +void EditorInspector::_multiple_properties_changed(const Vector &p_paths, const Array &p_values, bool p_changing) { ERR_FAIL_COND(p_paths.is_empty() || p_values.is_empty()); ERR_FAIL_COND(p_paths.size() != p_values.size()); String names; diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 0e908b7a14a..8c55950a2b4 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -406,7 +406,7 @@ class EditorInspectorArray : public EditorInspectorSection { int _drop_position() const; void _new_size_spin_box_value_changed(float p_value); - void _new_size_spin_box_text_submitted(String p_text); + void _new_size_spin_box_text_submitted(const String &p_text); void _resize_dialog_confirmed(); void _update_elements_visibility(); @@ -423,8 +423,8 @@ protected: static void _bind_methods(); public: - void setup_with_move_element_function(Object *p_object, String p_label, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable = true, bool p_numbered = false, int p_page_length = 5, const String &p_add_item_text = ""); - void setup_with_count_property(Object *p_object, String p_label, const StringName &p_count_property, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable = true, bool p_numbered = false, int p_page_length = 5, const String &p_add_item_text = "", const String &p_swap_method = ""); + void setup_with_move_element_function(Object *p_object, const String &p_label, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable = true, bool p_numbered = false, int p_page_length = 5, const String &p_add_item_text = ""); + void setup_with_count_property(Object *p_object, const String &p_label, const StringName &p_count_property, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable = true, bool p_numbered = false, int p_page_length = 5, const String &p_add_item_text = "", const String &p_swap_method = ""); VBoxContainer *get_vbox(int p_index); EditorInspectorArray(bool p_read_only); @@ -444,7 +444,7 @@ class EditorPaginator : public HBoxContainer { void _first_page_button_pressed(); void _prev_page_button_pressed(); - void _page_line_edit_text_submitted(String p_text); + void _page_line_edit_text_submitted(const String &p_text); void _next_page_button_pressed(); void _last_page_button_pressed(); @@ -520,7 +520,7 @@ class EditorInspector : public ScrollContainer { void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field); void _property_changed(const String &p_path, const Variant &p_value, const String &p_name = "", bool p_changing = false, bool p_update_all = false); - void _multiple_properties_changed(Vector p_paths, Array p_values, bool p_changing = false); + void _multiple_properties_changed(const Vector &p_paths, const Array &p_values, bool p_changing = false); void _property_keyed(const String &p_path, bool p_advance); void _property_keyed_with_value(const String &p_path, const Variant &p_value, bool p_advance); void _property_deleted(const String &p_path); diff --git a/editor/editor_log.h b/editor/editor_log.h index 03a0a071c62..601e63b9fe9 100644 --- a/editor/editor_log.h +++ b/editor/editor_log.h @@ -64,7 +64,7 @@ private: LogMessage() {} - LogMessage(const String p_text, MessageType p_type, bool p_clear) : + LogMessage(const String &p_text, MessageType p_type, bool p_clear) : text(p_text), type(p_type), clear(p_clear) { diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 0517abac2be..73a0768a72e 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -254,7 +254,7 @@ void EditorPropertyTextEnum::_set_read_only(bool p_read_only) { edit_button->set_disabled(p_read_only); } -void EditorPropertyTextEnum::_emit_changed_value(String p_string) { +void EditorPropertyTextEnum::_emit_changed_value(const String &p_string) { if (string_name) { emit_changed(get_edited_property(), StringName(p_string)); } else { @@ -272,7 +272,7 @@ void EditorPropertyTextEnum::_edit_custom_value() { custom_value_edit->grab_focus(); } -void EditorPropertyTextEnum::_custom_value_submitted(String p_value) { +void EditorPropertyTextEnum::_custom_value_submitted(const String &p_value) { edit_custom_layout->hide(); default_layout->show(); @@ -2897,7 +2897,7 @@ void EditorPropertyNodePath::update_property() { assign->set_icon(EditorNode::get_singleton()->get_object_icon(target_node, "Node")); } -void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector p_valid_types, bool p_use_path_from_scene_root, bool p_editing_node) { +void EditorPropertyNodePath::setup(const NodePath &p_base_hint, const Vector &p_valid_types, bool p_use_path_from_scene_root, bool p_editing_node) { base_hint = p_base_hint; valid_types = p_valid_types; editing_node = p_editing_node; diff --git a/editor/editor_properties.h b/editor/editor_properties.h index b7ae4bd1caf..fa759d5d19d 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -116,11 +116,11 @@ class EditorPropertyTextEnum : public EditorProperty { bool string_name = false; bool loose_mode = false; - void _emit_changed_value(String p_string); + void _emit_changed_value(const String &p_string); void _option_selected(int p_which); void _edit_custom_value(); - void _custom_value_submitted(String p_value); + void _custom_value_submitted(const String &p_value); void _custom_value_accepted(); void _custom_value_canceled(); @@ -677,7 +677,7 @@ protected: public: virtual void update_property() override; - void setup(const NodePath &p_base_hint, Vector p_valid_types, bool p_use_path_from_scene_root = true, bool p_editing_node = false); + void setup(const NodePath &p_base_hint, const Vector &p_valid_types, bool p_use_path_from_scene_root = true, bool p_editing_node = false); EditorPropertyNodePath(); }; diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 2d11c2e2d12..8a15f4912a8 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -1287,7 +1287,7 @@ EditorPropertyDictionary::EditorPropertyDictionary() { ///////////////////// LOCALIZABLE STRING /////////////////////////// -void EditorPropertyLocalizableString::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) { +void EditorPropertyLocalizableString::_property_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) { if (p_property.begins_with("indices")) { int index = p_property.get_slice("/", 1).to_int(); diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h index f157da00c20..0e81a0fae35 100644 --- a/editor/editor_properties_array_dict.h +++ b/editor/editor_properties_array_dict.h @@ -214,7 +214,7 @@ class EditorPropertyLocalizableString : public EditorProperty { void _page_changed(int p_page); void _edit_pressed(); void _remove_item(Object *p_button, int p_index); - void _property_changed(const String &p_property, Variant p_value, const String &p_name = "", bool p_changing = false); + void _property_changed(const String &p_property, const Variant &p_value, const String &p_name = "", bool p_changing = false); void _add_locale_popup(); void _add_locale(const String &p_locale); diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 95436427ad3..963ddb63293 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -654,7 +654,7 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const { return false; } -bool EditorResourcePicker::_is_type_valid(const String p_type_name, const HashSet &p_allowed_types) const { +bool EditorResourcePicker::_is_type_valid(const String &p_type_name, const HashSet &p_allowed_types) const { for (const StringName &E : p_allowed_types) { String at = E; if (p_type_name == at || ClassDB::is_parent_class(p_type_name, at) || EditorNode::get_editor_data().script_class_is_parent(p_type_name, at)) { diff --git a/editor/editor_resource_picker.h b/editor/editor_resource_picker.h index fb54455e893..8146c02dff3 100644 --- a/editor/editor_resource_picker.h +++ b/editor/editor_resource_picker.h @@ -99,7 +99,7 @@ class EditorResourcePicker : public HBoxContainer { String _get_resource_type(const Ref &p_resource) const; void _get_allowed_types(bool p_with_convert, HashSet *p_vector) const; bool _is_drop_valid(const Dictionary &p_drag_data) const; - bool _is_type_valid(const String p_type_name, const HashSet &p_allowed_types) const; + bool _is_type_valid(const String &p_type_name, const HashSet &p_allowed_types) const; Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index fc1dda9669d..94bf15ae663 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -351,7 +351,7 @@ void EditorResourcePreview::_iterate() { _preview_ready(item.path, 0, texture, small_texture, item.id, item.function, item.userdata, preview_metadata); } -void EditorResourcePreview::_write_preview_cache(Ref p_file, int p_thumbnail_size, bool p_has_small_texture, uint64_t p_modified_time, String p_hash, const Dictionary &p_metadata) { +void EditorResourcePreview::_write_preview_cache(Ref p_file, int p_thumbnail_size, bool p_has_small_texture, uint64_t p_modified_time, const String &p_hash, const Dictionary &p_metadata) { p_file->store_line(itos(p_thumbnail_size)); p_file->store_line(itos(p_has_small_texture)); p_file->store_line(itos(p_modified_time)); diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h index 3cad56f75e8..84616517324 100644 --- a/editor/editor_resource_preview.h +++ b/editor/editor_resource_preview.h @@ -117,7 +117,7 @@ class EditorResourcePreview : public Node { static void _idle_callback(); // For other rendering drivers (i.e., OpenGL). void _iterate(); - void _write_preview_cache(Ref p_file, int p_thumbnail_size, bool p_has_small_texture, uint64_t p_modified_time, String p_hash, const Dictionary &p_metadata); + void _write_preview_cache(Ref p_file, int p_thumbnail_size, bool p_has_small_texture, uint64_t p_modified_time, const String &p_hash, const Dictionary &p_metadata); void _read_preview_cache(Ref p_file, int *r_thumbnail_size, bool *r_has_small_texture, uint64_t *r_modified_time, String *r_hash, Dictionary *r_metadata); Vector> preview_generators; diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 853a4cd410e..199fa3f6c91 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -934,7 +934,7 @@ void EditorSettings::_load_default_visual_shader_editor_theme() { _initial_set("editors/visual_editors/category_colors/particle_color", Color(0.12, 0.358, 0.8)); } -bool EditorSettings::_save_text_editor_theme(String p_file) { +bool EditorSettings::_save_text_editor_theme(const String &p_file) { String theme_section = "color_theme"; Ref cf = memnew(ConfigFile); // hex is better? @@ -957,7 +957,7 @@ bool EditorSettings::_save_text_editor_theme(String p_file) { return err == OK; } -bool EditorSettings::_is_default_text_editor_theme(String p_theme_name) { +bool EditorSettings::_is_default_text_editor_theme(const String &p_theme_name) { return p_theme_name == "default" || p_theme_name == "godot 2" || p_theme_name == "custom"; } @@ -1251,7 +1251,7 @@ void EditorSettings::add_property_hint(const PropertyInfo &p_hint) { // Metadata -void EditorSettings::set_project_metadata(const String &p_section, const String &p_key, Variant p_data) { +void EditorSettings::set_project_metadata(const String &p_section, const String &p_key, const Variant &p_data) { const String path = _get_project_metadata_path(); if (project_metadata.is_null()) { @@ -1268,7 +1268,7 @@ void EditorSettings::set_project_metadata(const String &p_section, const String ERR_FAIL_COND_MSG(err != OK, "Cannot save project metadata to file '" + path + "'."); } -Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, Variant p_default) const { +Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, const Variant &p_default) const { if (project_metadata.is_null()) { project_metadata.instantiate(); @@ -1409,7 +1409,7 @@ void EditorSettings::load_text_editor_theme() { // if it doesn't load just use what is currently loaded } -bool EditorSettings::import_text_editor_theme(String p_file) { +bool EditorSettings::import_text_editor_theme(const String &p_file) { if (!p_file.ends_with(".tet")) { return false; } else { diff --git a/editor/editor_settings.h b/editor/editor_settings.h index 5783bac7706..4995558e2b9 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -111,8 +111,8 @@ private: void _load_defaults(Ref p_extra_config = Ref()); void _load_godot2_text_editor_theme(); void _load_default_visual_shader_editor_theme(); - bool _save_text_editor_theme(String p_file); - bool _is_default_text_editor_theme(String p_theme_name); + bool _save_text_editor_theme(const String &p_file); + bool _is_default_text_editor_theme(const String &p_theme_name); const String _get_project_metadata_path() const; protected: @@ -155,8 +155,8 @@ public: void set_resource_clipboard(const Ref &p_resource) { clipboard = p_resource; } Ref get_resource_clipboard() const { return clipboard; } - void set_project_metadata(const String &p_section, const String &p_key, Variant p_data); - Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default) const; + void set_project_metadata(const String &p_section, const String &p_key, const Variant &p_data); + Variant get_project_metadata(const String &p_section, const String &p_key, const Variant &p_default) const; void set_favorites(const Vector &p_favorites); Vector get_favorites() const; @@ -166,7 +166,7 @@ public: void list_text_editor_themes(); void load_text_editor_theme(); - bool import_text_editor_theme(String p_file); + bool import_text_editor_theme(const String &p_file); bool save_text_editor_theme(); bool save_text_editor_theme_as(String p_file); bool is_default_text_editor_theme(); diff --git a/editor/editor_vcs_interface.cpp b/editor/editor_vcs_interface.cpp index 1f76c946558..7d39dc8715a 100644 --- a/editor/editor_vcs_interface.cpp +++ b/editor/editor_vcs_interface.cpp @@ -34,18 +34,18 @@ EditorVCSInterface *EditorVCSInterface::singleton = nullptr; -void EditorVCSInterface::popup_error(String p_msg) { +void EditorVCSInterface::popup_error(const String &p_msg) { // TRANSLATORS: %s refers to the name of a version control system (e.g. "Git"). EditorNode::get_singleton()->show_warning(p_msg.strip_edges(), vformat(TTR("%s Error"), get_vcs_name())); } -bool EditorVCSInterface::initialize(String p_project_path) { +bool EditorVCSInterface::initialize(const String &p_project_path) { bool result = false; GDVIRTUAL_REQUIRED_CALL(_initialize, p_project_path, result); return result; } -void EditorVCSInterface::set_credentials(String p_username, String p_password, String p_ssh_public_key, String p_ssh_private_key, String p_ssh_passphrase) { +void EditorVCSInterface::set_credentials(const String &p_username, const String &p_password, const String &p_ssh_public_key, const String &p_ssh_private_key, const String &p_ssh_passphrase) { GDVIRTUAL_REQUIRED_CALL(_set_credentials, p_username, p_password, p_ssh_public_key, p_ssh_private_key, p_ssh_passphrase); } @@ -75,23 +75,23 @@ List EditorVCSInterface::get_modified_files_data return status_files; } -void EditorVCSInterface::stage_file(String p_file_path) { +void EditorVCSInterface::stage_file(const String &p_file_path) { GDVIRTUAL_REQUIRED_CALL(_stage_file, p_file_path); } -void EditorVCSInterface::unstage_file(String p_file_path) { +void EditorVCSInterface::unstage_file(const String &p_file_path) { GDVIRTUAL_REQUIRED_CALL(_unstage_file, p_file_path); } -void EditorVCSInterface::discard_file(String p_file_path) { +void EditorVCSInterface::discard_file(const String &p_file_path) { GDVIRTUAL_REQUIRED_CALL(_discard_file, p_file_path); } -void EditorVCSInterface::commit(String p_msg) { +void EditorVCSInterface::commit(const String &p_msg) { GDVIRTUAL_REQUIRED_CALL(_commit, p_msg); } -List EditorVCSInterface::get_diff(String p_identifier, TreeArea p_area) { +List EditorVCSInterface::get_diff(const String &p_identifier, TreeArea p_area) { TypedArray result; if (!GDVIRTUAL_REQUIRED_CALL(_get_diff, p_identifier, int(p_area), result)) { return {}; @@ -130,19 +130,19 @@ List EditorVCSInterface::get_branch_list() { return branch_list; } -void EditorVCSInterface::create_branch(String p_branch_name) { +void EditorVCSInterface::create_branch(const String &p_branch_name) { GDVIRTUAL_REQUIRED_CALL(_create_branch, p_branch_name); } -void EditorVCSInterface::create_remote(String p_remote_name, String p_remote_url) { +void EditorVCSInterface::create_remote(const String &p_remote_name, const String &p_remote_url) { GDVIRTUAL_REQUIRED_CALL(_create_remote, p_remote_name, p_remote_url); } -void EditorVCSInterface::remove_branch(String p_branch_name) { +void EditorVCSInterface::remove_branch(const String &p_branch_name) { GDVIRTUAL_REQUIRED_CALL(_remove_branch, p_branch_name); } -void EditorVCSInterface::remove_remote(String p_remote_name) { +void EditorVCSInterface::remove_remote(const String &p_remote_name) { GDVIRTUAL_REQUIRED_CALL(_remove_remote, p_remote_name); } @@ -152,25 +152,25 @@ String EditorVCSInterface::get_current_branch_name() { return result; } -bool EditorVCSInterface::checkout_branch(String p_branch_name) { +bool EditorVCSInterface::checkout_branch(const String &p_branch_name) { bool result = false; GDVIRTUAL_REQUIRED_CALL(_checkout_branch, p_branch_name, result); return result; } -void EditorVCSInterface::pull(String p_remote) { +void EditorVCSInterface::pull(const String &p_remote) { GDVIRTUAL_REQUIRED_CALL(_pull, p_remote); } -void EditorVCSInterface::push(String p_remote, bool p_force) { +void EditorVCSInterface::push(const String &p_remote, bool p_force) { GDVIRTUAL_REQUIRED_CALL(_push, p_remote, p_force); } -void EditorVCSInterface::fetch(String p_remote) { +void EditorVCSInterface::fetch(const String &p_remote) { GDVIRTUAL_REQUIRED_CALL(_fetch, p_remote); } -List EditorVCSInterface::get_line_diff(String p_file_path, String p_text) { +List EditorVCSInterface::get_line_diff(const String &p_file_path, const String &p_text) { TypedArray result; if (!GDVIRTUAL_REQUIRED_CALL(_get_line_diff, p_file_path, p_text, result)) { return {}; @@ -195,7 +195,7 @@ String EditorVCSInterface::get_vcs_name() { return result; } -Dictionary EditorVCSInterface::create_diff_line(int p_new_line_no, int p_old_line_no, String p_content, String p_status) { +Dictionary EditorVCSInterface::create_diff_line(int p_new_line_no, int p_old_line_no, const String &p_content, const String &p_status) { Dictionary diff_line; diff_line["new_line_no"] = p_new_line_no; diff_line["old_line_no"] = p_old_line_no; @@ -220,7 +220,7 @@ Dictionary EditorVCSInterface::add_line_diffs_into_diff_hunk(Dictionary p_diff_h return p_diff_hunk; } -Dictionary EditorVCSInterface::create_diff_file(String p_new_file, String p_old_file) { +Dictionary EditorVCSInterface::create_diff_file(const String &p_new_file, const String &p_old_file) { Dictionary file_diff; file_diff["new_file"] = p_new_file; file_diff["old_file"] = p_old_file; @@ -228,7 +228,7 @@ Dictionary EditorVCSInterface::create_diff_file(String p_new_file, String p_old_ return file_diff; } -Dictionary EditorVCSInterface::create_commit(String p_msg, String p_author, String p_id, int64_t p_unix_timestamp, int64_t p_offset_minutes) { +Dictionary EditorVCSInterface::create_commit(const String &p_msg, const String &p_author, const String &p_id, int64_t p_unix_timestamp, int64_t p_offset_minutes) { Dictionary commit_info; commit_info["message"] = p_msg; commit_info["author"] = p_author; @@ -243,7 +243,7 @@ Dictionary EditorVCSInterface::add_diff_hunks_into_diff_file(Dictionary p_diff_f return p_diff_file; } -Dictionary EditorVCSInterface::create_status_file(String p_file_path, ChangeType p_change, TreeArea p_area) { +Dictionary EditorVCSInterface::create_status_file(const String &p_file_path, ChangeType p_change, TreeArea p_area) { Dictionary sf; sf["file_path"] = p_file_path; sf["change_type"] = p_change; @@ -251,7 +251,7 @@ Dictionary EditorVCSInterface::create_status_file(String p_file_path, ChangeType return sf; } -EditorVCSInterface::DiffLine EditorVCSInterface::_convert_diff_line(Dictionary p_diff_line) { +EditorVCSInterface::DiffLine EditorVCSInterface::_convert_diff_line(const Dictionary &p_diff_line) { DiffLine d; d.new_line_no = p_diff_line["new_line_no"]; d.old_line_no = p_diff_line["old_line_no"]; @@ -260,7 +260,7 @@ EditorVCSInterface::DiffLine EditorVCSInterface::_convert_diff_line(Dictionary p return d; } -EditorVCSInterface::DiffHunk EditorVCSInterface::_convert_diff_hunk(Dictionary p_diff_hunk) { +EditorVCSInterface::DiffHunk EditorVCSInterface::_convert_diff_hunk(const Dictionary &p_diff_hunk) { DiffHunk dh; dh.new_lines = p_diff_hunk["new_lines"]; dh.old_lines = p_diff_hunk["old_lines"]; @@ -274,7 +274,7 @@ EditorVCSInterface::DiffHunk EditorVCSInterface::_convert_diff_hunk(Dictionary p return dh; } -EditorVCSInterface::DiffFile EditorVCSInterface::_convert_diff_file(Dictionary p_diff_file) { +EditorVCSInterface::DiffFile EditorVCSInterface::_convert_diff_file(const Dictionary &p_diff_file) { DiffFile df; df.new_file = p_diff_file["new_file"]; df.old_file = p_diff_file["old_file"]; @@ -286,7 +286,7 @@ EditorVCSInterface::DiffFile EditorVCSInterface::_convert_diff_file(Dictionary p return df; } -EditorVCSInterface::Commit EditorVCSInterface::_convert_commit(Dictionary p_commit) { +EditorVCSInterface::Commit EditorVCSInterface::_convert_commit(const Dictionary &p_commit) { EditorVCSInterface::Commit c; c.msg = p_commit["message"]; c.author = p_commit["author"]; @@ -296,7 +296,7 @@ EditorVCSInterface::Commit EditorVCSInterface::_convert_commit(Dictionary p_comm return c; } -EditorVCSInterface::StatusFile EditorVCSInterface::_convert_status_file(Dictionary p_status_file) { +EditorVCSInterface::StatusFile EditorVCSInterface::_convert_status_file(const Dictionary &p_status_file) { StatusFile sf; sf.file_path = p_status_file["file_path"]; sf.change_type = (ChangeType)(int)p_status_file["change_type"]; diff --git a/editor/editor_vcs_interface.h b/editor/editor_vcs_interface.h index 84f2cf92818..8fcd45756a0 100644 --- a/editor/editor_vcs_interface.h +++ b/editor/editor_vcs_interface.h @@ -99,11 +99,11 @@ protected: static void _bind_methods(); - DiffLine _convert_diff_line(Dictionary p_diff_line); - DiffHunk _convert_diff_hunk(Dictionary p_diff_hunk); - DiffFile _convert_diff_file(Dictionary p_diff_file); - Commit _convert_commit(Dictionary p_commit); - StatusFile _convert_status_file(Dictionary p_status_file); + DiffLine _convert_diff_line(const Dictionary &p_diff_line); + DiffHunk _convert_diff_hunk(const Dictionary &p_diff_hunk); + DiffFile _convert_diff_file(const Dictionary &p_diff_file); + Commit _convert_commit(const Dictionary &p_commit); + StatusFile _convert_status_file(const Dictionary &p_status_file); // Proxy endpoints for extensions to implement GDVIRTUAL1R(bool, _initialize, String); @@ -141,40 +141,40 @@ public: static void create_vcs_metadata_files(VCSMetadata p_vcs_metadata_type, String &p_dir); // Proxies to the editor for use - bool initialize(String p_project_path); - void set_credentials(String p_username, String p_password, String p_ssh_public_key_path, String p_ssh_private_key_path, String p_ssh_passphrase); + bool initialize(const String &p_project_path); + void set_credentials(const String &p_username, const String &p_password, const String &p_ssh_public_key_path, const String &p_ssh_private_key_path, const String &p_ssh_passphrase); List get_modified_files_data(); - void stage_file(String p_file_path); - void unstage_file(String p_file_path); - void discard_file(String p_file_path); - void commit(String p_msg); - List get_diff(String p_identifier, TreeArea p_area); + void stage_file(const String &p_file_path); + void unstage_file(const String &p_file_path); + void discard_file(const String &p_file_path); + void commit(const String &p_msg); + List get_diff(const String &p_identifier, TreeArea p_area); bool shut_down(); String get_vcs_name(); List get_previous_commits(int p_max_commits); List get_branch_list(); List get_remotes(); - void create_branch(String p_branch_name); - void remove_branch(String p_branch_name); - void create_remote(String p_remote_name, String p_remote_url); - void remove_remote(String p_remote_name); + void create_branch(const String &p_branch_name); + void remove_branch(const String &p_branch_name); + void create_remote(const String &p_remote_name, const String &p_remote_url); + void remove_remote(const String &p_remote_name); String get_current_branch_name(); - bool checkout_branch(String p_branch_name); - void pull(String p_remote); - void push(String p_remote, bool p_force); - void fetch(String p_remote); - List get_line_diff(String p_file_path, String p_text); + bool checkout_branch(const String &p_branch_name); + void pull(const String &p_remote); + void push(const String &p_remote, bool p_force); + void fetch(const String &p_remote); + List get_line_diff(const String &p_file_path, const String &p_text); // Helper functions to create and convert Dictionary into data structures - Dictionary create_diff_line(int p_new_line_no, int p_old_line_no, String p_content, String p_status); + Dictionary create_diff_line(int p_new_line_no, int p_old_line_no, const String &p_content, const String &p_status); Dictionary create_diff_hunk(int p_old_start, int p_new_start, int p_old_lines, int p_new_lines); - Dictionary create_diff_file(String p_new_file, String p_old_file); - Dictionary create_commit(String p_msg, String p_author, String p_id, int64_t p_unix_timestamp, int64_t p_offset_minutes); - Dictionary create_status_file(String p_file_path, ChangeType p_change, TreeArea p_area); + Dictionary create_diff_file(const String &p_new_file, const String &p_old_file); + Dictionary create_commit(const String &p_msg, const String &p_author, const String &p_id, int64_t p_unix_timestamp, int64_t p_offset_minutes); + Dictionary create_status_file(const String &p_file_path, ChangeType p_change, TreeArea p_area); Dictionary add_line_diffs_into_diff_hunk(Dictionary p_diff_hunk, TypedArray p_line_diffs); Dictionary add_diff_hunks_into_diff_file(Dictionary p_diff_file, TypedArray p_diff_hunks); - void popup_error(String p_msg); + void popup_error(const String &p_msg); }; VARIANT_ENUM_CAST(EditorVCSInterface::ChangeType); diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index 9d65821ccdc..b9dc52511e6 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -329,7 +329,7 @@ Ref EditorExportPlatform::get_option_icon(int p_index) const { } } -String EditorExportPlatform::find_export_template(String template_file_name, String *err) const { +String EditorExportPlatform::find_export_template(const String &template_file_name, String *err) const { String current_version = VERSION_FULL_CONFIG; String template_path = EditorPaths::get_singleton()->get_export_templates_dir().path_join(current_version).path_join(template_file_name); @@ -344,7 +344,7 @@ String EditorExportPlatform::find_export_template(String template_file_name, Str return String(); } -bool EditorExportPlatform::exists_export_template(String template_file_name, String *err) const { +bool EditorExportPlatform::exists_export_template(const String &template_file_name, String *err) const { return find_export_template(template_file_name, err) != ""; } diff --git a/editor/export/editor_export_platform.h b/editor/export/editor_export_platform.h index 8f2288d409f..26e1f86c8b8 100644 --- a/editor/export/editor_export_platform.h +++ b/editor/export/editor_export_platform.h @@ -132,8 +132,8 @@ protected: HashSet get_features(const Ref &p_preset, bool p_debug) const; - bool exists_export_template(String template_file_name, String *err) const; - String find_export_template(String template_file_name, String *err = nullptr) const; + bool exists_export_template(const String &template_file_name, String *err) const; + String find_export_template(const String &template_file_name, String *err = nullptr) const; void gen_export_flags(Vector &r_flags, int p_flags); void gen_debug_flags(Vector &r_flags, int p_flags); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 0356d0d3ad6..a7e40ce5b9b 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -80,7 +80,7 @@ Control *FileSystemList::make_custom_tooltip(const String &p_text) const { return FileSystemDock::get_singleton()->create_tooltip_for_path(get_item_metadata(idx)); } -void FileSystemList::_line_editor_submit(String p_text) { +void FileSystemList::_line_editor_submit(const String &p_text) { popup_editor->hide(); emit_signal(SNAME("item_edited")); @@ -173,7 +173,7 @@ FileSystemList::FileSystemList() { FileSystemDock *FileSystemDock::singleton = nullptr; -Ref FileSystemDock::_get_tree_item_icon(bool p_is_valid, String p_file_type) { +Ref FileSystemDock::_get_tree_item_icon(bool p_is_valid, const String &p_file_type) { Ref file_icon; if (!p_is_valid) { file_icon = get_editor_theme_icon(SNAME("ImportFail")); @@ -1678,7 +1678,7 @@ void FileSystemDock::_resource_removed(const Ref &p_resource) { emit_signal(SNAME("resource_removed"), p_resource); } -void FileSystemDock::_file_removed(String p_file) { +void FileSystemDock::_file_removed(const String &p_file) { emit_signal(SNAME("file_removed"), p_file); // Find the closest parent directory available, in case multiple items were deleted along the same path. @@ -1691,7 +1691,7 @@ void FileSystemDock::_file_removed(String p_file) { current_path_line_edit->set_text(current_path); } -void FileSystemDock::_folder_removed(String p_folder) { +void FileSystemDock::_folder_removed(const String &p_folder) { emit_signal(SNAME("folder_removed"), p_folder); // Find the closest parent directory available, in case multiple items were deleted along the same path. @@ -2986,7 +2986,7 @@ void FileSystemDock::_folder_color_index_pressed(int p_index, PopupMenu *p_menu) _update_file_list(true); } -void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector p_paths, bool p_display_path_dependent_options) { +void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vector &p_paths, bool p_display_path_dependent_options) { // Add options for files and folders. ERR_FAIL_COND_MSG(p_paths.is_empty(), "Path cannot be empty."); diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index c9d2bc535ee..06bf3eda522 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -64,7 +64,7 @@ class FileSystemList : public ItemList { LineEdit *line_editor = nullptr; virtual Control *make_custom_tooltip(const String &p_text) const override; - void _line_editor_submit(String p_text); + void _line_editor_submit(const String &p_text); void _text_editor_popup_modal_close(); protected: @@ -245,7 +245,7 @@ private: void _tree_mouse_exited(); void _reselect_items_selected_on_drag_begin(bool reset = false); - Ref _get_tree_item_icon(bool p_is_valid, String p_file_type); + Ref _get_tree_item_icon(bool p_is_valid, const String &p_file_type); bool _create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector &uncollapsed_paths, bool p_select_in_favorites, bool p_unfold_path = false); void _update_tree(const Vector &p_uncollapsed_paths = Vector(), bool p_uncollapse_root = false, bool p_select_in_favorites = false, bool p_unfold_path = false); void _navigate_to_path(const String &p_path, bool p_select_in_favorites = false); @@ -281,8 +281,8 @@ private: void _update_folder_colors_setting(); void _resource_removed(const Ref &p_resource); - void _file_removed(String p_file); - void _folder_removed(String p_folder); + void _file_removed(const String &p_file); + void _folder_removed(const String &p_folder); void _resource_created(); void _make_scene_confirm(); @@ -313,7 +313,7 @@ private: void _file_sort_popup(int p_id); void _folder_color_index_pressed(int p_index, PopupMenu *p_menu); - void _file_and_folders_fill_popup(PopupMenu *p_popup, Vector p_paths, bool p_display_path_dependent_options = true); + void _file_and_folders_fill_popup(PopupMenu *p_popup, const Vector &p_paths, bool p_display_path_dependent_options = true); void _tree_rmb_select(const Vector2 &p_pos, MouseButton p_button); void _file_list_item_clicked(int p_item, const Vector2 &p_pos, MouseButton p_mouse_button_index); void _file_list_empty_clicked(const Vector2 &p_pos, MouseButton p_mouse_button_index); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index c6087f5b13f..6d690cf31b5 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -55,7 +55,7 @@ inline void pop_back(T &container) { container.resize(container.size() - 1); } -static bool find_next(const String &line, String pattern, int from, bool match_case, bool whole_words, int &out_begin, int &out_end) { +static bool find_next(const String &line, const String &pattern, int from, bool match_case, bool whole_words, int &out_begin, int &out_end) { int end = from; while (true) { @@ -84,7 +84,7 @@ static bool find_next(const String &line, String pattern, int from, bool match_c //-------------------------------------------------------------------------------- -void FindInFiles::set_search_text(String p_pattern) { +void FindInFiles::set_search_text(const String &p_pattern) { _pattern = p_pattern; } @@ -96,7 +96,7 @@ void FindInFiles::set_match_case(bool p_match_case) { _match_case = p_match_case; } -void FindInFiles::set_folder(String folder) { +void FindInFiles::set_folder(const String &folder) { _root_dir = folder; } @@ -213,7 +213,7 @@ float FindInFiles::get_progress() const { return 0; } -void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders, PackedStringArray &out_files_to_scan) { +void FindInFiles::_scan_dir(const String &path, PackedStringArray &out_folders, PackedStringArray &out_files_to_scan) { Ref dir = DirAccess::open(path); if (dir.is_null()) { print_verbose("Cannot open directory! " + path); @@ -258,7 +258,7 @@ void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders, PackedS } } -void FindInFiles::_scan_file(String fpath) { +void FindInFiles::_scan_file(const String &fpath) { Ref f = FileAccess::open(fpath, FileAccess::READ); if (f.is_null()) { print_verbose(String("Cannot open file ") + fpath); @@ -397,12 +397,12 @@ FindInFilesDialog::FindInFilesDialog() { _mode = SEARCH_MODE; } -void FindInFilesDialog::set_search_text(String text) { +void FindInFilesDialog::set_search_text(const String &text) { _search_text_line_edit->set_text(text); _on_search_text_modified(text); } -void FindInFilesDialog::set_replace_text(String text) { +void FindInFilesDialog::set_replace_text(const String &text) { _replace_text_line_edit->set_text(text); } @@ -505,7 +505,7 @@ void FindInFilesDialog::custom_action(const String &p_action) { } } -void FindInFilesDialog::_on_search_text_modified(String text) { +void FindInFilesDialog::_on_search_text_modified(const String &text) { ERR_FAIL_NULL(_find_button); ERR_FAIL_NULL(_replace_button); @@ -513,7 +513,7 @@ void FindInFilesDialog::_on_search_text_modified(String text) { _replace_button->set_disabled(get_search_text().is_empty()); } -void FindInFilesDialog::_on_search_text_submitted(String text) { +void FindInFilesDialog::_on_search_text_submitted(const String &text) { // This allows to trigger a global search without leaving the keyboard. if (!_find_button->is_disabled()) { if (_mode == SEARCH_MODE) { @@ -528,7 +528,7 @@ void FindInFilesDialog::_on_search_text_submitted(String text) { } } -void FindInFilesDialog::_on_replace_text_submitted(String text) { +void FindInFilesDialog::_on_replace_text_submitted(const String &text) { // This allows to trigger a global search without leaving the keyboard. if (!_replace_button->is_disabled()) { if (_mode == REPLACE_MODE) { @@ -653,7 +653,7 @@ void FindInFilesPanel::set_with_replace(bool with_replace) { } } -void FindInFilesPanel::set_replace_text(String text) { +void FindInFilesPanel::set_replace_text(const String &text) { _replace_line_edit->set_text(text); } @@ -710,7 +710,7 @@ void FindInFilesPanel::_notification(int p_what) { } } -void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin, int end, String text) { +void FindInFilesPanel::_on_result_found(const String &fpath, int line_number, int begin, int end, String text) { TreeItem *file_item; HashMap::Iterator E = _file_items.find(fpath); @@ -844,7 +844,7 @@ void FindInFilesPanel::_on_result_selected() { emit_signal(SNAME(SIGNAL_RESULT_SELECTED), fpath, r.line_number, r.begin, r.end); } -void FindInFilesPanel::_on_replace_text_changed(String text) { +void FindInFilesPanel::_on_replace_text_changed(const String &text) { update_replace_buttons(); } @@ -914,7 +914,7 @@ private: Vector _line_buffer; }; -void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector &locations, String new_text) { +void FindInFilesPanel::apply_replaces_in_file(const String &fpath, const Vector &locations, const String &new_text) { // If the file is already open, I assume the editor will reload it. // If there are unsaved changes, the user will be asked on focus, // however that means either losing changes or losing replaces. diff --git a/editor/find_in_files.h b/editor/find_in_files.h index fcf5dd62818..78859315147 100644 --- a/editor/find_in_files.h +++ b/editor/find_in_files.h @@ -42,10 +42,10 @@ public: static const char *SIGNAL_RESULT_FOUND; static const char *SIGNAL_FINISHED; - void set_search_text(String p_pattern); + void set_search_text(const String &p_pattern); void set_whole_words(bool p_whole_word); void set_match_case(bool p_match_case); - void set_folder(String folder); + void set_folder(const String &folder); void set_filter(const HashSet &exts); String get_search_text() const { return _pattern; } @@ -67,8 +67,8 @@ protected: private: void _process(); void _iterate(); - void _scan_dir(String path, PackedStringArray &out_folders, PackedStringArray &out_files_to_scan); - void _scan_file(String fpath); + void _scan_dir(const String &path, PackedStringArray &out_folders, PackedStringArray &out_files_to_scan); + void _scan_file(const String &fpath); // Config String _pattern; @@ -105,8 +105,8 @@ public: FindInFilesDialog(); - void set_search_text(String text); - void set_replace_text(String text); + void set_search_text(const String &text); + void set_replace_text(const String &text); void set_find_in_files_mode(FindInFilesMode p_mode); @@ -127,9 +127,9 @@ protected: private: void _on_folder_button_pressed(); void _on_folder_selected(String path); - void _on_search_text_modified(String text); - void _on_search_text_submitted(String text); - void _on_replace_text_submitted(String text); + void _on_search_text_modified(const String &text); + void _on_search_text_submitted(const String &text); + void _on_replace_text_submitted(const String &text); FindInFilesMode _mode; LineEdit *_search_text_line_edit = nullptr; @@ -165,7 +165,7 @@ public: FindInFiles *get_finder() const { return _finder; } void set_with_replace(bool with_replace); - void set_replace_text(String text); + void set_replace_text(const String &text); void start_search(); void stop_search(); @@ -176,13 +176,13 @@ protected: void _notification(int p_what); private: - void _on_result_found(String fpath, int line_number, int begin, int end, String text); + void _on_result_found(const String &fpath, int line_number, int begin, int end, String text); void _on_finished(); void _on_refresh_button_clicked(); void _on_cancel_button_clicked(); void _on_result_selected(); void _on_item_edited(); - void _on_replace_text_changed(String text); + void _on_replace_text_changed(const String &text); void _on_replace_all_clicked(); struct Result { @@ -192,7 +192,7 @@ private: int begin_trimmed = 0; }; - void apply_replaces_in_file(String fpath, const Vector &locations, String new_text); + void apply_replaces_in_file(const String &fpath, const Vector &locations, const String &new_text); void update_replace_buttons(); String get_replace_text(); diff --git a/editor/gui/editor_file_dialog.cpp b/editor/gui/editor_file_dialog.cpp index 2dada257280..c7e991c353c 100644 --- a/editor/gui/editor_file_dialog.cpp +++ b/editor/gui/editor_file_dialog.cpp @@ -287,7 +287,7 @@ void EditorFileDialog::update_dir() { } } -void EditorFileDialog::_dir_submitted(String p_dir) { +void EditorFileDialog::_dir_submitted(const String &p_dir) { dir_access->change_dir(p_dir); invalidate(); update_dir(); diff --git a/editor/gui/editor_file_dialog.h b/editor/gui/editor_file_dialog.h index e0f53ace969..a9073e6f4ad 100644 --- a/editor/gui/editor_file_dialog.h +++ b/editor/gui/editor_file_dialog.h @@ -199,7 +199,7 @@ private: void _item_menu_id_pressed(int p_option); void _select_drive(int p_idx); - void _dir_submitted(String p_dir); + void _dir_submitted(const String &p_dir); void _action_pressed(); void _save_confirm_pressed(); void _cancel_pressed(); diff --git a/editor/gui/editor_toaster.cpp b/editor/gui/editor_toaster.cpp index 69a129e73ca..970bf4cb3e5 100644 --- a/editor/gui/editor_toaster.cpp +++ b/editor/gui/editor_toaster.cpp @@ -342,7 +342,7 @@ void EditorToaster::_repop_old() { } } -Control *EditorToaster::popup(Control *p_control, Severity p_severity, double p_time, String p_tooltip) { +Control *EditorToaster::popup(Control *p_control, Severity p_severity, double p_time, const String &p_tooltip) { // Create the panel according to the severity. PanelContainer *panel = memnew(PanelContainer); panel->set_tooltip_text(p_tooltip); @@ -398,7 +398,7 @@ Control *EditorToaster::popup(Control *p_control, Severity p_severity, double p_ return panel; } -void EditorToaster::popup_str(String p_message, Severity p_severity, String p_tooltip) { +void EditorToaster::popup_str(const String &p_message, Severity p_severity, const String &p_tooltip) { if (is_processing_error) { return; } @@ -410,7 +410,7 @@ void EditorToaster::popup_str(String p_message, Severity p_severity, String p_to is_processing_error = false; } -void EditorToaster::_popup_str(String p_message, Severity p_severity, String p_tooltip) { +void EditorToaster::_popup_str(const String &p_message, Severity p_severity, const String &p_tooltip) { is_processing_error = true; // Check if we already have a popup with the given message. Control *control = nullptr; diff --git a/editor/gui/editor_toaster.h b/editor/gui/editor_toaster.h index 5034cb66fc5..4bf32d94ba3 100644 --- a/editor/gui/editor_toaster.h +++ b/editor/gui/editor_toaster.h @@ -100,7 +100,7 @@ private: void _set_notifications_enabled(bool p_enabled); void _repop_old(); - void _popup_str(String p_message, Severity p_severity, String p_tooltip); + void _popup_str(const String &p_message, Severity p_severity, const String &p_tooltip); void _close_button_theme_changed(Control *p_close_button); protected: @@ -111,8 +111,8 @@ protected: public: static EditorToaster *get_singleton(); - Control *popup(Control *p_control, Severity p_severity = SEVERITY_INFO, double p_time = 0.0, String p_tooltip = String()); - void popup_str(String p_message, Severity p_severity = SEVERITY_INFO, String p_tooltip = String()); + Control *popup(Control *p_control, Severity p_severity = SEVERITY_INFO, double p_time = 0.0, const String &p_tooltip = String()); + void popup_str(const String &p_message, Severity p_severity = SEVERITY_INFO, const String &p_tooltip = String()); void close(Control *p_control); EditorToaster(); diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index f54ded7c74c..766566bf2b6 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -750,7 +750,7 @@ bool SceneTreeEditor::_update_filter(TreeItem *p_parent, bool p_scroll_to_select return p_parent->is_visible(); } -bool SceneTreeEditor::_item_matches_all_terms(TreeItem *p_item, PackedStringArray p_terms) { +bool SceneTreeEditor::_item_matches_all_terms(TreeItem *p_item, const PackedStringArray &p_terms) { if (p_terms.is_empty()) { return true; } diff --git a/editor/gui/scene_tree_editor.h b/editor/gui/scene_tree_editor.h index 179050daeb9..fe2396d4386 100644 --- a/editor/gui/scene_tree_editor.h +++ b/editor/gui/scene_tree_editor.h @@ -79,7 +79,7 @@ class SceneTreeEditor : public Control { void _add_nodes(Node *p_node, TreeItem *p_parent); void _test_update_tree(); bool _update_filter(TreeItem *p_parent = nullptr, bool p_scroll_to_selected = false); - bool _item_matches_all_terms(TreeItem *p_item, PackedStringArray p_terms); + bool _item_matches_all_terms(TreeItem *p_item, const PackedStringArray &p_terms); void _tree_changed(); void _tree_process_mode_changed(); void _node_removed(Node *p_node); diff --git a/editor/import/3d/collada.cpp b/editor/import/3d/collada.cpp index d484476b35f..29c373be96a 100644 --- a/editor/import/3d/collada.cpp +++ b/editor/import/3d/collada.cpp @@ -834,7 +834,7 @@ void Collada::_parse_light(XMLParser &p_parser) { COLLADA_PRINT("Light ID:" + id); } -void Collada::_parse_curve_geometry(XMLParser &p_parser, String p_id, String p_name) { +void Collada::_parse_curve_geometry(XMLParser &p_parser, const String &p_id, const String &p_name) { if (!(state.import_flags & IMPORT_FLAG_SCENE)) { if (!p_parser.is_empty()) { p_parser.skip_section(); @@ -916,7 +916,7 @@ void Collada::_parse_curve_geometry(XMLParser &p_parser, String p_id, String p_n } } -void Collada::_parse_mesh_geometry(XMLParser &p_parser, String p_id, String p_name) { +void Collada::_parse_mesh_geometry(XMLParser &p_parser, const String &p_id, const String &p_name) { if (!(state.import_flags & IMPORT_FLAG_SCENE)) { if (!p_parser.is_empty()) { p_parser.skip_section(); @@ -1070,7 +1070,7 @@ void Collada::_parse_mesh_geometry(XMLParser &p_parser, String p_id, String p_na } } -void Collada::_parse_skin_controller(XMLParser &p_parser, String p_id) { +void Collada::_parse_skin_controller(XMLParser &p_parser, const String &p_id) { state.skin_controller_data_map[p_id] = SkinControllerData(); SkinControllerData &skindata = state.skin_controller_data_map[p_id]; @@ -1224,7 +1224,7 @@ void Collada::_parse_skin_controller(XMLParser &p_parser, String p_id) { } } -void Collada::_parse_morph_controller(XMLParser &p_parser, String p_id) { +void Collada::_parse_morph_controller(XMLParser &p_parser, const String &p_id) { state.morph_controller_data_map[p_id] = MorphControllerData(); MorphControllerData &morphdata = state.morph_controller_data_map[p_id]; @@ -2311,7 +2311,7 @@ void Collada::_optimize() { } } -int Collada::get_uv_channel(String p_name) { +int Collada::get_uv_channel(const String &p_name) { if (!channel_map.has(p_name)) { ERR_FAIL_COND_V(channel_map.size() == 2, 0); diff --git a/editor/import/3d/collada.h b/editor/import/3d/collada.h index 7877b1e86d4..416b917a46b 100644 --- a/editor/import/3d/collada.h +++ b/editor/import/3d/collada.h @@ -521,7 +521,7 @@ public: Transform3D get_root_transform() const; - int get_uv_channel(String p_name); + int get_uv_channel(const String &p_name); private: // private stuff HashMap channel_map; @@ -535,11 +535,11 @@ private: // private stuff void _parse_light(XMLParser &p_parser); void _parse_animation_clip(XMLParser &p_parser); - void _parse_mesh_geometry(XMLParser &p_parser, String p_id, String p_name); - void _parse_curve_geometry(XMLParser &p_parser, String p_id, String p_name); + void _parse_mesh_geometry(XMLParser &p_parser, const String &p_id, const String &p_name); + void _parse_curve_geometry(XMLParser &p_parser, const String &p_id, const String &p_name); - void _parse_skin_controller(XMLParser &p_parser, String p_id); - void _parse_morph_controller(XMLParser &p_parser, String p_id); + void _parse_skin_controller(XMLParser &p_parser, const String &p_id); + void _parse_morph_controller(XMLParser &p_parser, const String &p_id); void _parse_controller(XMLParser &p_parser); Node *_parse_visual_instance_geometry(XMLParser &p_parser); diff --git a/editor/import/3d/editor_import_collada.cpp b/editor/import/3d/editor_import_collada.cpp index b7dabf027b9..74766ac2c6a 100644 --- a/editor/import/3d/editor_import_collada.cpp +++ b/editor/import/3d/editor_import_collada.cpp @@ -88,7 +88,7 @@ struct ColladaImport { Error _create_scene(Collada::Node *p_node, Node3D *p_parent); Error _create_resources(Collada::Node *p_node, bool p_use_compression); Error _create_material(const String &p_target); - Error _create_mesh_surfaces(bool p_optimize, Ref &p_mesh, const HashMap &p_material_map, const Collada::MeshData &meshdata, const Transform3D &p_local_xform, const Vector &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector> p_morph_meshes = Vector>(), bool p_use_compression = false, bool p_use_mesh_material = false); + Error _create_mesh_surfaces(bool p_optimize, Ref &p_mesh, const HashMap &p_material_map, const Collada::MeshData &meshdata, const Transform3D &p_local_xform, const Vector &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, const Vector> &p_morph_meshes = Vector>(), bool p_use_compression = false, bool p_use_mesh_material = false); Error load(const String &p_path, int p_flags, bool p_force_make_tangents = false, bool p_use_compression = false); void _fix_param_animation_tracks(); void create_animation(int p_clip, bool p_import_value_tracks); @@ -467,7 +467,7 @@ Error ColladaImport::_create_material(const String &p_target) { return OK; } -Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref &p_mesh, const HashMap &p_material_map, const Collada::MeshData &meshdata, const Transform3D &p_local_xform, const Vector &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector> p_morph_meshes, bool p_use_compression, bool p_use_mesh_material) { +Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref &p_mesh, const HashMap &p_material_map, const Collada::MeshData &meshdata, const Transform3D &p_local_xform, const Vector &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, const Vector> &p_morph_meshes, bool p_use_compression, bool p_use_mesh_material) { bool local_xform_mirror = p_local_xform.basis.determinant() < 0; if (p_morph_data) { diff --git a/editor/import/3d/resource_importer_scene.cpp b/editor/import/3d/resource_importer_scene.cpp index 3310d6f298f..5d8b3e780ee 100644 --- a/editor/import/3d/resource_importer_scene.cpp +++ b/editor/import/3d/resource_importer_scene.cpp @@ -156,11 +156,11 @@ Variant EditorScenePostImportPlugin::get_option_value(const StringName &p_name) } return Variant(); } -void EditorScenePostImportPlugin::add_import_option(const String &p_name, Variant p_default_value) { +void EditorScenePostImportPlugin::add_import_option(const String &p_name, const Variant &p_default_value) { ERR_FAIL_NULL_MSG(current_option_list, "add_import_option() can only be called from get_import_options()."); add_import_option_advanced(p_default_value.get_type(), p_name, p_default_value); } -void EditorScenePostImportPlugin::add_import_option_advanced(Variant::Type p_type, const String &p_name, Variant p_default_value, PropertyHint p_hint, const String &p_hint_string, int p_usage_flags) { +void EditorScenePostImportPlugin::add_import_option_advanced(Variant::Type p_type, const String &p_name, const Variant &p_default_value, PropertyHint p_hint, const String &p_hint_string, int p_usage_flags) { ERR_FAIL_NULL_MSG(current_option_list, "add_import_option_advanced() can only be called from get_import_options()."); current_option_list->push_back(ResourceImporter::ImportOption(PropertyInfo(p_type, p_name, p_hint, p_hint_string, p_usage_flags), p_default_value)); } @@ -1445,7 +1445,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap< return p_node; } -Ref ResourceImporterScene::_save_animation_to_file(Ref anim, bool p_save_to_file, String p_save_to_path, bool p_keep_custom_tracks) { +Ref ResourceImporterScene::_save_animation_to_file(Ref anim, bool p_save_to_file, const String &p_save_to_path, bool p_keep_custom_tracks) { if (!p_save_to_file || !p_save_to_path.is_resource_file()) { return anim; } diff --git a/editor/import/3d/resource_importer_scene.h b/editor/import/3d/resource_importer_scene.h index dbf7794b618..2e682350bc8 100644 --- a/editor/import/3d/resource_importer_scene.h +++ b/editor/import/3d/resource_importer_scene.h @@ -54,8 +54,8 @@ class EditorSceneFormatImporter : public RefCounted { protected: static void _bind_methods(); - Node *import_scene_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options); - Ref import_animation_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options); + Node *import_scene_wrapper(const String &p_path, uint32_t p_flags, const Dictionary &p_options); + Ref import_animation_wrapper(const String &p_path, uint32_t p_flags, const Dictionary &p_options); GDVIRTUAL0RC(uint32_t, _get_import_flags) GDVIRTUAL0RC(Vector, _get_extensions) @@ -136,8 +136,8 @@ protected: public: Variant get_option_value(const StringName &p_name) const; - void add_import_option(const String &p_name, Variant p_default_value); - void add_import_option_advanced(Variant::Type p_type, const String &p_name, Variant p_default_value, PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = String(), int p_usage_flags = PROPERTY_USAGE_DEFAULT); + void add_import_option(const String &p_name, const Variant &p_default_value); + void add_import_option_advanced(Variant::Type p_type, const String &p_name, const Variant &p_default_value, PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = String(), int p_usage_flags = PROPERTY_USAGE_DEFAULT); virtual void get_internal_import_options(InternalImportCategory p_category, List *r_options); virtual Variant get_internal_option_visibility(InternalImportCategory p_category, bool p_for_animation, const String &p_option, const HashMap &p_options) const; @@ -287,7 +287,7 @@ public: Node *_post_fix_node(Node *p_node, Node *p_root, HashMap, Vector>> &collision_map, Pair &r_occluder_arrays, HashSet> &r_scanned_meshes, const Dictionary &p_node_data, const Dictionary &p_material_data, const Dictionary &p_animation_data, float p_animation_fps, float p_applied_root_scale); Node *_post_fix_animations(Node *p_node, Node *p_root, const Dictionary &p_node_data, const Dictionary &p_animation_data, float p_animation_fps); - Ref _save_animation_to_file(Ref anim, bool p_save_to_file, String p_save_to_path, bool p_keep_custom_tracks); + Ref _save_animation_to_file(Ref anim, bool p_save_to_file, const String &p_save_to_path, bool p_keep_custom_tracks); void _create_slices(AnimationPlayer *ap, Ref anim, const Array &p_clips, bool p_bake_all); void _optimize_animations(AnimationPlayer *anim, float p_max_vel_error, float p_max_ang_error, int p_prc_error); void _compress_animations(AnimationPlayer *anim, int p_page_size_kb); diff --git a/editor/import/3d/scene_import_settings.cpp b/editor/import/3d/scene_import_settings.cpp index aeff01fc85a..2dca740a7a1 100644 --- a/editor/import/3d/scene_import_settings.cpp +++ b/editor/import/3d/scene_import_settings.cpp @@ -694,7 +694,7 @@ Node *SceneImportSettingsDialog::get_selected_node() { return node_map[selected_id].node; } -void SceneImportSettingsDialog::_select(Tree *p_from, String p_type, String p_id) { +void SceneImportSettingsDialog::_select(Tree *p_from, const String &p_type, const String &p_id) { selecting = true; scene_import_settings_data->hide_options = false; diff --git a/editor/import/3d/scene_import_settings.h b/editor/import/3d/scene_import_settings.h index 05682551b79..2daf8cb6aa6 100644 --- a/editor/import/3d/scene_import_settings.h +++ b/editor/import/3d/scene_import_settings.h @@ -162,7 +162,7 @@ class SceneImportSettingsDialog : public ConfirmationDialog { void _update_view_gizmos(); void _update_camera(); - void _select(Tree *p_from, String p_type, String p_id); + void _select(Tree *p_from, const String &p_type, const String &p_id); void _inspector_property_edited(const String &p_name); void _reset_bone_transforms(); void _play_animation(); diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 8a7eb802815..78ceb2ef6d5 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -244,7 +244,7 @@ void InspectorDock::_load_resource(const String &p_type) { load_resource_dialog->popup_file_dialog(); } -void InspectorDock::_resource_file_selected(String p_file) { +void InspectorDock::_resource_file_selected(const String &p_file) { Ref res; if (ResourceLoader::exists(p_file, "")) { res = ResourceLoader::load(p_file); diff --git a/editor/inspector_dock.h b/editor/inspector_dock.h index 1ad4b52b7d1..60ce8100aa2 100644 --- a/editor/inspector_dock.h +++ b/editor/inspector_dock.h @@ -114,7 +114,7 @@ class InspectorDock : public VBoxContainer { void _new_resource(); void _load_resource(const String &p_type = ""); void _open_resource_selector() { _load_resource(); }; // just used to call from arg-less signal - void _resource_file_selected(String p_file); + void _resource_file_selected(const String &p_file); void _save_resource(bool save_as); void _unref_resource(); void _copy_resource(); diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 2c86314ae2f..e7a1d2735e7 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -233,7 +233,7 @@ void AbstractPolygon2DEditor::_wip_close() { selected_point = Vertex(); } -void AbstractPolygon2DEditor::disable_polygon_editing(bool p_disable, String p_reason) { +void AbstractPolygon2DEditor::disable_polygon_editing(bool p_disable, const String &p_reason) { _polygon_editing_enabled = !p_disable; button_create->set_disabled(p_disable); @@ -766,7 +766,7 @@ void AbstractPolygon2DEditorPlugin::make_visible(bool p_visible) { } } -AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(AbstractPolygon2DEditor *p_polygon_editor, String p_class) : +AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(AbstractPolygon2DEditor *p_polygon_editor, const String &p_class) : polygon_editor(p_polygon_editor), klass(p_class) { CanvasItemEditor::get_singleton()->add_control_to_menu_panel(polygon_editor); diff --git a/editor/plugins/abstract_polygon_2d_editor.h b/editor/plugins/abstract_polygon_2d_editor.h index 31c20ac1464..25b2e2603e7 100644 --- a/editor/plugins/abstract_polygon_2d_editor.h +++ b/editor/plugins/abstract_polygon_2d_editor.h @@ -137,7 +137,7 @@ protected: virtual void _create_resource(); public: - void disable_polygon_editing(bool p_disable, String p_reason); + void disable_polygon_editing(bool p_disable, const String &p_reason); bool forward_gui_input(const Ref &p_event); void forward_canvas_draw_over_viewport(Control *p_overlay); @@ -162,7 +162,7 @@ public: virtual bool handles(Object *p_object) const override; virtual void make_visible(bool p_visible) override; - AbstractPolygon2DEditorPlugin(AbstractPolygon2DEditor *p_polygon_editor, String p_class); + AbstractPolygon2DEditorPlugin(AbstractPolygon2DEditor *p_polygon_editor, const String &p_class); ~AbstractPolygon2DEditorPlugin(); }; diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 22813124d0a..0412141775d 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -494,7 +494,7 @@ void AnimationNodeBlendTreeEditor::_disconnection_request(const String &p_from, updating = false; } -void AnimationNodeBlendTreeEditor::_anim_selected(int p_index, Array p_options, const String &p_node) { +void AnimationNodeBlendTreeEditor::_anim_selected(int p_index, const Array &p_options, const String &p_node) { String option = p_options[p_index]; Ref anim = blend_tree->get_node(p_node); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h index 690b127938e..ee6f087e071 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.h +++ b/editor/plugins/animation_blend_tree_editor_plugin.h @@ -111,7 +111,7 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin { void _scroll_changed(const Vector2 &p_scroll); void _node_selected(Object *p_node); void _open_in_editor(const String &p_which); - void _anim_selected(int p_index, Array p_options, const String &p_node); + void _anim_selected(int p_index, const Array &p_options, const String &p_node); void _delete_node_request(const String &p_which); void _delete_nodes_request(const TypedArray &p_nodes); diff --git a/editor/plugins/animation_library_editor.cpp b/editor/plugins/animation_library_editor.cpp index 58b1dbde8a2..2af38118636 100644 --- a/editor/plugins/animation_library_editor.cpp +++ b/editor/plugins/animation_library_editor.cpp @@ -300,7 +300,7 @@ void AnimationLibraryEditor::_file_popup_selected(int p_id) { } } -void AnimationLibraryEditor::_load_file(String p_path) { +void AnimationLibraryEditor::_load_file(const String &p_path) { switch (file_dialog_action) { case FILE_DIALOG_ACTION_SAVE_LIBRARY: { Ref al = mixer->get_animation_library(file_dialog_library); diff --git a/editor/plugins/animation_library_editor.h b/editor/plugins/animation_library_editor.h index c003e9a10b6..a268e689326 100644 --- a/editor/plugins/animation_library_editor.h +++ b/editor/plugins/animation_library_editor.h @@ -100,7 +100,7 @@ class AnimationLibraryEditor : public AcceptDialog { void _add_library_validate(const String &p_name); void _add_library_confirm(); void _load_library(); - void _load_file(String p_path); + void _load_file(const String &p_path); void _load_files(const PackedStringArray &p_paths); void _item_renamed(); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 6b8943ee845..dbfb143b227 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1184,7 +1184,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() { state_machine_play_pos->queue_redraw(); } -void AnimationNodeStateMachineEditor::_state_machine_pos_draw_individual(String p_name, float p_ratio) { +void AnimationNodeStateMachineEditor::_state_machine_pos_draw_individual(const String &p_name, float p_ratio) { AnimationTree *tree = AnimationTreeEditor::get_singleton()->get_animation_tree(); if (!tree) { return; diff --git a/editor/plugins/animation_state_machine_editor.h b/editor/plugins/animation_state_machine_editor.h index 949fa84bcec..860d0ed35d1 100644 --- a/editor/plugins/animation_state_machine_editor.h +++ b/editor/plugins/animation_state_machine_editor.h @@ -134,7 +134,7 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin { void _state_machine_draw(); - void _state_machine_pos_draw_individual(String p_name, float p_ratio); + void _state_machine_pos_draw_individual(const String &p_name, float p_ratio); void _state_machine_pos_draw_all(); void _update_graph(); diff --git a/editor/plugins/audio_stream_randomizer_editor_plugin.cpp b/editor/plugins/audio_stream_randomizer_editor_plugin.cpp index e2ad69ac15f..9c76b86d6a2 100644 --- a/editor/plugins/audio_stream_randomizer_editor_plugin.cpp +++ b/editor/plugins/audio_stream_randomizer_editor_plugin.cpp @@ -43,7 +43,7 @@ bool AudioStreamRandomizerEditorPlugin::handles(Object *p_object) const { void AudioStreamRandomizerEditorPlugin::make_visible(bool p_visible) { } -void AudioStreamRandomizerEditorPlugin::_move_stream_array_element(Object *p_undo_redo, Object *p_edited, String p_array_prefix, int p_from_index, int p_to_pos) { +void AudioStreamRandomizerEditorPlugin::_move_stream_array_element(Object *p_undo_redo, Object *p_edited, const String &p_array_prefix, int p_from_index, int p_to_pos) { EditorUndoRedoManager *undo_redo_man = Object::cast_to(p_undo_redo); ERR_FAIL_NULL(undo_redo_man); diff --git a/editor/plugins/audio_stream_randomizer_editor_plugin.h b/editor/plugins/audio_stream_randomizer_editor_plugin.h index 72cdaeee308..535ab4114ba 100644 --- a/editor/plugins/audio_stream_randomizer_editor_plugin.h +++ b/editor/plugins/audio_stream_randomizer_editor_plugin.h @@ -38,7 +38,7 @@ class AudioStreamRandomizerEditorPlugin : public EditorPlugin { GDCLASS(AudioStreamRandomizerEditorPlugin, EditorPlugin); private: - void _move_stream_array_element(Object *p_undo_redo, Object *p_edited, String p_array_prefix, int p_from_index, int p_to_pos); + void _move_stream_array_element(Object *p_undo_redo, Object *p_edited, const String &p_array_prefix, int p_from_index, int p_to_pos); public: virtual String get_name() const override { return "AudioStreamRandomizer"; } diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp index 3256b90aba5..d8c020eb296 100644 --- a/editor/plugins/bone_map_editor_plugin.cpp +++ b/editor/plugins/bone_map_editor_plugin.cpp @@ -136,7 +136,7 @@ void BoneMapperItem::_open_picker() { emit_signal(SNAME("pick"), profile_bone_name); } -void BoneMapperItem::_value_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) { +void BoneMapperItem::_value_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) { bone_map->set(p_property, p_value); } @@ -534,12 +534,12 @@ void BoneMapper::_clear_mapping_current_group() { } #ifdef MODULE_REGEX_ENABLED -bool BoneMapper::is_match_with_bone_name(String p_bone_name, String p_word) { +bool BoneMapper::is_match_with_bone_name(const String &p_bone_name, const String &p_word) { RegEx re = RegEx(p_word); return !re.search(p_bone_name.to_lower()).is_null(); } -int BoneMapper::search_bone_by_name(Skeleton3D *p_skeleton, Vector p_picklist, BoneSegregation p_segregation, int p_parent, int p_child, int p_children_count) { +int BoneMapper::search_bone_by_name(Skeleton3D *p_skeleton, const Vector &p_picklist, BoneSegregation p_segregation, int p_parent, int p_child, int p_children_count) { // There may be multiple candidates hit by existing the subsidiary bone. // The one with the shortest name is probably the original. LocalVector hit_list; @@ -617,7 +617,7 @@ int BoneMapper::search_bone_by_name(Skeleton3D *p_skeleton, Vector p_pic return skeleton->find_bone(shortest); } -BoneMapper::BoneSegregation BoneMapper::guess_bone_segregation(String p_bone_name) { +BoneMapper::BoneSegregation BoneMapper::guess_bone_segregation(const String &p_bone_name) { String fixed_bn = p_bone_name.to_snake_case(); LocalVector left_words; @@ -1279,12 +1279,12 @@ void BoneMapper::auto_mapping_process(Ref &p_bone_map) { } #endif // MODULE_REGEX_ENABLED -void BoneMapper::_value_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) { +void BoneMapper::_value_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) { set(p_property, p_value); recreate_editor(); } -void BoneMapper::_profile_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) { +void BoneMapper::_profile_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) { bone_map->set(p_property, p_value); // Run auto mapping when setting SkeletonProfileHumanoid by GUI Editor. diff --git a/editor/plugins/bone_map_editor_plugin.h b/editor/plugins/bone_map_editor_plugin.h index 9479ed3730a..2e7d1ff1248 100644 --- a/editor/plugins/bone_map_editor_plugin.h +++ b/editor/plugins/bone_map_editor_plugin.h @@ -99,7 +99,7 @@ class BoneMapperItem : public VBoxContainer { protected: void _notification(int p_what); static void _bind_methods(); - virtual void _value_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing); + virtual void _value_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing); virtual void create_editor(); public: @@ -179,9 +179,9 @@ class BoneMapper : public VBoxContainer { BONE_SEGREGATION_LEFT, BONE_SEGREGATION_RIGHT }; - bool is_match_with_bone_name(String p_bone_name, String p_word); - int search_bone_by_name(Skeleton3D *p_skeleton, Vector p_picklist, BoneSegregation p_segregation = BONE_SEGREGATION_NONE, int p_parent = -1, int p_child = -1, int p_children_count = -1); - BoneSegregation guess_bone_segregation(String p_bone_name); + bool is_match_with_bone_name(const String &p_bone_name, const String &p_word); + int search_bone_by_name(Skeleton3D *p_skeleton, const Vector &p_picklist, BoneSegregation p_segregation = BONE_SEGREGATION_NONE, int p_parent = -1, int p_child = -1, int p_children_count = -1); + BoneSegregation guess_bone_segregation(const String &p_bone_name); void auto_mapping_process(Ref &p_bone_map); void _run_auto_mapping(); #endif // MODULE_REGEX_ENABLED @@ -189,8 +189,8 @@ class BoneMapper : public VBoxContainer { protected: void _notification(int p_what); static void _bind_methods(); - virtual void _value_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing); - virtual void _profile_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing); + virtual void _value_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing); + virtual void _profile_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing); public: void set_current_group_idx(int p_group_idx); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 3bcc316f84c..7181c93ee0c 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -861,7 +861,7 @@ void CanvasItemEditor::_restore_canvas_item_state(const List &p_ca } } -void CanvasItemEditor::_commit_canvas_item_state(const List &p_canvas_items, String action_name, bool commit_bones) { +void CanvasItemEditor::_commit_canvas_item_state(const List &p_canvas_items, const String &action_name, bool commit_bones) { List modified_canvas_items; for (CanvasItem *ci : p_canvas_items) { Dictionary old_state = editor_selection->get_node_editor_data(ci)->undo_state; @@ -2708,7 +2708,7 @@ Control::CursorShape CanvasItemEditor::get_cursor_shape(const Point2 &p_pos) con return c; } -void CanvasItemEditor::_draw_text_at_position(Point2 p_position, String p_string, Side p_side) { +void CanvasItemEditor::_draw_text_at_position(Point2 p_position, const String &p_string, Side p_side) { Color color = get_theme_color(SNAME("font_color"), EditorStringName(Editor)); color.a = 0.8; Ref font = get_theme_font(SNAME("font"), SNAME("Label")); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index bf36b6ec1d5..f85f1aef661 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -394,7 +394,7 @@ private: void _save_canvas_item_state(const List &p_canvas_items, bool save_bones = false); void _restore_canvas_item_state(const List &p_canvas_items, bool restore_bones = false); - void _commit_canvas_item_state(const List &p_canvas_items, String action_name, bool commit_bones = false); + void _commit_canvas_item_state(const List &p_canvas_items, const String &action_name, bool commit_bones = false); Vector2 _anchor_to_position(const Control *p_control, Vector2 anchor); Vector2 _position_to_anchor(const Control *p_control, Vector2 position); @@ -440,7 +440,7 @@ private: virtual void shortcut_input(const Ref &p_ev) override; - void _draw_text_at_position(Point2 p_position, String p_string, Side p_side); + void _draw_text_at_position(Point2 p_position, const String &p_string, Side p_side); void _draw_margin_at_position(int p_value, Point2 p_position, Side p_side); void _draw_percentage_at_position(real_t p_value, Point2 p_position, Side p_side); void _draw_straight_line(Point2 p_from, Point2 p_to, Color p_color); diff --git a/editor/plugins/editor_debugger_plugin.cpp b/editor/plugins/editor_debugger_plugin.cpp index 9f495d5cd2c..af9ff5056a0 100644 --- a/editor/plugins/editor_debugger_plugin.cpp +++ b/editor/plugins/editor_debugger_plugin.cpp @@ -32,7 +32,7 @@ #include "editor/debugger/script_editor_debugger.h" -void EditorDebuggerSession::_breaked(bool p_really_did, bool p_can_debug, String p_message, bool p_has_stackdump) { +void EditorDebuggerSession::_breaked(bool p_really_did, bool p_can_debug, const String &p_message, bool p_has_stackdump) { if (p_really_did) { emit_signal(SNAME("breaked"), p_can_debug); } else { diff --git a/editor/plugins/editor_debugger_plugin.h b/editor/plugins/editor_debugger_plugin.h index 10c0e29f6ee..41f34f67cf0 100644 --- a/editor/plugins/editor_debugger_plugin.h +++ b/editor/plugins/editor_debugger_plugin.h @@ -43,7 +43,7 @@ private: ScriptEditorDebugger *debugger = nullptr; - void _breaked(bool p_really_did, bool p_can_debug, String p_message, bool p_has_stackdump); + void _breaked(bool p_really_did, bool p_can_debug, const String &p_message, bool p_has_stackdump); void _started(); void _stopped(); void _debugger_gone_away(); diff --git a/editor/plugins/font_config_plugin.cpp b/editor/plugins/font_config_plugin.cpp index f9b5e280c9b..4011d364562 100644 --- a/editor/plugins/font_config_plugin.cpp +++ b/editor/plugins/font_config_plugin.cpp @@ -163,7 +163,7 @@ void EditorPropertyFontMetaOverride::_notification(int p_what) { } } -void EditorPropertyFontMetaOverride::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) { +void EditorPropertyFontMetaOverride::_property_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) { if (p_property.begins_with("keys")) { Dictionary dict = object->get_dict(); String key = p_property.get_slice("/", 1); @@ -391,7 +391,7 @@ void EditorPropertyOTVariation::_notification(int p_what) { } } -void EditorPropertyOTVariation::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) { +void EditorPropertyOTVariation::_property_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) { if (p_property.begins_with("keys")) { Dictionary dict = object->get_dict(); Dictionary defaults_dict = object->get_defaults(); @@ -559,7 +559,7 @@ void EditorPropertyOTFeatures::_notification(int p_what) { } } -void EditorPropertyOTFeatures::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) { +void EditorPropertyOTFeatures::_property_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) { if (p_property.begins_with("keys")) { Dictionary dict = object->get_dict(); int key = p_property.get_slice("/", 1).to_int(); diff --git a/editor/plugins/font_config_plugin.h b/editor/plugins/font_config_plugin.h index 6cea5967b2a..dc17a7717e2 100644 --- a/editor/plugins/font_config_plugin.h +++ b/editor/plugins/font_config_plugin.h @@ -108,7 +108,7 @@ protected: void _edit_pressed(); void _page_changed(int p_page); - void _property_changed(const String &p_property, Variant p_value, const String &p_name = "", bool p_changing = false); + void _property_changed(const String &p_property, const Variant &p_value, const String &p_name = "", bool p_changing = false); void _remove(Object *p_button, const String &p_key); void _add_menu(); void _add_script(int p_option); @@ -144,7 +144,7 @@ protected: void _edit_pressed(); void _page_changed(int p_page); - void _property_changed(const String &p_property, Variant p_value, const String &p_name = "", bool p_changing = false); + void _property_changed(const String &p_property, const Variant &p_value, const String &p_name = "", bool p_changing = false); void _object_id_selected(const StringName &p_property, ObjectID p_id); public: @@ -193,7 +193,7 @@ protected: void _edit_pressed(); void _page_changed(int p_page); - void _property_changed(const String &p_property, Variant p_value, const String &p_name = "", bool p_changing = false); + void _property_changed(const String &p_property, const Variant &p_value, const String &p_name = "", bool p_changing = false); void _remove(Object *p_button, int p_key); void _add_menu(); void _add_feature(int p_option); diff --git a/editor/plugins/gdextension_export_plugin.h b/editor/plugins/gdextension_export_plugin.h index c56591cc3ae..28080ed5596 100644 --- a/editor/plugins/gdextension_export_plugin.h +++ b/editor/plugins/gdextension_export_plugin.h @@ -93,7 +93,7 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p for (const String &arch_tag : archs) { PackedStringArray tags; String library_path = GDExtension::find_extension_library( - p_path, config, [features_wo_arch, arch_tag](String p_feature) { return features_wo_arch.has(p_feature) || (p_feature == arch_tag); }, &tags); + p_path, config, [features_wo_arch, arch_tag](const String &p_feature) { return features_wo_arch.has(p_feature) || (p_feature == arch_tag); }, &tags); if (libs_added.has(library_path)) { continue; // Universal library, already added for another arch, do not duplicate. } diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index ba64c85b37c..d3a0d56ec96 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -303,7 +303,7 @@ void EditorInspectorPluginMaterial::parse_begin(Object *p_object) { add_custom_control(editor); } -void EditorInspectorPluginMaterial::_undo_redo_inspector_callback(Object *p_undo_redo, Object *p_edited, String p_property, Variant p_new_value) { +void EditorInspectorPluginMaterial::_undo_redo_inspector_callback(Object *p_undo_redo, Object *p_edited, const String &p_property, const Variant &p_new_value) { EditorUndoRedoManager *undo_redo = Object::cast_to(p_undo_redo); ERR_FAIL_NULL(undo_redo); diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h index 5d79d94aafd..c60de1ade9d 100644 --- a/editor/plugins/material_editor_plugin.h +++ b/editor/plugins/material_editor_plugin.h @@ -110,7 +110,7 @@ public: virtual bool can_handle(Object *p_object) override; virtual void parse_begin(Object *p_object) override; - void _undo_redo_inspector_callback(Object *p_undo_redo, Object *p_edited, String p_property, Variant p_new_value); + void _undo_redo_inspector_callback(Object *p_undo_redo, Object *p_edited, const String &p_property, const Variant &p_new_value); EditorInspectorPluginMaterial(); }; diff --git a/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp b/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp index 5118f1d4585..869f5b3b103 100644 --- a/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp +++ b/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp @@ -348,7 +348,7 @@ PackedVector2Array NavigationObstacle3DEditor::_get_polygon() { return PackedVector2Array(obstacle_node->call("get_polygon")); } -void NavigationObstacle3DEditor::_set_polygon(PackedVector2Array p_poly) { +void NavigationObstacle3DEditor::_set_polygon(const PackedVector2Array &p_poly) { ERR_FAIL_NULL_MSG(obstacle_node, "Edited object is not valid."); obstacle_node->call("set_polygon", p_poly); } diff --git a/editor/plugins/navigation_obstacle_3d_editor_plugin.h b/editor/plugins/navigation_obstacle_3d_editor_plugin.h index 1b125873d11..175fc756122 100644 --- a/editor/plugins/navigation_obstacle_3d_editor_plugin.h +++ b/editor/plugins/navigation_obstacle_3d_editor_plugin.h @@ -82,7 +82,7 @@ class NavigationObstacle3DEditor : public HBoxContainer { void _menu_option(int p_option); PackedVector2Array _get_polygon(); - void _set_polygon(PackedVector2Array p_poly); + void _set_polygon(const PackedVector2Array &p_poly); protected: void _notification(int p_what); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 4e462cfe34b..7ce82381cc9 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2663,7 +2663,7 @@ void Node3DEditorViewport::_update_freelook(real_t delta) { cursor.eye_pos += motion; } -void Node3DEditorViewport::set_message(String p_message, float p_time) { +void Node3DEditorViewport::set_message(const String &p_message, float p_time) { message = p_message; message_time = p_time; } diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 003d462552c..13b51289a95 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -400,7 +400,7 @@ private: String message; double message_time; - void set_message(String p_message, float p_time = 5); + void set_message(const String &p_message, float p_time = 5); void _view_settings_confirmed(real_t p_interp_delta); void _update_camera(real_t p_interp_delta); diff --git a/editor/plugins/polygon_3d_editor_plugin.cpp b/editor/plugins/polygon_3d_editor_plugin.cpp index 2ea251c4552..da84afc4d70 100644 --- a/editor/plugins/polygon_3d_editor_plugin.cpp +++ b/editor/plugins/polygon_3d_editor_plugin.cpp @@ -364,7 +364,7 @@ PackedVector2Array Polygon3DEditor::_get_polygon() { return PackedVector2Array(obj->call("get_polygon")); } -void Polygon3DEditor::_set_polygon(PackedVector2Array p_poly) { +void Polygon3DEditor::_set_polygon(const PackedVector2Array &p_poly) { Object *obj = node_resource.is_valid() ? (Object *)node_resource.ptr() : node; ERR_FAIL_NULL_MSG(obj, "Edited object is not valid."); obj->call("set_polygon", p_poly); diff --git a/editor/plugins/polygon_3d_editor_plugin.h b/editor/plugins/polygon_3d_editor_plugin.h index 6cb9275dd69..6407e33f484 100644 --- a/editor/plugins/polygon_3d_editor_plugin.h +++ b/editor/plugins/polygon_3d_editor_plugin.h @@ -82,7 +82,7 @@ class Polygon3DEditor : public HBoxContainer { float _get_depth(); PackedVector2Array _get_polygon(); - void _set_polygon(PackedVector2Array p_poly); + void _set_polygon(const PackedVector2Array &p_poly); protected: void _notification(int p_what); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index d639121ae01..0ee6d76c3f5 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -696,7 +696,7 @@ void ScriptEditor::_go_to_tab(int p_idx) { _update_help_overview_visibility(); } -void ScriptEditor::_add_recent_script(String p_path) { +void ScriptEditor::_add_recent_script(const String &p_path) { if (p_path.is_empty()) { return; } @@ -790,7 +790,7 @@ void ScriptEditor::_open_recent_script(int p_idx) { _show_error_dialog(path); } -void ScriptEditor::_show_error_dialog(String p_path) { +void ScriptEditor::_show_error_dialog(const String &p_path) { error_dialog->set_text(vformat(TTR("Can't open '%s'. The file could have been moved or deleted."), p_path)); error_dialog->popup_centered(); } @@ -1109,7 +1109,7 @@ bool ScriptEditor::_test_script_times_on_disk(Ref p_for_script) { return need_reload; } -void ScriptEditor::_file_dialog_action(String p_file) { +void ScriptEditor::_file_dialog_action(const String &p_file) { switch (file_dialog_option) { case FILE_NEW_TEXTFILE: { Error err; @@ -3628,7 +3628,7 @@ void ScriptEditor::set_live_auto_reload_running_scripts(bool p_enabled) { auto_reload_running_scripts = p_enabled; } -void ScriptEditor::_help_search(String p_text) { +void ScriptEditor::_help_search(const String &p_text) { help_search_dialog->popup_dialog(p_text); } @@ -3679,20 +3679,20 @@ void ScriptEditor::_script_changed() { NodeDock::get_singleton()->update_lists(); } -void ScriptEditor::_on_find_in_files_requested(String text) { +void ScriptEditor::_on_find_in_files_requested(const String &text) { find_in_files_dialog->set_find_in_files_mode(FindInFilesDialog::SEARCH_MODE); find_in_files_dialog->set_search_text(text); find_in_files_dialog->popup_centered(); } -void ScriptEditor::_on_replace_in_files_requested(String text) { +void ScriptEditor::_on_replace_in_files_requested(const String &text) { find_in_files_dialog->set_find_in_files_mode(FindInFilesDialog::REPLACE_MODE); find_in_files_dialog->set_search_text(text); find_in_files_dialog->set_replace_text(""); find_in_files_dialog->popup_centered(); } -void ScriptEditor::_on_find_in_files_result_selected(String fpath, int line_number, int begin, int end) { +void ScriptEditor::_on_find_in_files_result_selected(const String &fpath, int line_number, int begin, int end) { if (ResourceLoader::exists(fpath)) { Ref res = ResourceLoader::load(fpath); @@ -3814,7 +3814,7 @@ void ScriptEditor::_start_find_in_files(bool with_replace) { EditorNode::get_bottom_panel()->make_item_visible(find_in_files); } -void ScriptEditor::_on_find_in_files_modified_files(PackedStringArray paths) { +void ScriptEditor::_on_find_in_files_modified_files(const PackedStringArray &paths) { _test_script_times_on_disk(); _update_modified_scripts_for_external_editor(); } @@ -4217,7 +4217,7 @@ void ScriptEditorPlugin::_focus_another_editor() { } } -void ScriptEditorPlugin::_save_last_editor(String p_editor) { +void ScriptEditorPlugin::_save_last_editor(const String &p_editor) { if (p_editor != get_name()) { last_editor = p_editor; } diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 752c1a6a05d..6d13c6af09f 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -179,7 +179,7 @@ public: virtual PackedInt32Array get_breakpoints() = 0; virtual void set_breakpoint(int p_line, bool p_enabled) = 0; virtual void clear_breakpoints() = 0; - virtual void add_callback(const String &p_function, PackedStringArray p_args) = 0; + virtual void add_callback(const String &p_function, const PackedStringArray &p_args) = 0; virtual void update_settings() = 0; virtual void set_debugger_active(bool p_active) = 0; virtual bool can_lose_focus_on_node_selection() { return true; } @@ -362,11 +362,11 @@ class ScriptEditor : public PanelContainer { bool _test_script_times_on_disk(Ref p_for_script = Ref()); - void _add_recent_script(String p_path); + void _add_recent_script(const String &p_path); void _update_recent_scripts(); void _open_recent_script(int p_idx); - void _show_error_dialog(String p_path); + void _show_error_dialog(const String &p_path); void _close_tab(int p_idx, bool p_save = true, bool p_history_back = true); void _update_find_replace_bar(); @@ -462,7 +462,7 @@ class ScriptEditor : public PanelContainer { void _script_list_clicked(int p_item, Vector2 p_local_mouse_pos, MouseButton p_mouse_button_index); void _make_script_list_context_menu(); - void _help_search(String p_text); + void _help_search(const String &p_text); void _history_forward(); void _history_back(); @@ -481,7 +481,7 @@ class ScriptEditor : public PanelContainer { void _script_changed(); int file_dialog_option; - void _file_dialog_action(String p_file); + void _file_dialog_action(const String &p_file); Ref