diff --git a/modules/enet/enet_connection.cpp b/modules/enet/enet_connection.cpp index 2ccfd5d3263..6c80ff7a5c9 100644 --- a/modules/enet/enet_connection.cpp +++ b/modules/enet/enet_connection.cpp @@ -334,7 +334,7 @@ Array ENetConnection::_service(int p_timeout) { return out; } -void ENetConnection::_broadcast(int p_channel, PackedByteArray p_packet, int p_flags) { +void ENetConnection::_broadcast(int p_channel, const PackedByteArray &p_packet, int p_flags) { ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active."); ERR_FAIL_COND_MSG(p_channel < 0 || p_channel > (int)host->channelLimit, "Invalid channel"); ERR_FAIL_COND_MSG(p_flags & ~ENetPacketPeer::FLAG_ALLOWED, "Invalid flags"); diff --git a/modules/enet/enet_connection.h b/modules/enet/enet_connection.h index 616402be203..4ca283ba26b 100644 --- a/modules/enet/enet_connection.h +++ b/modules/enet/enet_connection.h @@ -85,7 +85,7 @@ class ENetConnection : public RefCounted { EventType _parse_event(const ENetEvent &p_event, Event &r_event); Error _create(ENetAddress *p_address, int p_max_peers, int p_max_channels, int p_in_bandwidth, int p_out_bandwidth); Array _service(int p_timeout = 0); - void _broadcast(int p_channel, PackedByteArray p_packet, int p_flags); + void _broadcast(int p_channel, const PackedByteArray &p_packet, int p_flags); TypedArray<ENetPacketPeer> _get_peers(); class Compressor { diff --git a/modules/enet/enet_packet_peer.cpp b/modules/enet/enet_packet_peer.cpp index edb33fc96b9..437791b6541 100644 --- a/modules/enet/enet_packet_peer.cpp +++ b/modules/enet/enet_packet_peer.cpp @@ -187,7 +187,7 @@ void ENetPacketPeer::_queue_packet(ENetPacket *p_packet) { packet_queue.push_back(p_packet); } -Error ENetPacketPeer::_send(int p_channel, PackedByteArray p_packet, int p_flags) { +Error ENetPacketPeer::_send(int p_channel, const PackedByteArray &p_packet, int p_flags) { ERR_FAIL_NULL_V_MSG(peer, ERR_UNCONFIGURED, "Peer not connected."); ERR_FAIL_COND_V_MSG(p_channel < 0 || p_channel > (int)peer->channelCount, ERR_INVALID_PARAMETER, "Invalid channel"); ERR_FAIL_COND_V_MSG(p_flags & ~FLAG_ALLOWED, ERR_INVALID_PARAMETER, "Invalid flags"); diff --git a/modules/enet/enet_packet_peer.h b/modules/enet/enet_packet_peer.h index fe40d061882..1c2f1e0bd94 100644 --- a/modules/enet/enet_packet_peer.h +++ b/modules/enet/enet_packet_peer.h @@ -44,7 +44,7 @@ class ENetPacketPeer : public PacketPeer { ENetPacket *last_packet = nullptr; static void _bind_methods(); - Error _send(int p_channel, PackedByteArray p_packet, int p_flags); + Error _send(int p_channel, const PackedByteArray &p_packet, int p_flags); protected: friend class ENetConnection; diff --git a/modules/fbx/fbx_document.cpp b/modules/fbx/fbx_document.cpp index 4d3f7554c09..478a546db8a 100644 --- a/modules/fbx/fbx_document.cpp +++ b/modules/fbx/fbx_document.cpp @@ -2140,7 +2140,7 @@ Node *FBXDocument::generate_scene(Ref<GLTFState> p_state, float p_bake_fps, bool return root; } -Error FBXDocument::append_from_buffer(PackedByteArray p_bytes, String p_base_path, Ref<GLTFState> p_state, uint32_t p_flags) { +Error FBXDocument::append_from_buffer(const PackedByteArray &p_bytes, const String &p_base_path, Ref<GLTFState> p_state, uint32_t p_flags) { Ref<FBXState> state = p_state; ERR_FAIL_COND_V(state.is_null(), ERR_INVALID_PARAMETER); ERR_FAIL_NULL_V(p_bytes.ptr(), ERR_INVALID_DATA); @@ -2232,7 +2232,7 @@ Error FBXDocument::_parse_fbx_state(Ref<FBXState> p_state, const String &p_searc return OK; } -Error FBXDocument::append_from_file(String p_path, Ref<GLTFState> p_state, uint32_t p_flags, String p_base_path) { +Error FBXDocument::append_from_file(const String &p_path, Ref<GLTFState> p_state, uint32_t p_flags, const String &p_base_path) { Ref<FBXState> state = p_state; ERR_FAIL_COND_V(state.is_null(), ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(p_path.is_empty(), ERR_FILE_NOT_FOUND); diff --git a/modules/fbx/fbx_document.h b/modules/fbx/fbx_document.h index 96f1905881b..ace68fef041 100644 --- a/modules/fbx/fbx_document.h +++ b/modules/fbx/fbx_document.h @@ -53,8 +53,8 @@ class FBXDocument : public GLTFDocument { static String _gen_unique_name(HashSet<String> &unique_names, const String &p_name); public: - Error append_from_file(String p_path, Ref<GLTFState> p_state, uint32_t p_flags = 0, String p_base_path = String()) override; - Error append_from_buffer(PackedByteArray p_bytes, String p_base_path, Ref<GLTFState> p_state, uint32_t p_flags = 0) override; + Error append_from_file(const String &p_path, Ref<GLTFState> p_state, uint32_t p_flags = 0, const String &p_base_path = String()) override; + Error append_from_buffer(const PackedByteArray &p_bytes, const String &p_base_path, Ref<GLTFState> p_state, uint32_t p_flags = 0) override; Error append_from_scene(Node *p_node, Ref<GLTFState> p_state, uint32_t p_flags = 0) override; Node *generate_scene(Ref<GLTFState> p_state, float p_bake_fps = 30.0f, bool p_trimming = false, bool p_remove_immutable_tracks = true) override; diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index e98cae765b6..7e633364239 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -2973,7 +2973,7 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o } #ifdef SUGGEST_GODOT4_RENAMES -const char *get_rename_from_map(const char *map[][2], String key) { +const char *get_rename_from_map(const char *map[][2], const String &key) { for (int index = 0; map[index][0]; index++) { if (map[index][0] == key) { return map[index][1]; @@ -2984,7 +2984,7 @@ const char *get_rename_from_map(const char *map[][2], String key) { // Checks if an identifier/function name has been renamed in Godot 4, uses ProjectConverter3To4 for rename map. // Returns the new name if found, nullptr otherwise. -const char *check_for_renamed_identifier(String identifier, GDScriptParser::Node::Type type) { +const char *check_for_renamed_identifier(const String &identifier, GDScriptParser::Node::Type type) { switch (type) { case GDScriptParser::Node::IDENTIFIER: { // Check properties diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp index 4cda3d30375..895cd9245dd 100644 --- a/modules/gdscript/gdscript_byte_codegen.cpp +++ b/modules/gdscript/gdscript_byte_codegen.cpp @@ -159,7 +159,7 @@ void GDScriptByteCodeGenerator::end_parameters() { function->default_arguments.reverse(); } -void GDScriptByteCodeGenerator::write_start(GDScript *p_script, const StringName &p_function_name, bool p_static, Variant p_rpc_config, const GDScriptDataType &p_return_type) { +void GDScriptByteCodeGenerator::write_start(GDScript *p_script, const StringName &p_function_name, bool p_static, const Variant &p_rpc_config, const GDScriptDataType &p_return_type) { function = memnew(GDScriptFunction); debug_stack = EngineDebugger::is_active(); diff --git a/modules/gdscript/gdscript_byte_codegen.h b/modules/gdscript/gdscript_byte_codegen.h index 34f56a2f5c0..ab6e9b78d7e 100644 --- a/modules/gdscript/gdscript_byte_codegen.h +++ b/modules/gdscript/gdscript_byte_codegen.h @@ -469,7 +469,7 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator { virtual void start_block() override; virtual void end_block() override; - virtual void write_start(GDScript *p_script, const StringName &p_function_name, bool p_static, Variant p_rpc_config, const GDScriptDataType &p_return_type) override; + virtual void write_start(GDScript *p_script, const StringName &p_function_name, bool p_static, const Variant &p_rpc_config, const GDScriptDataType &p_return_type) override; virtual GDScriptFunction *write_end() override; #ifdef DEBUG_ENABLED diff --git a/modules/gdscript/gdscript_codegen.h b/modules/gdscript/gdscript_codegen.h index c1c0b61395d..9c5df7e028e 100644 --- a/modules/gdscript/gdscript_codegen.h +++ b/modules/gdscript/gdscript_codegen.h @@ -83,7 +83,7 @@ class GDScriptCodeGenerator { virtual void start_block() = 0; virtual void end_block() = 0; - virtual void write_start(GDScript *p_script, const StringName &p_function_name, bool p_static, Variant p_rpc_config, const GDScriptDataType &p_return_type) = 0; + virtual void write_start(GDScript *p_script, const StringName &p_function_name, bool p_static, const Variant &p_rpc_config, const GDScriptDataType &p_return_type) = 0; virtual GDScriptFunction *write_end() = 0; #ifdef DEBUG_ENABLED diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 822fc412b44..1bf0ea53ee6 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -860,7 +860,7 @@ static void _get_directory_contents(EditorFileSystemDirectory *p_dir, HashMap<St } } -static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_annotation, int p_argument, const String p_quote_style, HashMap<String, ScriptLanguage::CodeCompletionOption> &r_result) { +static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_annotation, int p_argument, const String &p_quote_style, HashMap<String, ScriptLanguage::CodeCompletionOption> &r_result) { if (p_annotation->name == SNAME("@export_range")) { if (p_argument == 3 || p_argument == 4 || p_argument == 5) { // Slider hint. diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp index 09defdf8cd7..74381527602 100644 --- a/modules/gdscript/language_server/gdscript_workspace.cpp +++ b/modules/gdscript/language_server/gdscript_workspace.cpp @@ -54,7 +54,7 @@ void GDScriptWorkspace::_bind_methods() { ClassDB::bind_method(D_METHOD("generate_script_api", "path"), &GDScriptWorkspace::generate_script_api); } -void GDScriptWorkspace::apply_new_signal(Object *obj, String function, PackedStringArray args) { +void GDScriptWorkspace::apply_new_signal(Object *obj, const String &function, const PackedStringArray &args) { Ref<Script> scr = obj->get_script(); if (scr->get_language()->get_name() != "GDScript") { @@ -587,7 +587,7 @@ void GDScriptWorkspace::publish_diagnostics(const String &p_path) { GDScriptLanguageProtocol::get_singleton()->notify_client("textDocument/publishDiagnostics", params); } -void GDScriptWorkspace::_get_owners(EditorFileSystemDirectory *efsd, String p_path, List<String> &owners) { +void GDScriptWorkspace::_get_owners(EditorFileSystemDirectory *efsd, const String &p_path, List<String> &owners) { if (!efsd) { return; } @@ -613,7 +613,7 @@ void GDScriptWorkspace::_get_owners(EditorFileSystemDirectory *efsd, String p_pa } } -Node *GDScriptWorkspace::_get_owner_scene_node(String p_path) { +Node *GDScriptWorkspace::_get_owner_scene_node(const String &p_path) { Node *owner_scene_node = nullptr; List<String> owners; diff --git a/modules/gdscript/language_server/gdscript_workspace.h b/modules/gdscript/language_server/gdscript_workspace.h index 0b2d43b8174..569adba2d64 100644 --- a/modules/gdscript/language_server/gdscript_workspace.h +++ b/modules/gdscript/language_server/gdscript_workspace.h @@ -42,8 +42,8 @@ class GDScriptWorkspace : public RefCounted { GDCLASS(GDScriptWorkspace, RefCounted); private: - void _get_owners(EditorFileSystemDirectory *efsd, String p_path, List<String> &owners); - Node *_get_owner_scene_node(String p_path); + void _get_owners(EditorFileSystemDirectory *efsd, const String &p_path, List<String> &owners); + Node *_get_owner_scene_node(const String &p_path); protected: static void _bind_methods(); @@ -63,7 +63,7 @@ class GDScriptWorkspace : public RefCounted { void list_script_files(const String &p_root_dir, List<String> &r_files); - void apply_new_signal(Object *obj, String function, PackedStringArray args); + void apply_new_signal(Object *obj, const String &function, const PackedStringArray &args); public: String root; diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp index 025fcbd32a3..05135f8ecb9 100644 --- a/modules/gdscript/tests/gdscript_test_runner.cpp +++ b/modules/gdscript/tests/gdscript_test_runner.cpp @@ -175,7 +175,7 @@ static String strip_warnings(const String &p_expected) { // On release builds we don't have warnings. Here we remove them from the output before comparison // so it doesn't fail just because of difference in warnings. String expected_no_warnings; - for (String line : p_expected.split("\n")) { + for (const String &line : p_expected.split("\n")) { if (line.begins_with(">> ")) { continue; } diff --git a/modules/gltf/extensions/gltf_document_extension.cpp b/modules/gltf/extensions/gltf_document_extension.cpp index 9fdd6034a94..edfa4c0797e 100644 --- a/modules/gltf/extensions/gltf_document_extension.cpp +++ b/modules/gltf/extensions/gltf_document_extension.cpp @@ -55,7 +55,7 @@ void GLTFDocumentExtension::_bind_methods() { } // Import process. -Error GLTFDocumentExtension::import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions) { +Error GLTFDocumentExtension::import_preflight(Ref<GLTFState> p_state, const Vector<String> &p_extensions) { ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER); Error err = OK; GDVIRTUAL_CALL(_import_preflight, p_state, p_extensions, err); diff --git a/modules/gltf/extensions/gltf_document_extension.h b/modules/gltf/extensions/gltf_document_extension.h index 761dff725c2..2ba7ef4175b 100644 --- a/modules/gltf/extensions/gltf_document_extension.h +++ b/modules/gltf/extensions/gltf_document_extension.h @@ -43,7 +43,7 @@ class GLTFDocumentExtension : public Resource { public: // Import process. - virtual Error import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions); + virtual Error import_preflight(Ref<GLTFState> p_state, const Vector<String> &p_extensions); virtual Vector<String> get_supported_extensions(); virtual Error parse_node_extensions(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &p_extensions); virtual Error parse_image_data(Ref<GLTFState> p_state, const PackedByteArray &p_image_data, const String &p_mime_type, Ref<Image> r_image); diff --git a/modules/gltf/extensions/gltf_document_extension_texture_ktx.cpp b/modules/gltf/extensions/gltf_document_extension_texture_ktx.cpp index ca61a24201a..027e72275d1 100644 --- a/modules/gltf/extensions/gltf_document_extension_texture_ktx.cpp +++ b/modules/gltf/extensions/gltf_document_extension_texture_ktx.cpp @@ -31,7 +31,7 @@ #include "gltf_document_extension_texture_ktx.h" // Import process. -Error GLTFDocumentExtensionTextureKTX::import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions) { +Error GLTFDocumentExtensionTextureKTX::import_preflight(Ref<GLTFState> p_state, const Vector<String> &p_extensions) { if (!p_extensions.has("KHR_texture_basisu")) { return ERR_SKIP; } diff --git a/modules/gltf/extensions/gltf_document_extension_texture_ktx.h b/modules/gltf/extensions/gltf_document_extension_texture_ktx.h index e4cb38a0441..2438937e454 100644 --- a/modules/gltf/extensions/gltf_document_extension_texture_ktx.h +++ b/modules/gltf/extensions/gltf_document_extension_texture_ktx.h @@ -38,7 +38,7 @@ class GLTFDocumentExtensionTextureKTX : public GLTFDocumentExtension { public: // Import process. - Error import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions) override; + Error import_preflight(Ref<GLTFState> p_state, const Vector<String> &p_extensions) override; Vector<String> get_supported_extensions() override; Error parse_image_data(Ref<GLTFState> p_state, const PackedByteArray &p_image_data, const String &p_mime_type, Ref<Image> r_image) override; Error parse_texture_json(Ref<GLTFState> p_state, const Dictionary &p_texture_json, Ref<GLTFTexture> r_gltf_texture) override; diff --git a/modules/gltf/extensions/gltf_document_extension_texture_webp.cpp b/modules/gltf/extensions/gltf_document_extension_texture_webp.cpp index f8bd6d57cf2..035515eb1b9 100644 --- a/modules/gltf/extensions/gltf_document_extension_texture_webp.cpp +++ b/modules/gltf/extensions/gltf_document_extension_texture_webp.cpp @@ -31,7 +31,7 @@ #include "gltf_document_extension_texture_webp.h" // Import process. -Error GLTFDocumentExtensionTextureWebP::import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions) { +Error GLTFDocumentExtensionTextureWebP::import_preflight(Ref<GLTFState> p_state, const Vector<String> &p_extensions) { if (!p_extensions.has("EXT_texture_webp")) { return ERR_SKIP; } diff --git a/modules/gltf/extensions/gltf_document_extension_texture_webp.h b/modules/gltf/extensions/gltf_document_extension_texture_webp.h index 2113bd4768f..d31e4ea811a 100644 --- a/modules/gltf/extensions/gltf_document_extension_texture_webp.h +++ b/modules/gltf/extensions/gltf_document_extension_texture_webp.h @@ -38,7 +38,7 @@ class GLTFDocumentExtensionTextureWebP : public GLTFDocumentExtension { public: // Import process. - Error import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions) override; + Error import_preflight(Ref<GLTFState> p_state, const Vector<String> &p_extensions) override; Vector<String> get_supported_extensions() override; Error parse_image_data(Ref<GLTFState> p_state, const PackedByteArray &p_image_data, const String &p_mime_type, Ref<Image> r_image) override; String get_image_file_extension() override; diff --git a/modules/gltf/extensions/gltf_light.cpp b/modules/gltf/extensions/gltf_light.cpp index f6e91c16353..1fe5890e9bd 100644 --- a/modules/gltf/extensions/gltf_light.cpp +++ b/modules/gltf/extensions/gltf_light.cpp @@ -82,7 +82,7 @@ String GLTFLight::get_light_type() { return light_type; } -void GLTFLight::set_light_type(String p_light_type) { +void GLTFLight::set_light_type(const String &p_light_type) { light_type = p_light_type; } @@ -169,7 +169,7 @@ Light3D *GLTFLight::to_node() const { return memnew(Light3D); } -Ref<GLTFLight> GLTFLight::from_dictionary(const Dictionary p_dictionary) { +Ref<GLTFLight> GLTFLight::from_dictionary(const Dictionary &p_dictionary) { ERR_FAIL_COND_V_MSG(!p_dictionary.has("type"), Ref<GLTFLight>(), "Failed to parse glTF light, missing required field 'type'."); Ref<GLTFLight> light; light.instantiate(); diff --git a/modules/gltf/extensions/gltf_light.h b/modules/gltf/extensions/gltf_light.h index e0894fc8c66..3a211a40c3f 100644 --- a/modules/gltf/extensions/gltf_light.h +++ b/modules/gltf/extensions/gltf_light.h @@ -61,7 +61,7 @@ class GLTFLight : public Resource { void set_intensity(float p_intensity); String get_light_type(); - void set_light_type(String p_light_type); + void set_light_type(const String &p_light_type); float get_range(); void set_range(float p_range); @@ -75,7 +75,7 @@ class GLTFLight : public Resource { static Ref<GLTFLight> from_node(const Light3D *p_light); Light3D *to_node() const; - static Ref<GLTFLight> from_dictionary(const Dictionary p_dictionary); + static Ref<GLTFLight> from_dictionary(const Dictionary &p_dictionary); Dictionary to_dictionary() const; Variant get_additional_data(const StringName &p_extension_name); diff --git a/modules/gltf/extensions/physics/gltf_document_extension_physics.cpp b/modules/gltf/extensions/physics/gltf_document_extension_physics.cpp index 5c26a1686b2..9c4f23df5ed 100644 --- a/modules/gltf/extensions/physics/gltf_document_extension_physics.cpp +++ b/modules/gltf/extensions/physics/gltf_document_extension_physics.cpp @@ -34,7 +34,7 @@ #include "scene/3d/physics/static_body_3d.h" // Import process. -Error GLTFDocumentExtensionPhysics::import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions) { +Error GLTFDocumentExtensionPhysics::import_preflight(Ref<GLTFState> p_state, const Vector<String> &p_extensions) { if (!p_extensions.has("OMI_collider") && !p_extensions.has("OMI_physics_body") && !p_extensions.has("OMI_physics_shape")) { return ERR_SKIP; } diff --git a/modules/gltf/extensions/physics/gltf_document_extension_physics.h b/modules/gltf/extensions/physics/gltf_document_extension_physics.h index 3d5027c0dff..f076c92e9d1 100644 --- a/modules/gltf/extensions/physics/gltf_document_extension_physics.h +++ b/modules/gltf/extensions/physics/gltf_document_extension_physics.h @@ -40,7 +40,7 @@ class GLTFDocumentExtensionPhysics : public GLTFDocumentExtension { public: // Import process. - Error import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions) override; + Error import_preflight(Ref<GLTFState> p_state, const Vector<String> &p_extensions) override; Vector<String> get_supported_extensions() override; Error parse_node_extensions(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &p_extensions) override; Node3D *generate_scene_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Node *p_scene_parent) override; diff --git a/modules/gltf/extensions/physics/gltf_physics_body.cpp b/modules/gltf/extensions/physics/gltf_physics_body.cpp index c11aa5d2ff5..4389c088f0c 100644 --- a/modules/gltf/extensions/physics/gltf_physics_body.cpp +++ b/modules/gltf/extensions/physics/gltf_physics_body.cpp @@ -94,7 +94,7 @@ String GLTFPhysicsBody::get_body_type() const { return "rigid"; } -void GLTFPhysicsBody::set_body_type(String p_body_type) { +void GLTFPhysicsBody::set_body_type(const String &p_body_type) { if (p_body_type == "static") { body_type = PhysicsBodyType::STATIC; } else if (p_body_type == "animatable") { @@ -253,7 +253,7 @@ CollisionObject3D *GLTFPhysicsBody::to_node() const { return nullptr; } -Ref<GLTFPhysicsBody> GLTFPhysicsBody::from_dictionary(const Dictionary p_dictionary) { +Ref<GLTFPhysicsBody> GLTFPhysicsBody::from_dictionary(const Dictionary &p_dictionary) { Ref<GLTFPhysicsBody> physics_body; physics_body.instantiate(); Dictionary motion; diff --git a/modules/gltf/extensions/physics/gltf_physics_body.h b/modules/gltf/extensions/physics/gltf_physics_body.h index ec139054ff6..a37a170cdfd 100644 --- a/modules/gltf/extensions/physics/gltf_physics_body.h +++ b/modules/gltf/extensions/physics/gltf_physics_body.h @@ -69,7 +69,7 @@ class GLTFPhysicsBody : public Resource { public: String get_body_type() const; - void set_body_type(String p_body_type); + void set_body_type(const String &p_body_type); PhysicsBodyType get_physics_body_type() const; void set_physics_body_type(PhysicsBodyType p_body_type); @@ -100,7 +100,7 @@ class GLTFPhysicsBody : public Resource { static Ref<GLTFPhysicsBody> from_node(const CollisionObject3D *p_body_node); CollisionObject3D *to_node() const; - static Ref<GLTFPhysicsBody> from_dictionary(const Dictionary p_dictionary); + static Ref<GLTFPhysicsBody> from_dictionary(const Dictionary &p_dictionary); Dictionary to_dictionary() const; }; diff --git a/modules/gltf/extensions/physics/gltf_physics_shape.cpp b/modules/gltf/extensions/physics/gltf_physics_shape.cpp index 0340eb11b57..c4ab876f131 100644 --- a/modules/gltf/extensions/physics/gltf_physics_shape.cpp +++ b/modules/gltf/extensions/physics/gltf_physics_shape.cpp @@ -80,7 +80,7 @@ String GLTFPhysicsShape::get_shape_type() const { return shape_type; } -void GLTFPhysicsShape::set_shape_type(String p_shape_type) { +void GLTFPhysicsShape::set_shape_type(const String &p_shape_type) { shape_type = p_shape_type; } @@ -267,7 +267,7 @@ Ref<Shape3D> GLTFPhysicsShape::to_resource(bool p_cache_shapes) { return _shape_cache; } -Ref<GLTFPhysicsShape> GLTFPhysicsShape::from_dictionary(const Dictionary p_dictionary) { +Ref<GLTFPhysicsShape> GLTFPhysicsShape::from_dictionary(const Dictionary &p_dictionary) { ERR_FAIL_COND_V_MSG(!p_dictionary.has("type"), Ref<GLTFPhysicsShape>(), "Failed to parse GLTFPhysicsShape, missing required field 'type'."); Ref<GLTFPhysicsShape> gltf_shape; gltf_shape.instantiate(); diff --git a/modules/gltf/extensions/physics/gltf_physics_shape.h b/modules/gltf/extensions/physics/gltf_physics_shape.h index a6974473eea..728c73156aa 100644 --- a/modules/gltf/extensions/physics/gltf_physics_shape.h +++ b/modules/gltf/extensions/physics/gltf_physics_shape.h @@ -60,7 +60,7 @@ class GLTFPhysicsShape : public Resource { public: String get_shape_type() const; - void set_shape_type(String p_shape_type); + void set_shape_type(const String &p_shape_type); Vector3 get_size() const; void set_size(Vector3 p_size); @@ -86,7 +86,7 @@ class GLTFPhysicsShape : public Resource { static Ref<GLTFPhysicsShape> from_resource(const Ref<Shape3D> &p_shape_resource); Ref<Shape3D> to_resource(bool p_cache_shapes = false); - static Ref<GLTFPhysicsShape> from_dictionary(const Dictionary p_dictionary); + static Ref<GLTFPhysicsShape> from_dictionary(const Dictionary &p_dictionary); Dictionary to_dictionary() const; }; diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index d98b2505382..d82700484ab 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -1499,7 +1499,7 @@ Vector<double> GLTFDocument::_decode_accessor(Ref<GLTFState> p_state, const GLTF return dst_buffer; } -GLTFAccessorIndex GLTFDocument::_encode_accessor_as_ints(Ref<GLTFState> p_state, const Vector<int32_t> p_attribs, const bool p_for_vertex, const bool p_for_vertex_indices) { +GLTFAccessorIndex GLTFDocument::_encode_accessor_as_ints(Ref<GLTFState> p_state, const Vector<int32_t> &p_attribs, const bool p_for_vertex, const bool p_for_vertex_indices) { if (p_attribs.size() == 0) { return -1; } @@ -1620,7 +1620,7 @@ void GLTFDocument::_round_min_max_components(Vector<double> &r_type_min, Vector< } } -GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec2(Ref<GLTFState> p_state, const Vector<Vector2> p_attribs, const bool p_for_vertex) { +GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec2(Ref<GLTFState> p_state, const Vector<Vector2> &p_attribs, const bool p_for_vertex) { if (p_attribs.size() == 0) { return -1; } @@ -1670,7 +1670,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec2(Ref<GLTFState> p_state, return p_state->accessors.size() - 1; } -GLTFAccessorIndex GLTFDocument::_encode_accessor_as_color(Ref<GLTFState> p_state, const Vector<Color> p_attribs, const bool p_for_vertex) { +GLTFAccessorIndex GLTFDocument::_encode_accessor_as_color(Ref<GLTFState> p_state, const Vector<Color> &p_attribs, const bool p_for_vertex) { if (p_attribs.size() == 0) { return -1; } @@ -1723,7 +1723,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_color(Ref<GLTFState> p_state return p_state->accessors.size() - 1; } -void GLTFDocument::_calc_accessor_min_max(int p_i, const int p_element_count, Vector<double> &p_type_max, Vector<double> p_attribs, Vector<double> &p_type_min) { +void GLTFDocument::_calc_accessor_min_max(int p_i, const int p_element_count, Vector<double> &p_type_max, Vector<double> &p_attribs, Vector<double> &p_type_min) { if (p_i == 0) { for (int32_t type_i = 0; type_i < p_element_count; type_i++) { p_type_max.write[type_i] = p_attribs[(p_i * p_element_count) + type_i]; @@ -1736,7 +1736,7 @@ void GLTFDocument::_calc_accessor_min_max(int p_i, const int p_element_count, Ve } } -GLTFAccessorIndex GLTFDocument::_encode_accessor_as_weights(Ref<GLTFState> p_state, const Vector<Color> p_attribs, const bool p_for_vertex) { +GLTFAccessorIndex GLTFDocument::_encode_accessor_as_weights(Ref<GLTFState> p_state, const Vector<Color> &p_attribs, const bool p_for_vertex) { if (p_attribs.size() == 0) { return -1; } @@ -1790,7 +1790,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_weights(Ref<GLTFState> p_sta return p_state->accessors.size() - 1; } -GLTFAccessorIndex GLTFDocument::_encode_accessor_as_joints(Ref<GLTFState> p_state, const Vector<Color> p_attribs, const bool p_for_vertex) { +GLTFAccessorIndex GLTFDocument::_encode_accessor_as_joints(Ref<GLTFState> p_state, const Vector<Color> &p_attribs, const bool p_for_vertex) { if (p_attribs.size() == 0) { return -1; } @@ -1841,7 +1841,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_joints(Ref<GLTFState> p_stat return p_state->accessors.size() - 1; } -GLTFAccessorIndex GLTFDocument::_encode_accessor_as_quaternions(Ref<GLTFState> p_state, const Vector<Quaternion> p_attribs, const bool p_for_vertex) { +GLTFAccessorIndex GLTFDocument::_encode_accessor_as_quaternions(Ref<GLTFState> p_state, const Vector<Quaternion> &p_attribs, const bool p_for_vertex) { if (p_attribs.size() == 0) { return -1; } @@ -1920,7 +1920,7 @@ Vector<Vector2> GLTFDocument::_decode_accessor_as_vec2(Ref<GLTFState> p_state, c return ret; } -GLTFAccessorIndex GLTFDocument::_encode_accessor_as_floats(Ref<GLTFState> p_state, const Vector<real_t> p_attribs, const bool p_for_vertex) { +GLTFAccessorIndex GLTFDocument::_encode_accessor_as_floats(Ref<GLTFState> p_state, const Vector<real_t> &p_attribs, const bool p_for_vertex) { if (p_attribs.size() == 0) { return -1; } @@ -1969,7 +1969,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_floats(Ref<GLTFState> p_stat return p_state->accessors.size() - 1; } -GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec3(Ref<GLTFState> p_state, const Vector<Vector3> p_attribs, const bool p_for_vertex) { +GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec3(Ref<GLTFState> p_state, const Vector<Vector3> &p_attribs, const bool p_for_vertex) { if (p_attribs.size() == 0) { return -1; } @@ -2128,7 +2128,7 @@ GLTFAccessorIndex GLTFDocument::_encode_sparse_accessor_as_vec3(Ref<GLTFState> p return p_state->accessors.size() - 1; } -GLTFAccessorIndex GLTFDocument::_encode_accessor_as_xform(Ref<GLTFState> p_state, const Vector<Transform3D> p_attribs, const bool p_for_vertex) { +GLTFAccessorIndex GLTFDocument::_encode_accessor_as_xform(Ref<GLTFState> p_state, const Vector<Transform3D> &p_attribs, const bool p_for_vertex) { if (p_attribs.size() == 0) { return -1; } @@ -6657,7 +6657,7 @@ GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref<GLTFState> p_sta return p_track; } -void GLTFDocument::_convert_animation(Ref<GLTFState> p_state, AnimationPlayer *p_animation_player, String p_animation_track_name) { +void GLTFDocument::_convert_animation(Ref<GLTFState> p_state, AnimationPlayer *p_animation_player, const String &p_animation_track_name) { Ref<Animation> animation = p_animation_player->get_animation(p_animation_track_name); Ref<GLTFAnimation> gltf_animation; gltf_animation.instantiate(); @@ -6853,7 +6853,7 @@ void GLTFDocument::_convert_animation(Ref<GLTFState> p_state, AnimationPlayer *p } } -Error GLTFDocument::_parse(Ref<GLTFState> p_state, String p_path, Ref<FileAccess> p_file) { +Error GLTFDocument::_parse(Ref<GLTFState> p_state, const String &p_path, Ref<FileAccess> p_file) { Error err; if (p_file.is_null()) { return FAILED; @@ -6955,7 +6955,7 @@ Error GLTFDocument::_serialize_asset_header(Ref<GLTFState> p_state) { return OK; } -Error GLTFDocument::_serialize_file(Ref<GLTFState> p_state, const String p_path) { +Error GLTFDocument::_serialize_file(Ref<GLTFState> p_state, const String &p_path) { Error err = FAILED; if (p_path.to_lower().ends_with("glb")) { err = _encode_buffer_glb(p_state, p_path); @@ -7378,7 +7378,7 @@ Error GLTFDocument::append_from_scene(Node *p_node, Ref<GLTFState> p_state, uint return OK; } -Error GLTFDocument::append_from_buffer(PackedByteArray p_bytes, String p_base_path, Ref<GLTFState> p_state, uint32_t p_flags) { +Error GLTFDocument::append_from_buffer(const PackedByteArray &p_bytes, const String &p_base_path, Ref<GLTFState> p_state, uint32_t p_flags) { Ref<GLTFState> state = p_state; ERR_FAIL_COND_V(state.is_null(), FAILED); // TODO Add missing texture and missing .bin file paths to r_missing_deps 2021-09-10 fire @@ -7402,7 +7402,7 @@ Error GLTFDocument::append_from_buffer(PackedByteArray p_bytes, String p_base_pa return OK; } -Error GLTFDocument::append_from_file(String p_path, Ref<GLTFState> p_state, uint32_t p_flags, String p_base_path) { +Error GLTFDocument::append_from_file(const String &p_path, Ref<GLTFState> p_state, uint32_t p_flags, const String &p_base_path) { Ref<GLTFState> state = p_state; // TODO Add missing texture and missing .bin file paths to r_missing_deps 2021-09-10 fire if (state == Ref<GLTFState>()) { diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h index d37544750d3..b6f94e799da 100644 --- a/modules/gltf/gltf_document.h +++ b/modules/gltf/gltf_document.h @@ -218,19 +218,19 @@ class GLTFDocument : public Resource { const float p_time, const GLTFAnimation::Interpolation p_interp); GLTFAccessorIndex _encode_accessor_as_quaternions(Ref<GLTFState> p_state, - const Vector<Quaternion> p_attribs, + const Vector<Quaternion> &p_attribs, const bool p_for_vertex); GLTFAccessorIndex _encode_accessor_as_weights(Ref<GLTFState> p_state, - const Vector<Color> p_attribs, + const Vector<Color> &p_attribs, const bool p_for_vertex); GLTFAccessorIndex _encode_accessor_as_joints(Ref<GLTFState> p_state, - const Vector<Color> p_attribs, + const Vector<Color> &p_attribs, const bool p_for_vertex); GLTFAccessorIndex _encode_accessor_as_floats(Ref<GLTFState> p_state, - const Vector<real_t> p_attribs, + const Vector<real_t> &p_attribs, const bool p_for_vertex); GLTFAccessorIndex _encode_accessor_as_vec2(Ref<GLTFState> p_state, - const Vector<Vector2> p_attribs, + const Vector<Vector2> &p_attribs, const bool p_for_vertex); void _calc_accessor_vec2_min_max(int p_i, const int p_element_count, Vector<double> &p_type_max, Vector2 p_attribs, Vector<double> &p_type_min) { @@ -249,21 +249,21 @@ class GLTFDocument : public Resource { } GLTFAccessorIndex _encode_accessor_as_vec3(Ref<GLTFState> p_state, - const Vector<Vector3> p_attribs, + const Vector<Vector3> &p_attribs, const bool p_for_vertex); GLTFAccessorIndex _encode_sparse_accessor_as_vec3(Ref<GLTFState> p_state, const Vector<Vector3> p_attribs, const Vector<Vector3> p_reference_attribs, const float p_reference_multiplier, const bool p_for_vertex, const GLTFAccessorIndex p_reference_accessor); GLTFAccessorIndex _encode_accessor_as_color(Ref<GLTFState> p_state, - const Vector<Color> p_attribs, + const Vector<Color> &p_attribs, const bool p_for_vertex); - void _calc_accessor_min_max(int p_i, const int p_element_count, Vector<double> &p_type_max, Vector<double> p_attribs, Vector<double> &p_type_min); + void _calc_accessor_min_max(int p_i, const int p_element_count, Vector<double> &p_type_max, Vector<double> &p_attribs, Vector<double> &p_type_min); GLTFAccessorIndex _encode_accessor_as_ints(Ref<GLTFState> p_state, - const Vector<int32_t> p_attribs, + const Vector<int32_t> &p_attribs, const bool p_for_vertex, const bool p_for_indices); GLTFAccessorIndex _encode_accessor_as_xform(Ref<GLTFState> p_state, - const Vector<Transform3D> p_attribs, + const Vector<Transform3D> &p_attribs, const bool p_for_vertex); Error _encode_buffer_view(Ref<GLTFState> p_state, const double *p_src, const int p_count, const GLTFAccessor::GLTFAccessorType p_accessor_type, @@ -289,7 +289,7 @@ class GLTFDocument : public Resource { Dictionary _serialize_texture_transform_uv1(Ref<BaseMaterial3D> p_material); Dictionary _serialize_texture_transform_uv2(Ref<BaseMaterial3D> p_material); Error _serialize_asset_header(Ref<GLTFState> p_state); - Error _serialize_file(Ref<GLTFState> p_state, const String p_path); + Error _serialize_file(Ref<GLTFState> p_state, const String &p_path); Error _serialize_gltf_extensions(Ref<GLTFState> p_state) const; public: @@ -309,8 +309,8 @@ class GLTFDocument : public Resource { static float get_max_component(const Color &p_color); public: - virtual Error append_from_file(String p_path, Ref<GLTFState> p_state, uint32_t p_flags = 0, String p_base_path = String()); - virtual Error append_from_buffer(PackedByteArray p_bytes, String p_base_path, Ref<GLTFState> p_state, uint32_t p_flags = 0); + virtual Error append_from_file(const String &p_path, Ref<GLTFState> p_state, uint32_t p_flags = 0, const String &p_base_path = String()); + virtual Error append_from_buffer(const PackedByteArray &p_bytes, const String &p_base_path, Ref<GLTFState> p_state, uint32_t p_flags = 0); virtual Error append_from_scene(Node *p_node, Ref<GLTFState> p_state, uint32_t p_flags = 0); virtual Node *generate_scene(Ref<GLTFState> p_state, float p_bake_fps = 30.0f, bool p_trimming = false, bool p_remove_immutable_tracks = true); @@ -381,9 +381,9 @@ class GLTFDocument : public Resource { Ref<GLTFNode> p_gltf_node); GLTFMeshIndex _convert_mesh_to_gltf(Ref<GLTFState> p_state, MeshInstance3D *p_mesh_instance); - void _convert_animation(Ref<GLTFState> p_state, AnimationPlayer *p_animation_player, String p_animation_track_name); + void _convert_animation(Ref<GLTFState> p_state, AnimationPlayer *p_animation_player, const String &p_animation_track_name); Error _serialize(Ref<GLTFState> p_state); - Error _parse(Ref<GLTFState> p_state, String p_path, Ref<FileAccess> p_file); + Error _parse(Ref<GLTFState> p_state, const String &p_path, Ref<FileAccess> p_file); }; VARIANT_ENUM_CAST(GLTFDocument::RootNodeMode); diff --git a/modules/gltf/gltf_state.cpp b/modules/gltf/gltf_state.cpp index 73a61ff77f2..c5553dd4758 100644 --- a/modules/gltf/gltf_state.cpp +++ b/modules/gltf/gltf_state.cpp @@ -155,7 +155,7 @@ Dictionary GLTFState::get_json() { return json; } -void GLTFState::set_json(Dictionary p_json) { +void GLTFState::set_json(const Dictionary &p_json) { json = p_json; } @@ -187,7 +187,7 @@ Vector<uint8_t> GLTFState::get_glb_data() { return glb_data; } -void GLTFState::set_glb_data(Vector<uint8_t> p_glb_data) { +void GLTFState::set_glb_data(const Vector<uint8_t> &p_glb_data) { glb_data = p_glb_data; } @@ -251,7 +251,7 @@ String GLTFState::get_scene_name() { return scene_name; } -void GLTFState::set_scene_name(String p_scene_name) { +void GLTFState::set_scene_name(const String &p_scene_name) { scene_name = p_scene_name; } @@ -259,7 +259,7 @@ PackedInt32Array GLTFState::get_root_nodes() { return root_nodes; } -void GLTFState::set_root_nodes(PackedInt32Array p_root_nodes) { +void GLTFState::set_root_nodes(const PackedInt32Array &p_root_nodes) { root_nodes = p_root_nodes; } @@ -396,7 +396,7 @@ String GLTFState::get_base_path() { return base_path; } -void GLTFState::set_base_path(String p_base_path) { +void GLTFState::set_base_path(const String &p_base_path) { base_path = p_base_path; } @@ -412,7 +412,7 @@ Variant GLTFState::get_additional_data(const StringName &p_extension_name) { return additional_data[p_extension_name]; } -void GLTFState::set_additional_data(const StringName &p_extension_name, Variant p_additional_data) { +void GLTFState::set_additional_data(const StringName &p_extension_name, const Variant &p_additional_data) { additional_data[p_extension_name] = p_additional_data; } diff --git a/modules/gltf/gltf_state.h b/modules/gltf/gltf_state.h index 07efafe13bf..0f1caef4ab3 100644 --- a/modules/gltf/gltf_state.h +++ b/modules/gltf/gltf_state.h @@ -134,7 +134,7 @@ class GLTFState : public Resource { } Dictionary get_json(); - void set_json(Dictionary p_json); + void set_json(const Dictionary &p_json); int get_major_version(); void set_major_version(int p_major_version); @@ -146,7 +146,7 @@ class GLTFState : public Resource { void set_copyright(const String &p_copyright); Vector<uint8_t> get_glb_data(); - void set_glb_data(Vector<uint8_t> p_glb_data); + void set_glb_data(const Vector<uint8_t> &p_glb_data); bool get_use_named_skin_binds(); void set_use_named_skin_binds(bool p_use_named_skin_binds); @@ -182,16 +182,16 @@ class GLTFState : public Resource { void set_materials(TypedArray<Material> p_materials); String get_scene_name(); - void set_scene_name(String p_scene_name); + void set_scene_name(const String &p_scene_name); String get_base_path(); - void set_base_path(String p_base_path); + void set_base_path(const String &p_base_path); String get_filename() const; void set_filename(const String &p_filename); PackedInt32Array get_root_nodes(); - void set_root_nodes(PackedInt32Array p_root_nodes); + void set_root_nodes(const PackedInt32Array &p_root_nodes); TypedArray<GLTFTexture> get_textures(); void set_textures(TypedArray<GLTFTexture> p_textures); @@ -237,7 +237,7 @@ class GLTFState : public Resource { AnimationPlayer *get_animation_player(int idx); Variant get_additional_data(const StringName &p_extension_name); - void set_additional_data(const StringName &p_extension_name, Variant p_additional_data); + void set_additional_data(const StringName &p_extension_name, const Variant &p_additional_data); }; #endif // GLTF_STATE_H diff --git a/modules/gltf/structures/gltf_accessor.cpp b/modules/gltf/structures/gltf_accessor.cpp index 1ebc00a5146..dc9701be848 100644 --- a/modules/gltf/structures/gltf_accessor.cpp +++ b/modules/gltf/structures/gltf_accessor.cpp @@ -147,7 +147,7 @@ Vector<double> GLTFAccessor::get_min() { return min; } -void GLTFAccessor::set_min(Vector<double> p_min) { +void GLTFAccessor::set_min(const Vector<double> &p_min) { min = p_min; } @@ -155,7 +155,7 @@ Vector<double> GLTFAccessor::get_max() { return max; } -void GLTFAccessor::set_max(Vector<double> p_max) { +void GLTFAccessor::set_max(const Vector<double> &p_max) { max = p_max; } diff --git a/modules/gltf/structures/gltf_accessor.h b/modules/gltf/structures/gltf_accessor.h index 1a3a2cb4943..ee8569ee8d5 100644 --- a/modules/gltf/structures/gltf_accessor.h +++ b/modules/gltf/structures/gltf_accessor.h @@ -92,10 +92,10 @@ struct GLTFAccessor : public Resource { void set_type(int p_accessor_type); Vector<double> get_min(); - void set_min(Vector<double> p_min); + void set_min(const Vector<double> &p_min); Vector<double> get_max(); - void set_max(Vector<double> p_max); + void set_max(const Vector<double> &p_max); int get_sparse_count(); void set_sparse_count(int p_sparse_count); diff --git a/modules/gltf/structures/gltf_camera.cpp b/modules/gltf/structures/gltf_camera.cpp index 863e1df967a..96c0ee0ceb5 100644 --- a/modules/gltf/structures/gltf_camera.cpp +++ b/modules/gltf/structures/gltf_camera.cpp @@ -83,7 +83,7 @@ Camera3D *GLTFCamera::to_node() const { return camera; } -Ref<GLTFCamera> GLTFCamera::from_dictionary(const Dictionary p_dictionary) { +Ref<GLTFCamera> GLTFCamera::from_dictionary(const Dictionary &p_dictionary) { ERR_FAIL_COND_V_MSG(!p_dictionary.has("type"), Ref<GLTFCamera>(), "Failed to parse glTF camera, missing required field 'type'."); Ref<GLTFCamera> camera; camera.instantiate(); diff --git a/modules/gltf/structures/gltf_camera.h b/modules/gltf/structures/gltf_camera.h index 1a583c82ccb..05d0df22ddf 100644 --- a/modules/gltf/structures/gltf_camera.h +++ b/modules/gltf/structures/gltf_camera.h @@ -68,7 +68,7 @@ class GLTFCamera : public Resource { static Ref<GLTFCamera> from_node(const Camera3D *p_camera); Camera3D *to_node() const; - static Ref<GLTFCamera> from_dictionary(const Dictionary p_dictionary); + static Ref<GLTFCamera> from_dictionary(const Dictionary &p_dictionary); virtual Dictionary to_dictionary() const; }; diff --git a/modules/gltf/structures/gltf_mesh.cpp b/modules/gltf/structures/gltf_mesh.cpp index 9566cc2379b..31b9577f441 100644 --- a/modules/gltf/structures/gltf_mesh.cpp +++ b/modules/gltf/structures/gltf_mesh.cpp @@ -78,7 +78,7 @@ Vector<float> GLTFMesh::get_blend_weights() { return blend_weights; } -void GLTFMesh::set_blend_weights(Vector<float> p_blend_weights) { +void GLTFMesh::set_blend_weights(const Vector<float> &p_blend_weights) { blend_weights = p_blend_weights; } diff --git a/modules/gltf/structures/gltf_mesh.h b/modules/gltf/structures/gltf_mesh.h index 6983efeb2ae..4df2dc342aa 100644 --- a/modules/gltf/structures/gltf_mesh.h +++ b/modules/gltf/structures/gltf_mesh.h @@ -54,7 +54,7 @@ class GLTFMesh : public Resource { Ref<ImporterMesh> get_mesh(); void set_mesh(Ref<ImporterMesh> p_mesh); Vector<float> get_blend_weights(); - void set_blend_weights(Vector<float> p_blend_weights); + void set_blend_weights(const Vector<float> &p_blend_weights); TypedArray<Material> get_instance_materials(); void set_instance_materials(TypedArray<Material> p_instance_materials); Variant get_additional_data(const StringName &p_extension_name); diff --git a/modules/gltf/structures/gltf_node.cpp b/modules/gltf/structures/gltf_node.cpp index 2934e4b5ee6..33d1201d471 100644 --- a/modules/gltf/structures/gltf_node.cpp +++ b/modules/gltf/structures/gltf_node.cpp @@ -166,7 +166,7 @@ Vector<int> GLTFNode::get_children() { return children; } -void GLTFNode::set_children(Vector<int> p_children) { +void GLTFNode::set_children(const Vector<int> &p_children) { children = p_children; } @@ -182,6 +182,6 @@ Variant GLTFNode::get_additional_data(const StringName &p_extension_name) { return additional_data[p_extension_name]; } -void GLTFNode::set_additional_data(const StringName &p_extension_name, Variant p_additional_data) { +void GLTFNode::set_additional_data(const StringName &p_extension_name, const Variant &p_additional_data) { additional_data[p_extension_name] = p_additional_data; } diff --git a/modules/gltf/structures/gltf_node.h b/modules/gltf/structures/gltf_node.h index 63399fb32bc..3a6fae7ce31 100644 --- a/modules/gltf/structures/gltf_node.h +++ b/modules/gltf/structures/gltf_node.h @@ -96,13 +96,13 @@ class GLTFNode : public Resource { void set_scale(Vector3 p_scale); Vector<int> get_children(); - void set_children(Vector<int> p_children); + void set_children(const Vector<int> &p_children); GLTFLightIndex get_light(); void set_light(GLTFLightIndex p_light); Variant get_additional_data(const StringName &p_extension_name); - void set_additional_data(const StringName &p_extension_name, Variant p_additional_data); + void set_additional_data(const StringName &p_extension_name, const Variant &p_additional_data); }; #endif // GLTF_NODE_H diff --git a/modules/gltf/structures/gltf_skin.cpp b/modules/gltf/structures/gltf_skin.cpp index 18aa90a628c..3bf43b85208 100644 --- a/modules/gltf/structures/gltf_skin.cpp +++ b/modules/gltf/structures/gltf_skin.cpp @@ -81,7 +81,7 @@ Vector<GLTFNodeIndex> GLTFSkin::get_joints_original() { return joints_original; } -void GLTFSkin::set_joints_original(Vector<GLTFNodeIndex> p_joints_original) { +void GLTFSkin::set_joints_original(const Vector<GLTFNodeIndex> &p_joints_original) { joints_original = p_joints_original; } @@ -97,7 +97,7 @@ Vector<GLTFNodeIndex> GLTFSkin::get_joints() { return joints; } -void GLTFSkin::set_joints(Vector<GLTFNodeIndex> p_joints) { +void GLTFSkin::set_joints(const Vector<GLTFNodeIndex> &p_joints) { joints = p_joints; } @@ -105,7 +105,7 @@ Vector<GLTFNodeIndex> GLTFSkin::get_non_joints() { return non_joints; } -void GLTFSkin::set_non_joints(Vector<GLTFNodeIndex> p_non_joints) { +void GLTFSkin::set_non_joints(const Vector<GLTFNodeIndex> &p_non_joints) { non_joints = p_non_joints; } @@ -113,7 +113,7 @@ Vector<GLTFNodeIndex> GLTFSkin::get_roots() { return roots; } -void GLTFSkin::set_roots(Vector<GLTFNodeIndex> p_roots) { +void GLTFSkin::set_roots(const Vector<GLTFNodeIndex> &p_roots) { roots = p_roots; } @@ -129,7 +129,7 @@ Dictionary GLTFSkin::get_joint_i_to_bone_i() { return GLTFTemplateConvert::to_dictionary(joint_i_to_bone_i); } -void GLTFSkin::set_joint_i_to_bone_i(Dictionary p_joint_i_to_bone_i) { +void GLTFSkin::set_joint_i_to_bone_i(const Dictionary &p_joint_i_to_bone_i) { GLTFTemplateConvert::set_from_dictionary(joint_i_to_bone_i, p_joint_i_to_bone_i); } @@ -143,7 +143,7 @@ Dictionary GLTFSkin::get_joint_i_to_name() { return ret; } -void GLTFSkin::set_joint_i_to_name(Dictionary p_joint_i_to_name) { +void GLTFSkin::set_joint_i_to_name(const Dictionary &p_joint_i_to_name) { joint_i_to_name = HashMap<int, StringName>(); Array keys = p_joint_i_to_name.keys(); for (int i = 0; i < keys.size(); i++) { diff --git a/modules/gltf/structures/gltf_skin.h b/modules/gltf/structures/gltf_skin.h index 4649a918e3f..bedec36b75b 100644 --- a/modules/gltf/structures/gltf_skin.h +++ b/modules/gltf/structures/gltf_skin.h @@ -87,28 +87,28 @@ class GLTFSkin : public Resource { void set_skin_root(GLTFNodeIndex p_skin_root); Vector<GLTFNodeIndex> get_joints_original(); - void set_joints_original(Vector<GLTFNodeIndex> p_joints_original); + void set_joints_original(const Vector<GLTFNodeIndex> &p_joints_original); TypedArray<Transform3D> get_inverse_binds(); void set_inverse_binds(TypedArray<Transform3D> p_inverse_binds); Vector<GLTFNodeIndex> get_joints(); - void set_joints(Vector<GLTFNodeIndex> p_joints); + void set_joints(const Vector<GLTFNodeIndex> &p_joints); Vector<GLTFNodeIndex> get_non_joints(); - void set_non_joints(Vector<GLTFNodeIndex> p_non_joints); + void set_non_joints(const Vector<GLTFNodeIndex> &p_non_joints); Vector<GLTFNodeIndex> get_roots(); - void set_roots(Vector<GLTFNodeIndex> p_roots); + void set_roots(const Vector<GLTFNodeIndex> &p_roots); int get_skeleton(); void set_skeleton(int p_skeleton); Dictionary get_joint_i_to_bone_i(); - void set_joint_i_to_bone_i(Dictionary p_joint_i_to_bone_i); + void set_joint_i_to_bone_i(const Dictionary &p_joint_i_to_bone_i); Dictionary get_joint_i_to_name(); - void set_joint_i_to_name(Dictionary p_joint_i_to_name); + void set_joint_i_to_name(const Dictionary &p_joint_i_to_name); Ref<Skin> get_godot_skin(); void set_godot_skin(Ref<Skin> p_godot_skin); diff --git a/modules/lightmapper_rd/lightmapper_rd.cpp b/modules/lightmapper_rd/lightmapper_rd.cpp index 33b0b0d0152..db3f72a479e 100644 --- a/modules/lightmapper_rd/lightmapper_rd.cpp +++ b/modules/lightmapper_rd/lightmapper_rd.cpp @@ -659,7 +659,7 @@ void LightmapperRD::_create_acceleration_structures(RenderingDevice *rd, Size2i } } -void LightmapperRD::_raster_geometry(RenderingDevice *rd, Size2i atlas_size, int atlas_slices, int grid_size, AABB bounds, float p_bias, Vector<int> slice_triangle_count, RID position_tex, RID unocclude_tex, RID normal_tex, RID raster_depth_buffer, RID rasterize_shader, RID raster_base_uniform) { +void LightmapperRD::_raster_geometry(RenderingDevice *rd, Size2i atlas_size, int atlas_slices, int grid_size, AABB bounds, float p_bias, const Vector<int> &slice_triangle_count, RID position_tex, RID unocclude_tex, RID normal_tex, RID raster_depth_buffer, RID rasterize_shader, RID raster_base_uniform) { Vector<RID> framebuffers; for (int i = 0; i < atlas_slices; i++) { diff --git a/modules/lightmapper_rd/lightmapper_rd.h b/modules/lightmapper_rd/lightmapper_rd.h index 487c44a480a..be1c9882a53 100644 --- a/modules/lightmapper_rd/lightmapper_rd.h +++ b/modules/lightmapper_rd/lightmapper_rd.h @@ -269,7 +269,7 @@ class LightmapperRD : public Lightmapper { BakeError _blit_meshes_into_atlas(int p_max_texture_size, int p_denoiser_range, Vector<Ref<Image>> &albedo_images, Vector<Ref<Image>> &emission_images, AABB &bounds, Size2i &atlas_size, int &atlas_slices, BakeStepFunc p_step_function, void *p_bake_userdata); void _create_acceleration_structures(RenderingDevice *rd, Size2i atlas_size, int atlas_slices, AABB &bounds, int grid_size, uint32_t p_cluster_size, Vector<Probe> &probe_positions, GenerateProbes p_generate_probes, Vector<int> &slice_triangle_count, Vector<int> &slice_seam_count, RID &vertex_buffer, RID &triangle_buffer, RID &lights_buffer, RID &r_triangle_indices_buffer, RID &r_cluster_indices_buffer, RID &r_cluster_aabbs_buffer, RID &probe_positions_buffer, RID &grid_texture, RID &seams_buffer, BakeStepFunc p_step_function, void *p_bake_userdata); - void _raster_geometry(RenderingDevice *rd, Size2i atlas_size, int atlas_slices, int grid_size, AABB bounds, float p_bias, Vector<int> slice_triangle_count, RID position_tex, RID unocclude_tex, RID normal_tex, RID raster_depth_buffer, RID rasterize_shader, RID raster_base_uniform); + void _raster_geometry(RenderingDevice *rd, Size2i atlas_size, int atlas_slices, int grid_size, AABB bounds, float p_bias, const Vector<int> &slice_triangle_count, RID position_tex, RID unocclude_tex, RID normal_tex, RID raster_depth_buffer, RID rasterize_shader, RID raster_base_uniform); BakeError _dilate(RenderingDevice *rd, Ref<RDShaderFile> &compute_shader, RID &compute_base_uniform_set, PushConstant &push_constant, RID &source_light_tex, RID &dest_light_tex, const Size2i &atlas_size, int atlas_slices); BakeError _denoise(RenderingDevice *p_rd, Ref<RDShaderFile> &p_compute_shader, const RID &p_compute_base_uniform_set, PushConstant &p_push_constant, RID p_source_light_tex, RID p_source_normal_tex, RID p_dest_light_tex, float p_denoiser_strength, int p_denoiser_range, const Size2i &p_atlas_size, int p_atlas_slices, bool p_bake_sh, BakeStepFunc p_step_function); diff --git a/modules/mbedtls/tests/test_crypto_mbedtls.cpp b/modules/mbedtls/tests/test_crypto_mbedtls.cpp index b96a0721468..6718ec08070 100644 --- a/modules/mbedtls/tests/test_crypto_mbedtls.cpp +++ b/modules/mbedtls/tests/test_crypto_mbedtls.cpp @@ -37,7 +37,7 @@ namespace TestCryptoMbedTLS { -void hmac_digest_test(HashingContext::HashType ht, String expected_hex) { +void hmac_digest_test(HashingContext::HashType ht, const String &expected_hex) { CryptoMbedTLS crypto; PackedByteArray key = String("supersecretkey").to_utf8_buffer(); PackedByteArray msg = String("Return of the MAC!").to_utf8_buffer(); @@ -46,7 +46,7 @@ void hmac_digest_test(HashingContext::HashType ht, String expected_hex) { CHECK(hex == expected_hex); } -void hmac_context_digest_test(HashingContext::HashType ht, String expected_hex) { +void hmac_context_digest_test(HashingContext::HashType ht, const String &expected_hex) { HMACContextMbedTLS ctx; PackedByteArray key = String("supersecretkey").to_utf8_buffer(); PackedByteArray msg1 = String("Return of ").to_utf8_buffer(); diff --git a/modules/mbedtls/tests/test_crypto_mbedtls.h b/modules/mbedtls/tests/test_crypto_mbedtls.h index 5ec78d18a3c..d74260a31bd 100644 --- a/modules/mbedtls/tests/test_crypto_mbedtls.h +++ b/modules/mbedtls/tests/test_crypto_mbedtls.h @@ -39,7 +39,7 @@ namespace TestCryptoMbedTLS { -void hmac_digest_test(HashingContext::HashType ht, String expected_hex); +void hmac_digest_test(HashingContext::HashType ht, const String &expected_hex); TEST_CASE("[CryptoMbedTLS] HMAC digest") { // SHA-256 @@ -49,7 +49,7 @@ TEST_CASE("[CryptoMbedTLS] HMAC digest") { hmac_digest_test(HashingContext::HashType::HASH_SHA1, "a0ac4cd68a2f4812c355983d94e8d025afe7dddf"); } -void hmac_context_digest_test(HashingContext::HashType ht, String expected_hex); +void hmac_context_digest_test(HashingContext::HashType ht, const String &expected_hex); TEST_CASE("[HMACContext] HMAC digest") { // SHA-256 diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 36c8a40ed9a..bd9c40a95e2 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -344,7 +344,7 @@ void CSharpLanguage::get_string_delimiters(List<String> *p_delimiters) const { // Generic string highlighting suffices as a workaround for now. } -static String get_base_class_name(const String &p_base_class_name, const String p_class_name) { +static String get_base_class_name(const String &p_base_class_name, const String &p_class_name) { String base_class = pascal_to_pascal_case(p_base_class_name); if (p_class_name == base_class) { base_class = "Godot." + base_class; diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 9a76a256395..d1a3f902af5 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -4843,7 +4843,7 @@ void BindingsGenerator::_initialize() { static String generate_all_glue_option = "--generate-mono-glue"; -static void handle_cmdline_options(String glue_dir_path) { +static void handle_cmdline_options(const String &glue_dir_path) { BindingsGenerator bindings_generator; bindings_generator.set_log_print_enabled(true); diff --git a/modules/mono/utils/naming_utils.cpp b/modules/mono/utils/naming_utils.cpp index 62fbf815f8d..fdca68be19b 100644 --- a/modules/mono/utils/naming_utils.cpp +++ b/modules/mono/utils/naming_utils.cpp @@ -33,7 +33,7 @@ #include "core/string/ucaps.h" #include "core/templates/hash_map.h" -HashMap<String, String> _create_hashmap_from_vector(Vector<Pair<String, String>> vector) { +HashMap<String, String> _create_hashmap_from_vector(const Vector<Pair<String, String>> &vector) { HashMap<String, String> hashmap = HashMap<String, String>(vector.size()); for (const Pair<String, String> &pair : vector) { hashmap.insert(pair.first, pair.second); diff --git a/modules/multiplayer/editor/replication_editor.cpp b/modules/multiplayer/editor/replication_editor.cpp index 851ad858769..158a917adaf 100644 --- a/modules/multiplayer/editor/replication_editor.cpp +++ b/modules/multiplayer/editor/replication_editor.cpp @@ -136,7 +136,7 @@ void ReplicationEditor::_pick_new_property() { pick_node->get_filter_line_edit()->grab_focus(); } -void ReplicationEditor::_add_sync_property(String p_path) { +void ReplicationEditor::_add_sync_property(const String &p_path) { config = current->get_replication_config(); if (config.is_valid() && config->has_property(p_path)) { @@ -162,7 +162,7 @@ void ReplicationEditor::_add_sync_property(String p_path) { undo_redo->commit_action(); } -void ReplicationEditor::_pick_node_property_selected(String p_name) { +void ReplicationEditor::_pick_node_property_selected(const String &p_name) { String adding_prop_path = String(adding_node_path) + ":" + p_name; _add_sync_property(adding_prop_path); diff --git a/modules/multiplayer/editor/replication_editor.h b/modules/multiplayer/editor/replication_editor.h index 8f117742923..2702b834f32 100644 --- a/modules/multiplayer/editor/replication_editor.h +++ b/modules/multiplayer/editor/replication_editor.h @@ -85,12 +85,12 @@ class ReplicationEditor : public VBoxContainer { void _pick_node_selected(NodePath p_path); void _pick_new_property(); - void _pick_node_property_selected(String p_name); + void _pick_node_property_selected(const String &p_name); bool _can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; void _drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); - void _add_sync_property(String p_path); + void _add_sync_property(const String &p_path); protected: static void _bind_methods(); diff --git a/modules/multiplayer/multiplayer_spawner.h b/modules/multiplayer/multiplayer_spawner.h index 0e94b781eaa..0b7876921ff 100644 --- a/modules/multiplayer/multiplayer_spawner.h +++ b/modules/multiplayer/multiplayer_spawner.h @@ -60,7 +60,7 @@ class MultiplayerSpawner : public Node { struct SpawnInfo { Variant args; int id = INVALID_ID; - SpawnInfo(Variant p_args, int p_id) { + SpawnInfo(const Variant &p_args, int p_id) { id = p_id; args = p_args; } diff --git a/modules/multiplayer/scene_multiplayer.cpp b/modules/multiplayer/scene_multiplayer.cpp index e245101eebd..b49e5c5df12 100644 --- a/modules/multiplayer/scene_multiplayer.cpp +++ b/modules/multiplayer/scene_multiplayer.cpp @@ -438,7 +438,7 @@ void SceneMultiplayer::disconnect_peer(int p_id) { multiplayer_peer->disconnect_peer(p_id); } -Error SceneMultiplayer::send_bytes(Vector<uint8_t> p_data, int p_to, MultiplayerPeer::TransferMode p_mode, int p_channel) { +Error SceneMultiplayer::send_bytes(const Vector<uint8_t> &p_data, int p_to, MultiplayerPeer::TransferMode p_mode, int p_channel) { ERR_FAIL_COND_V_MSG(p_data.is_empty(), ERR_INVALID_DATA, "Trying to send an empty raw packet."); ERR_FAIL_COND_V_MSG(!multiplayer_peer.is_valid(), ERR_UNCONFIGURED, "Trying to send a raw packet while no multiplayer peer is active."); ERR_FAIL_COND_V_MSG(multiplayer_peer->get_connection_status() != MultiplayerPeer::CONNECTION_CONNECTED, ERR_UNCONFIGURED, "Trying to send a raw packet via a multiplayer peer which is not connected."); @@ -456,7 +456,7 @@ Error SceneMultiplayer::send_bytes(Vector<uint8_t> p_data, int p_to, Multiplayer return send_command(p_to, packet_cache.ptr(), p_data.size() + 1); } -Error SceneMultiplayer::send_auth(int p_to, Vector<uint8_t> p_data) { +Error SceneMultiplayer::send_auth(int p_to, const Vector<uint8_t> &p_data) { ERR_FAIL_COND_V(multiplayer_peer.is_null() || multiplayer_peer->get_connection_status() != MultiplayerPeer::CONNECTION_CONNECTED, ERR_UNCONFIGURED); ERR_FAIL_COND_V(!pending_peers.has(p_to), ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(p_data.is_empty(), ERR_INVALID_PARAMETER); @@ -581,7 +581,7 @@ Error SceneMultiplayer::rpcp(Object *p_obj, int p_peer_id, const StringName &p_m return rpc->rpcp(p_obj, p_peer_id, p_method, p_arg, p_argcount); } -Error SceneMultiplayer::object_configuration_add(Object *p_obj, Variant p_config) { +Error SceneMultiplayer::object_configuration_add(Object *p_obj, const Variant &p_config) { if (p_obj == nullptr && p_config.get_type() == Variant::NODE_PATH) { set_root_path(p_config); return OK; @@ -596,7 +596,7 @@ Error SceneMultiplayer::object_configuration_add(Object *p_obj, Variant p_config return ERR_INVALID_PARAMETER; } -Error SceneMultiplayer::object_configuration_remove(Object *p_obj, Variant p_config) { +Error SceneMultiplayer::object_configuration_remove(Object *p_obj, const Variant &p_config) { if (p_obj == nullptr && p_config.get_type() == Variant::NODE_PATH) { ERR_FAIL_COND_V(root_path != p_config.operator NodePath(), ERR_INVALID_PARAMETER); set_root_path(NodePath()); diff --git a/modules/multiplayer/scene_multiplayer.h b/modules/multiplayer/scene_multiplayer.h index 725cb9dbb6e..f617aa9b402 100644 --- a/modules/multiplayer/scene_multiplayer.h +++ b/modules/multiplayer/scene_multiplayer.h @@ -160,8 +160,8 @@ class SceneMultiplayer : public MultiplayerAPI { virtual Error rpcp(Object *p_obj, int p_peer_id, const StringName &p_method, const Variant **p_arg, int p_argcount) override; - virtual Error object_configuration_add(Object *p_obj, Variant p_config) override; - virtual Error object_configuration_remove(Object *p_obj, Variant p_config) override; + virtual Error object_configuration_add(Object *p_obj, const Variant &p_config) override; + virtual Error object_configuration_remove(Object *p_obj, const Variant &p_config) override; void clear(); @@ -171,7 +171,7 @@ class SceneMultiplayer : public MultiplayerAPI { void disconnect_peer(int p_id); - Error send_auth(int p_to, Vector<uint8_t> p_bytes); + Error send_auth(int p_to, const Vector<uint8_t> &p_bytes); Error complete_auth(int p_peer); void set_auth_callback(Callable p_callback); Callable get_auth_callback() const; @@ -180,7 +180,7 @@ class SceneMultiplayer : public MultiplayerAPI { Vector<int> get_authenticating_peer_ids(); Error send_command(int p_to, const uint8_t *p_packet, int p_packet_len); // Used internally to relay packets when needed. - Error send_bytes(Vector<uint8_t> p_data, int p_to = MultiplayerPeer::TARGET_PEER_BROADCAST, MultiplayerPeer::TransferMode p_mode = MultiplayerPeer::TRANSFER_MODE_RELIABLE, int p_channel = 0); + Error send_bytes(const Vector<uint8_t> &p_data, int p_to = MultiplayerPeer::TARGET_PEER_BROADCAST, MultiplayerPeer::TransferMode p_mode = MultiplayerPeer::TRANSFER_MODE_RELIABLE, int p_channel = 0); String get_rpc_md5(const Object *p_obj); const HashSet<int> get_connected_peers() const { return connected_peers; } diff --git a/modules/multiplayer/scene_replication_interface.cpp b/modules/multiplayer/scene_replication_interface.cpp index edc66c876c3..39ac198de58 100644 --- a/modules/multiplayer/scene_replication_interface.cpp +++ b/modules/multiplayer/scene_replication_interface.cpp @@ -154,7 +154,7 @@ void SceneReplicationInterface::on_network_process() { } } -Error SceneReplicationInterface::on_spawn(Object *p_obj, Variant p_config) { +Error SceneReplicationInterface::on_spawn(Object *p_obj, const Variant &p_config) { Node *node = Object::cast_to<Node>(p_obj); ERR_FAIL_COND_V(!node || p_config.get_type() != Variant::OBJECT, ERR_INVALID_PARAMETER); MultiplayerSpawner *spawner = Object::cast_to<MultiplayerSpawner>(p_config.get_validated_object()); @@ -194,7 +194,7 @@ void SceneReplicationInterface::_node_ready(const ObjectID &p_oid) { spawn_queue.clear(); } -Error SceneReplicationInterface::on_despawn(Object *p_obj, Variant p_config) { +Error SceneReplicationInterface::on_despawn(Object *p_obj, const Variant &p_config) { Node *node = Object::cast_to<Node>(p_obj); ERR_FAIL_COND_V(!node || p_config.get_type() != Variant::OBJECT, ERR_INVALID_PARAMETER); MultiplayerSpawner *spawner = Object::cast_to<MultiplayerSpawner>(p_config.get_validated_object()); @@ -222,7 +222,7 @@ Error SceneReplicationInterface::on_despawn(Object *p_obj, Variant p_config) { return OK; } -Error SceneReplicationInterface::on_replication_start(Object *p_obj, Variant p_config) { +Error SceneReplicationInterface::on_replication_start(Object *p_obj, const Variant &p_config) { Node *node = Object::cast_to<Node>(p_obj); ERR_FAIL_COND_V(!node || p_config.get_type() != Variant::OBJECT, ERR_INVALID_PARAMETER); MultiplayerSynchronizer *sync = Object::cast_to<MultiplayerSynchronizer>(p_config.get_validated_object()); @@ -267,7 +267,7 @@ Error SceneReplicationInterface::on_replication_start(Object *p_obj, Variant p_c return OK; } -Error SceneReplicationInterface::on_replication_stop(Object *p_obj, Variant p_config) { +Error SceneReplicationInterface::on_replication_stop(Object *p_obj, const Variant &p_config) { Node *node = Object::cast_to<Node>(p_obj); ERR_FAIL_COND_V(!node || p_config.get_type() != Variant::OBJECT, ERR_INVALID_PARAMETER); MultiplayerSynchronizer *sync = Object::cast_to<MultiplayerSynchronizer>(p_config.get_validated_object()); diff --git a/modules/multiplayer/scene_replication_interface.h b/modules/multiplayer/scene_replication_interface.h index cb582a2cafc..0ece12e2a31 100644 --- a/modules/multiplayer/scene_replication_interface.h +++ b/modules/multiplayer/scene_replication_interface.h @@ -127,10 +127,10 @@ class SceneReplicationInterface : public RefCounted { void on_reset(); void on_peer_change(int p_id, bool p_connected); - Error on_spawn(Object *p_obj, Variant p_config); - Error on_despawn(Object *p_obj, Variant p_config); - Error on_replication_start(Object *p_obj, Variant p_config); - Error on_replication_stop(Object *p_obj, Variant p_config); + Error on_spawn(Object *p_obj, const Variant &p_config); + Error on_despawn(Object *p_obj, const Variant &p_config); + Error on_replication_start(Object *p_obj, const Variant &p_config); + Error on_replication_stop(Object *p_obj, const Variant &p_config); void on_network_process(); Error on_spawn_receive(int p_from, const uint8_t *p_buffer, int p_buffer_len); diff --git a/modules/noise/noise.h b/modules/noise/noise.h index 6c49c12bc22..391162b4a73 100644 --- a/modules/noise/noise.h +++ b/modules/noise/noise.h @@ -82,7 +82,7 @@ class Noise : public Resource { }; template <typename T> - Vector<Ref<Image>> _generate_seamless_image(Vector<Ref<Image>> p_src, int p_width, int p_height, int p_depth, bool p_invert, real_t p_blend_skirt) const { + Vector<Ref<Image>> _generate_seamless_image(Vector<Ref<Image>> &p_src, int p_width, int p_height, int p_depth, bool p_invert, real_t p_blend_skirt) const { /* To make a seamless image, we swap the quadrants so the edges are perfect matches. We initially get a 10% larger image so we have an overlap we can use to blend over the seams. diff --git a/modules/openxr/action_map/openxr_action.cpp b/modules/openxr/action_map/openxr_action.cpp index 8a6b7a8b621..84d0a2283ec 100644 --- a/modules/openxr/action_map/openxr_action.cpp +++ b/modules/openxr/action_map/openxr_action.cpp @@ -74,7 +74,7 @@ String OpenXRAction::get_name_with_set() const { return action_name; } -void OpenXRAction::set_localized_name(const String p_localized_name) { +void OpenXRAction::set_localized_name(const String &p_localized_name) { localized_name = p_localized_name; emit_changed(); } @@ -92,7 +92,7 @@ OpenXRAction::ActionType OpenXRAction::get_action_type() const { return action_type; } -void OpenXRAction::set_toplevel_paths(const PackedStringArray p_toplevel_paths) { +void OpenXRAction::set_toplevel_paths(const PackedStringArray &p_toplevel_paths) { toplevel_paths = p_toplevel_paths; emit_changed(); } @@ -101,21 +101,21 @@ PackedStringArray OpenXRAction::get_toplevel_paths() const { return toplevel_paths; } -void OpenXRAction::add_toplevel_path(const String p_toplevel_path) { +void OpenXRAction::add_toplevel_path(const String &p_toplevel_path) { if (!toplevel_paths.has(p_toplevel_path)) { toplevel_paths.push_back(p_toplevel_path); emit_changed(); } } -void OpenXRAction::rem_toplevel_path(const String p_toplevel_path) { +void OpenXRAction::rem_toplevel_path(const String &p_toplevel_path) { if (toplevel_paths.has(p_toplevel_path)) { toplevel_paths.erase(p_toplevel_path); emit_changed(); } } -void OpenXRAction::parse_toplevel_paths(const String p_toplevel_paths) { +void OpenXRAction::parse_toplevel_paths(const String &p_toplevel_paths) { toplevel_paths = p_toplevel_paths.split(",", false); emit_changed(); } diff --git a/modules/openxr/action_map/openxr_action.h b/modules/openxr/action_map/openxr_action.h index 156a9833a7f..66e79274e78 100644 --- a/modules/openxr/action_map/openxr_action.h +++ b/modules/openxr/action_map/openxr_action.h @@ -67,19 +67,19 @@ class OpenXRAction : public Resource { String get_name_with_set() const; // Retrieve the name of this action as <action_set>/<action> - void set_localized_name(const String p_localized_name); // Set the localized name of this action + void set_localized_name(const String &p_localized_name); // Set the localized name of this action String get_localized_name() const; // Get the localized name of this action void set_action_type(const ActionType p_action_type); // Set the type of this action ActionType get_action_type() const; // Get the type of this action - void set_toplevel_paths(const PackedStringArray p_toplevel_paths); // Set the toplevel paths of this action + void set_toplevel_paths(const PackedStringArray &p_toplevel_paths); // Set the toplevel paths of this action PackedStringArray get_toplevel_paths() const; // Get the toplevel paths of this action - void add_toplevel_path(const String p_toplevel_path); // Add a top level path to this action - void rem_toplevel_path(const String p_toplevel_path); // Remove a toplevel path from this action + void add_toplevel_path(const String &p_toplevel_path); // Add a top level path to this action + void rem_toplevel_path(const String &p_toplevel_path); // Remove a toplevel path from this action - void parse_toplevel_paths(const String p_toplevel_paths); // Parse and set the top level paths from a comma separated string + void parse_toplevel_paths(const String &p_toplevel_paths); // Parse and set the top level paths from a comma separated string }; VARIANT_ENUM_CAST(OpenXRAction::ActionType); diff --git a/modules/openxr/action_map/openxr_action_map.cpp b/modules/openxr/action_map/openxr_action_map.cpp index 5430a41d6d6..67c6b9fe28e 100644 --- a/modules/openxr/action_map/openxr_action_map.cpp +++ b/modules/openxr/action_map/openxr_action_map.cpp @@ -54,7 +54,7 @@ void OpenXRActionMap::_bind_methods() { ClassDB::bind_method(D_METHOD("create_default_action_sets"), &OpenXRActionMap::create_default_action_sets); } -void OpenXRActionMap::set_action_sets(Array p_action_sets) { +void OpenXRActionMap::set_action_sets(const Array &p_action_sets) { action_sets.clear(); for (int i = 0; i < p_action_sets.size(); i++) { @@ -73,7 +73,7 @@ int OpenXRActionMap::get_action_set_count() const { return action_sets.size(); } -Ref<OpenXRActionSet> OpenXRActionMap::find_action_set(String p_name) const { +Ref<OpenXRActionSet> OpenXRActionMap::find_action_set(const String &p_name) const { for (int i = 0; i < action_sets.size(); i++) { Ref<OpenXRActionSet> action_set = action_sets[i]; if (action_set->get_name() == p_name) { @@ -107,7 +107,7 @@ void OpenXRActionMap::remove_action_set(Ref<OpenXRActionSet> p_action_set) { } } -void OpenXRActionMap::set_interaction_profiles(Array p_interaction_profiles) { +void OpenXRActionMap::set_interaction_profiles(const Array &p_interaction_profiles) { interaction_profiles.clear(); for (int i = 0; i < p_interaction_profiles.size(); i++) { @@ -126,7 +126,7 @@ int OpenXRActionMap::get_interaction_profile_count() const { return interaction_profiles.size(); } -Ref<OpenXRInteractionProfile> OpenXRActionMap::find_interaction_profile(String p_path) const { +Ref<OpenXRInteractionProfile> OpenXRActionMap::find_interaction_profile(const String &p_path) const { for (int i = 0; i < interaction_profiles.size(); i++) { Ref<OpenXRInteractionProfile> interaction_profile = interaction_profiles[i]; if (interaction_profile->get_interaction_profile_path() == p_path) { @@ -534,7 +534,7 @@ void OpenXRActionMap::create_editor_action_sets() { // TODO implement } -Ref<OpenXRAction> OpenXRActionMap::get_action(const String p_path) const { +Ref<OpenXRAction> OpenXRActionMap::get_action(const String &p_path) const { PackedStringArray paths = p_path.split("/", false); ERR_FAIL_COND_V(paths.size() != 2, Ref<OpenXRAction>()); @@ -546,7 +546,7 @@ Ref<OpenXRAction> OpenXRActionMap::get_action(const String p_path) const { return Ref<OpenXRAction>(); } -void OpenXRActionMap::remove_action(const String p_path, bool p_remove_interaction_profiles) { +void OpenXRActionMap::remove_action(const String &p_path, bool p_remove_interaction_profiles) { Ref<OpenXRAction> action = get_action(p_path); if (action.is_valid()) { for (int i = 0; i < interaction_profiles.size(); i++) { diff --git a/modules/openxr/action_map/openxr_action_map.h b/modules/openxr/action_map/openxr_action_map.h index 678b3d7fbc5..b90fc4de770 100644 --- a/modules/openxr/action_map/openxr_action_map.h +++ b/modules/openxr/action_map/openxr_action_map.h @@ -48,20 +48,20 @@ class OpenXRActionMap : public Resource { static void _bind_methods(); public: - void set_action_sets(Array p_action_sets); // Set our actions sets by providing an array with action sets (for loading from resource) + void set_action_sets(const Array &p_action_sets); // Set our actions sets by providing an array with action sets (for loading from resource) Array get_action_sets() const; // Get our action sets as an array (for saving to resource) int get_action_set_count() const; // Retrieve the number of action sets we have - Ref<OpenXRActionSet> find_action_set(String p_name) const; // Find an action set by name + Ref<OpenXRActionSet> find_action_set(const String &p_name) const; // Find an action set by name Ref<OpenXRActionSet> get_action_set(int p_idx) const; // Retrieve an action set by index void add_action_set(Ref<OpenXRActionSet> p_action_set); // Add an action set to our action map void remove_action_set(Ref<OpenXRActionSet> p_action_set); // Remove an action set from our action map - void set_interaction_profiles(Array p_interaction_profiles); // Set our interaction profiles by providing an array (for loading from resource) + void set_interaction_profiles(const Array &p_interaction_profiles); // Set our interaction profiles by providing an array (for loading from resource) Array get_interaction_profiles() const; // Get our interaction profiles as an array (for saving to resource) int get_interaction_profile_count() const; // Retrieve the number of interaction profiles we have - Ref<OpenXRInteractionProfile> find_interaction_profile(String p_path) const; // Find an interaction profile by path + Ref<OpenXRInteractionProfile> find_interaction_profile(const String &p_path) const; // Find an interaction profile by path Ref<OpenXRInteractionProfile> get_interaction_profile(int p_idx) const; // Retrieve an interaction profile by index void add_interaction_profile(Ref<OpenXRInteractionProfile> p_interaction_profile); // Add an interaction profile to our action map void remove_interaction_profile(Ref<OpenXRInteractionProfile> p_interaction_profile); // remove an interaction profile from our action map @@ -70,8 +70,8 @@ class OpenXRActionMap : public Resource { void create_editor_action_sets(); // Create our action set for the editor // Helper functions for editor - Ref<OpenXRAction> get_action(const String p_path) const; // Retrieve an action using <action name>/<action> as our parameter - void remove_action(const String p_path, bool p_remove_interaction_profiles = false); // Remove action from action set, also removes it from interaction profiles + Ref<OpenXRAction> get_action(const String &p_path) const; // Retrieve an action using <action name>/<action> as our parameter + void remove_action(const String &p_path, bool p_remove_interaction_profiles = false); // Remove action from action set, also removes it from interaction profiles PackedStringArray get_top_level_paths(const Ref<OpenXRAction> p_action); // Determines the top level paths based on where an action is bound in interaction profiles // TODO add validation to display in the interface that checks if we have action sets with the same name or if we have interaction profiles for the same path diff --git a/modules/openxr/action_map/openxr_action_set.cpp b/modules/openxr/action_map/openxr_action_set.cpp index d583af2b2f2..7dbd1122b6c 100644 --- a/modules/openxr/action_map/openxr_action_set.cpp +++ b/modules/openxr/action_map/openxr_action_set.cpp @@ -60,7 +60,7 @@ Ref<OpenXRActionSet> OpenXRActionSet::new_action_set(const char *p_name, const c return action_set; } -void OpenXRActionSet::set_localized_name(const String p_localized_name) { +void OpenXRActionSet::set_localized_name(const String &p_localized_name) { localized_name = p_localized_name; emit_changed(); } @@ -96,7 +96,7 @@ void OpenXRActionSet::clear_actions() { emit_changed(); } -void OpenXRActionSet::set_actions(Array p_actions) { +void OpenXRActionSet::set_actions(const Array &p_actions) { // Any actions not retained in p_actions should be freed automatically, those held within our Array will have be relinked to our action set. clear_actions(); @@ -110,7 +110,7 @@ Array OpenXRActionSet::get_actions() const { return actions; } -Ref<OpenXRAction> OpenXRActionSet::get_action(const String p_name) const { +Ref<OpenXRAction> OpenXRActionSet::get_action(const String &p_name) const { for (int i = 0; i < actions.size(); i++) { Ref<OpenXRAction> action = actions[i]; if (action->get_name() == p_name) { diff --git a/modules/openxr/action_map/openxr_action_set.h b/modules/openxr/action_map/openxr_action_set.h index c63d50bc19e..a08fb4b3706 100644 --- a/modules/openxr/action_map/openxr_action_set.h +++ b/modules/openxr/action_map/openxr_action_set.h @@ -51,17 +51,17 @@ class OpenXRActionSet : public Resource { public: static Ref<OpenXRActionSet> new_action_set(const char *p_name, const char *p_localized_name, const int p_priority = 0); // Helper function for adding and setting up an action set - void set_localized_name(const String p_localized_name); // Set the localized name of this action set + void set_localized_name(const String &p_localized_name); // Set the localized name of this action set String get_localized_name() const; // Get the localized name of this action set void set_priority(const int p_priority); // Set the priority of this action set int get_priority() const; // Get the priority of this action set int get_action_count() const; // Retrieve the number of actions in our action set - void set_actions(Array p_actions); // Set our actions using an array of actions (for loading a resource) + void set_actions(const Array &p_actions); // Set our actions using an array of actions (for loading a resource) Array get_actions() const; // Get our actions as an array (for saving a resource) - Ref<OpenXRAction> get_action(const String p_name) const; // Retrieve an action by name + Ref<OpenXRAction> get_action(const String &p_name) const; // Retrieve an action by name void add_action(Ref<OpenXRAction> p_action); // Add a new action to our action set void remove_action(Ref<OpenXRAction> p_action); // remove a action from our action set diff --git a/modules/openxr/action_map/openxr_interaction_profile.cpp b/modules/openxr/action_map/openxr_interaction_profile.cpp index 12664571137..5d9f4c97f6f 100644 --- a/modules/openxr/action_map/openxr_interaction_profile.cpp +++ b/modules/openxr/action_map/openxr_interaction_profile.cpp @@ -69,7 +69,7 @@ int OpenXRIPBinding::get_path_count() const { return paths.size(); } -void OpenXRIPBinding::set_paths(const PackedStringArray p_paths) { +void OpenXRIPBinding::set_paths(const PackedStringArray &p_paths) { paths = p_paths; emit_changed(); } @@ -78,23 +78,23 @@ PackedStringArray OpenXRIPBinding::get_paths() const { return paths; } -void OpenXRIPBinding::parse_paths(const String p_paths) { +void OpenXRIPBinding::parse_paths(const String &p_paths) { paths = p_paths.split(",", false); emit_changed(); } -bool OpenXRIPBinding::has_path(const String p_path) const { +bool OpenXRIPBinding::has_path(const String &p_path) const { return paths.has(p_path); } -void OpenXRIPBinding::add_path(const String p_path) { +void OpenXRIPBinding::add_path(const String &p_path) { if (!paths.has(p_path)) { paths.push_back(p_path); emit_changed(); } } -void OpenXRIPBinding::remove_path(const String p_path) { +void OpenXRIPBinding::remove_path(const String &p_path) { if (paths.has(p_path)) { paths.erase(p_path); emit_changed(); @@ -125,7 +125,7 @@ Ref<OpenXRInteractionProfile> OpenXRInteractionProfile::new_profile(const char * return profile; } -void OpenXRInteractionProfile::set_interaction_profile_path(const String p_input_profile_path) { +void OpenXRInteractionProfile::set_interaction_profile_path(const String &p_input_profile_path) { OpenXRInteractionProfileMetadata *pmd = OpenXRInteractionProfileMetadata::get_singleton(); if (pmd) { interaction_profile_path = pmd->check_profile_name(p_input_profile_path); @@ -150,7 +150,7 @@ Ref<OpenXRIPBinding> OpenXRInteractionProfile::get_binding(int p_index) const { return bindings[p_index]; } -void OpenXRInteractionProfile::set_bindings(Array p_bindings) { +void OpenXRInteractionProfile::set_bindings(const Array &p_bindings) { // TODO add check here that our bindings don't contain duplicate actions bindings = p_bindings; diff --git a/modules/openxr/action_map/openxr_interaction_profile.h b/modules/openxr/action_map/openxr_interaction_profile.h index 479cc3c5270..e8eade4aa1e 100644 --- a/modules/openxr/action_map/openxr_interaction_profile.h +++ b/modules/openxr/action_map/openxr_interaction_profile.h @@ -53,14 +53,14 @@ class OpenXRIPBinding : public Resource { Ref<OpenXRAction> get_action() const; // Get the action for this binding int get_path_count() const; // Get the number of io paths - void set_paths(const PackedStringArray p_paths); // Set our paths (for loading from resource) + void set_paths(const PackedStringArray &p_paths); // Set our paths (for loading from resource) PackedStringArray get_paths() const; // Get our paths (for saving to resource) - void parse_paths(const String p_paths); // Parse a comma separated string of io paths. + void parse_paths(const String &p_paths); // Parse a comma separated string of io paths. - bool has_path(const String p_path) const; // Has this io path - void add_path(const String p_path); // Add an io path - void remove_path(const String p_path); // Remove an io path + bool has_path(const String &p_path) const; // Has this io path + void add_path(const String &p_path); // Add an io path + void remove_path(const String &p_path); // Remove an io path // TODO add validation that we can display in the interface that checks if no two paths belong to the same top level path @@ -80,12 +80,12 @@ class OpenXRInteractionProfile : public Resource { public: static Ref<OpenXRInteractionProfile> new_profile(const char *p_input_profile_path); // Helper function to create a new interaction profile - void set_interaction_profile_path(const String p_input_profile_path); // Set our input profile path + void set_interaction_profile_path(const String &p_input_profile_path); // Set our input profile path String get_interaction_profile_path() const; // get our input profile path int get_binding_count() const; // Retrieve the number of bindings in this profile path Ref<OpenXRIPBinding> get_binding(int p_index) const; - void set_bindings(Array p_bindings); // Set the bindings (for loading from a resource) + void set_bindings(const Array &p_bindings); // Set the bindings (for loading from a resource) Array get_bindings() const; // Get the bindings (for saving to a resource) Ref<OpenXRIPBinding> get_binding_for_action(const Ref<OpenXRAction> p_action) const; // Get our binding record for a given action diff --git a/modules/openxr/action_map/openxr_interaction_profile_metadata.cpp b/modules/openxr/action_map/openxr_interaction_profile_metadata.cpp index 6315c95a03d..af659b8d79e 100644 --- a/modules/openxr/action_map/openxr_interaction_profile_metadata.cpp +++ b/modules/openxr/action_map/openxr_interaction_profile_metadata.cpp @@ -110,7 +110,7 @@ void OpenXRInteractionProfileMetadata::register_io_path(const String &p_interact } } -bool OpenXRInteractionProfileMetadata::has_top_level_path(const String p_openxr_path) const { +bool OpenXRInteractionProfileMetadata::has_top_level_path(const String &p_openxr_path) const { for (int i = 0; i < top_level_paths.size(); i++) { if (top_level_paths[i].openxr_path == p_openxr_path) { return true; @@ -120,7 +120,7 @@ bool OpenXRInteractionProfileMetadata::has_top_level_path(const String p_openxr_ return false; } -String OpenXRInteractionProfileMetadata::get_top_level_name(const String p_openxr_path) const { +String OpenXRInteractionProfileMetadata::get_top_level_name(const String &p_openxr_path) const { for (int i = 0; i < top_level_paths.size(); i++) { if (top_level_paths[i].openxr_path == p_openxr_path) { return top_level_paths[i].display_name; @@ -130,7 +130,7 @@ String OpenXRInteractionProfileMetadata::get_top_level_name(const String p_openx return String(); } -String OpenXRInteractionProfileMetadata::get_top_level_extension(const String p_openxr_path) const { +String OpenXRInteractionProfileMetadata::get_top_level_extension(const String &p_openxr_path) const { for (int i = 0; i < top_level_paths.size(); i++) { if (top_level_paths[i].openxr_path == p_openxr_path) { return top_level_paths[i].openxr_extension_name; @@ -140,7 +140,7 @@ String OpenXRInteractionProfileMetadata::get_top_level_extension(const String p_ return XR_PATH_UNSUPPORTED_NAME; } -bool OpenXRInteractionProfileMetadata::has_interaction_profile(const String p_openxr_path) const { +bool OpenXRInteractionProfileMetadata::has_interaction_profile(const String &p_openxr_path) const { for (int i = 0; i < interaction_profiles.size(); i++) { if (interaction_profiles[i].openxr_path == p_openxr_path) { return true; @@ -150,7 +150,7 @@ bool OpenXRInteractionProfileMetadata::has_interaction_profile(const String p_op return false; } -String OpenXRInteractionProfileMetadata::get_interaction_profile_extension(const String p_openxr_path) const { +String OpenXRInteractionProfileMetadata::get_interaction_profile_extension(const String &p_openxr_path) const { for (int i = 0; i < interaction_profiles.size(); i++) { if (interaction_profiles[i].openxr_path == p_openxr_path) { return interaction_profiles[i].openxr_extension_name; @@ -160,7 +160,7 @@ String OpenXRInteractionProfileMetadata::get_interaction_profile_extension(const return XR_PATH_UNSUPPORTED_NAME; } -const OpenXRInteractionProfileMetadata::InteractionProfile *OpenXRInteractionProfileMetadata::get_profile(const String p_openxr_path) const { +const OpenXRInteractionProfileMetadata::InteractionProfile *OpenXRInteractionProfileMetadata::get_profile(const String &p_openxr_path) const { for (int i = 0; i < interaction_profiles.size(); i++) { if (interaction_profiles[i].openxr_path == p_openxr_path) { return &interaction_profiles[i]; @@ -170,7 +170,7 @@ const OpenXRInteractionProfileMetadata::InteractionProfile *OpenXRInteractionPro return nullptr; } -bool OpenXRInteractionProfileMetadata::InteractionProfile::has_io_path(const String p_io_path) const { +bool OpenXRInteractionProfileMetadata::InteractionProfile::has_io_path(const String &p_io_path) const { for (int i = 0; i < io_paths.size(); i++) { if (io_paths[i].openxr_path == p_io_path) { return true; @@ -180,7 +180,7 @@ bool OpenXRInteractionProfileMetadata::InteractionProfile::has_io_path(const Str return false; } -const OpenXRInteractionProfileMetadata::IOPath *OpenXRInteractionProfileMetadata::InteractionProfile::get_io_path(const String p_io_path) const { +const OpenXRInteractionProfileMetadata::IOPath *OpenXRInteractionProfileMetadata::InteractionProfile::get_io_path(const String &p_io_path) const { for (int i = 0; i < io_paths.size(); i++) { if (io_paths[i].openxr_path == p_io_path) { return &io_paths[i]; @@ -190,7 +190,7 @@ const OpenXRInteractionProfileMetadata::IOPath *OpenXRInteractionProfileMetadata return nullptr; } -const OpenXRInteractionProfileMetadata::IOPath *OpenXRInteractionProfileMetadata::get_io_path(const String p_interaction_profile, const String p_io_path) const { +const OpenXRInteractionProfileMetadata::IOPath *OpenXRInteractionProfileMetadata::get_io_path(const String &p_interaction_profile, const String &p_io_path) const { const OpenXRInteractionProfileMetadata::InteractionProfile *profile = get_profile(p_interaction_profile); if (profile != nullptr) { return profile->get_io_path(p_io_path); diff --git a/modules/openxr/action_map/openxr_interaction_profile_metadata.h b/modules/openxr/action_map/openxr_interaction_profile_metadata.h index 252e36f0f6f..566b257c16a 100644 --- a/modules/openxr/action_map/openxr_interaction_profile_metadata.h +++ b/modules/openxr/action_map/openxr_interaction_profile_metadata.h @@ -82,8 +82,8 @@ class OpenXRInteractionProfileMetadata : public Object { String openxr_extension_name; // If set, only available if extension is enabled (i.e. XR_HTCX_vive_tracker_interaction) Vector<IOPath> io_paths; // Inputs and outputs for this device - bool has_io_path(const String p_io_path) const; - const IOPath *get_io_path(const String p_io_path) const; + bool has_io_path(const String &p_io_path) const; + const IOPath *get_io_path(const String &p_io_path) const; }; private: @@ -108,18 +108,18 @@ class OpenXRInteractionProfileMetadata : public Object { String check_profile_name(const String &p_name) const; void register_top_level_path(const String &p_display_name, const String &p_openxr_path, const String &p_openxr_extension_name); - bool has_top_level_path(const String p_openxr_path) const; - String get_top_level_name(const String p_openxr_path) const; - String get_top_level_extension(const String p_openxr_path) const; + bool has_top_level_path(const String &p_openxr_path) const; + String get_top_level_name(const String &p_openxr_path) const; + String get_top_level_extension(const String &p_openxr_path) const; void register_interaction_profile(const String &p_display_name, const String &p_openxr_path, const String &p_openxr_extension_name); - bool has_interaction_profile(const String p_openxr_path) const; - String get_interaction_profile_extension(const String p_openxr_path) const; - const InteractionProfile *get_profile(const String p_openxr_path) const; + bool has_interaction_profile(const String &p_openxr_path) const; + String get_interaction_profile_extension(const String &p_openxr_path) const; + const InteractionProfile *get_profile(const String &p_openxr_path) const; PackedStringArray get_interaction_profile_paths() const; void register_io_path(const String &p_interaction_profile, const String &p_display_name, const String &p_toplevel_path, const String &p_openxr_path, const String &p_openxr_extension_name, OpenXRAction::ActionType p_action_type); - const IOPath *get_io_path(const String p_interaction_profile, const String p_io_path) const; + const IOPath *get_io_path(const String &p_interaction_profile, const String &p_io_path) const; }; #endif // OPENXR_INTERACTION_PROFILE_METADATA_H diff --git a/modules/openxr/editor/openxr_action_editor.cpp b/modules/openxr/editor/openxr_action_editor.cpp index 63162ba3dc6..697d44d0408 100644 --- a/modules/openxr/editor/openxr_action_editor.cpp +++ b/modules/openxr/editor/openxr_action_editor.cpp @@ -53,7 +53,7 @@ void OpenXRActionEditor::_notification(int p_what) { } } -void OpenXRActionEditor::_on_action_name_changed(const String p_new_text) { +void OpenXRActionEditor::_on_action_name_changed(const String &p_new_text) { if (action->get_name() != p_new_text) { undo_redo->create_action(TTR("Rename Action")); undo_redo->add_do_method(this, "_do_set_name", p_new_text); @@ -75,13 +75,13 @@ void OpenXRActionEditor::_on_action_name_changed(const String p_new_text) { } } -void OpenXRActionEditor::_do_set_name(const String p_new_text) { +void OpenXRActionEditor::_do_set_name(const String &p_new_text) { action->set_name(p_new_text); action->set_edited(true); action_name->set_text(p_new_text); } -void OpenXRActionEditor::_on_action_localized_name_changed(const String p_new_text) { +void OpenXRActionEditor::_on_action_localized_name_changed(const String &p_new_text) { if (action->get_localized_name() != p_new_text) { undo_redo->create_action(TTR("Rename Actions Localized name")); undo_redo->add_do_method(this, "_do_set_localized_name", p_new_text); @@ -93,7 +93,7 @@ void OpenXRActionEditor::_on_action_localized_name_changed(const String p_new_te } } -void OpenXRActionEditor::_do_set_localized_name(const String p_new_text) { +void OpenXRActionEditor::_do_set_localized_name(const String &p_new_text) { action->set_localized_name(p_new_text); action->set_edited(true); action_localized_name->set_text(p_new_text); diff --git a/modules/openxr/editor/openxr_action_editor.h b/modules/openxr/editor/openxr_action_editor.h index 11d1fd657ae..ace0e70e9a3 100644 --- a/modules/openxr/editor/openxr_action_editor.h +++ b/modules/openxr/editor/openxr_action_editor.h @@ -53,8 +53,8 @@ class OpenXRActionEditor : public HBoxContainer { Button *rem_action = nullptr; void _theme_changed(); - void _on_action_name_changed(const String p_new_text); - void _on_action_localized_name_changed(const String p_new_text); + void _on_action_name_changed(const String &p_new_text); + void _on_action_localized_name_changed(const String &p_new_text); void _on_item_selected(int p_idx); void _on_remove_action(); @@ -63,8 +63,8 @@ class OpenXRActionEditor : public HBoxContainer { void _notification(int p_what); // used for undo/redo - void _do_set_name(const String p_new_text); - void _do_set_localized_name(const String p_new_text); + void _do_set_name(const String &p_new_text); + void _do_set_localized_name(const String &p_new_text); void _do_set_action_type(OpenXRAction::ActionType p_action_type); public: diff --git a/modules/openxr/editor/openxr_action_map_editor.cpp b/modules/openxr/editor/openxr_action_map_editor.cpp index a353073f215..eef025f84a7 100644 --- a/modules/openxr/editor/openxr_action_map_editor.cpp +++ b/modules/openxr/editor/openxr_action_map_editor.cpp @@ -126,7 +126,7 @@ void OpenXRActionMapEditor::_create_interaction_profiles() { } } -OpenXRActionSetEditor *OpenXRActionMapEditor::_add_action_set(String p_name) { +OpenXRActionSetEditor *OpenXRActionMapEditor::_add_action_set(const String &p_name) { ERR_FAIL_COND_V(action_map.is_null(), nullptr); Ref<OpenXRActionSet> new_action_set; @@ -148,7 +148,7 @@ OpenXRActionSetEditor *OpenXRActionMapEditor::_add_action_set(String p_name) { return action_set_editor; } -void OpenXRActionMapEditor::_remove_action_set(String p_name) { +void OpenXRActionMapEditor::_remove_action_set(const String &p_name) { ERR_FAIL_COND(action_map.is_null()); Ref<OpenXRActionSet> action_set = action_map->find_action_set(p_name); ERR_FAIL_COND(action_set.is_null()); @@ -227,7 +227,7 @@ void OpenXRActionMapEditor::_on_add_interaction_profile() { select_interaction_profile_dialog->open(already_selected); } -void OpenXRActionMapEditor::_on_interaction_profile_selected(const String p_path) { +void OpenXRActionMapEditor::_on_interaction_profile_selected(const String &p_path) { ERR_FAIL_COND(action_map.is_null()); Ref<OpenXRInteractionProfile> new_profile; @@ -246,7 +246,7 @@ void OpenXRActionMapEditor::_on_interaction_profile_selected(const String p_path tabs->set_current_tab(tabs->get_tab_count() - 1); } -void OpenXRActionMapEditor::_load_action_map(const String p_path, bool p_create_new_if_missing) { +void OpenXRActionMapEditor::_load_action_map(const String &p_path, bool p_create_new_if_missing) { Error err = OK; Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES); if (da->file_exists(p_path)) { @@ -357,7 +357,7 @@ void OpenXRActionMapEditor::_do_remove_interaction_profile_editor(OpenXRInteract action_map->remove_interaction_profile(interaction_profile); } -void OpenXRActionMapEditor::open_action_map(String p_path) { +void OpenXRActionMapEditor::open_action_map(const String &p_path) { EditorNode::get_bottom_panel()->make_item_visible(this); // out with the old... diff --git a/modules/openxr/editor/openxr_action_map_editor.h b/modules/openxr/editor/openxr_action_map_editor.h index cfe5fed0955..116d69d4b4b 100644 --- a/modules/openxr/editor/openxr_action_map_editor.h +++ b/modules/openxr/editor/openxr_action_map_editor.h @@ -69,8 +69,8 @@ class OpenXRActionMapEditor : public VBoxContainer { OpenXRInteractionProfileEditorBase *_add_interaction_profile_editor(Ref<OpenXRInteractionProfile> p_interaction_profile); void _create_interaction_profiles(); - OpenXRActionSetEditor *_add_action_set(String p_name); - void _remove_action_set(String p_name); + OpenXRActionSetEditor *_add_action_set(const String &p_name); + void _remove_action_set(const String &p_name); void _on_add_action_set(); void _set_focus_on_action_set(OpenXRActionSetEditor *p_action_set_editor); @@ -78,9 +78,9 @@ class OpenXRActionMapEditor : public VBoxContainer { void _on_action_removed(Ref<OpenXRAction> p_action); void _on_add_interaction_profile(); - void _on_interaction_profile_selected(const String p_path); + void _on_interaction_profile_selected(const String &p_path); - void _load_action_map(const String p_path, bool p_create_new_if_missing = false); + void _load_action_map(const String &p_path, bool p_create_new_if_missing = false); void _on_save_action_map(); void _on_reset_to_default_layout(); @@ -100,7 +100,7 @@ class OpenXRActionMapEditor : public VBoxContainer { void _do_remove_interaction_profile_editor(OpenXRInteractionProfileEditorBase *p_interaction_profile_editor); public: - void open_action_map(String p_path); + void open_action_map(const String &p_path); OpenXRActionMapEditor(); ~OpenXRActionMapEditor(); diff --git a/modules/openxr/editor/openxr_action_set_editor.cpp b/modules/openxr/editor/openxr_action_set_editor.cpp index 0c555927076..842dbfd650d 100644 --- a/modules/openxr/editor/openxr_action_set_editor.cpp +++ b/modules/openxr/editor/openxr_action_set_editor.cpp @@ -82,7 +82,7 @@ void OpenXRActionSetEditor::_on_toggle_expand() { _set_fold_icon(); } -void OpenXRActionSetEditor::_on_action_set_name_changed(const String p_new_text) { +void OpenXRActionSetEditor::_on_action_set_name_changed(const String &p_new_text) { if (action_set->get_name() != p_new_text) { undo_redo->create_action(TTR("Rename Action Set")); undo_redo->add_do_method(this, "_do_set_name", p_new_text); @@ -104,12 +104,12 @@ void OpenXRActionSetEditor::_on_action_set_name_changed(const String p_new_text) } } -void OpenXRActionSetEditor::_do_set_name(const String p_new_text) { +void OpenXRActionSetEditor::_do_set_name(const String &p_new_text) { action_set->set_name(p_new_text); action_set_name->set_text(p_new_text); } -void OpenXRActionSetEditor::_on_action_set_localized_name_changed(const String p_new_text) { +void OpenXRActionSetEditor::_on_action_set_localized_name_changed(const String &p_new_text) { if (action_set->get_localized_name() != p_new_text) { undo_redo->create_action(TTR("Rename Action Sets Localized name")); undo_redo->add_do_method(this, "_do_set_localized_name", p_new_text); @@ -121,12 +121,12 @@ void OpenXRActionSetEditor::_on_action_set_localized_name_changed(const String p } } -void OpenXRActionSetEditor::_do_set_localized_name(const String p_new_text) { +void OpenXRActionSetEditor::_do_set_localized_name(const String &p_new_text) { action_set->set_localized_name(p_new_text); action_set_localized_name->set_text(p_new_text); } -void OpenXRActionSetEditor::_on_action_set_priority_changed(const String p_new_text) { +void OpenXRActionSetEditor::_on_action_set_priority_changed(const String &p_new_text) { int64_t value = p_new_text.to_int(); if (action_set->get_priority() != value) { diff --git a/modules/openxr/editor/openxr_action_set_editor.h b/modules/openxr/editor/openxr_action_set_editor.h index 3261f3a29e5..b259583412a 100644 --- a/modules/openxr/editor/openxr_action_set_editor.h +++ b/modules/openxr/editor/openxr_action_set_editor.h @@ -67,9 +67,9 @@ class OpenXRActionSetEditor : public HBoxContainer { OpenXRActionEditor *_add_action_editor(Ref<OpenXRAction> p_action); void _on_toggle_expand(); - void _on_action_set_name_changed(const String p_new_text); - void _on_action_set_localized_name_changed(const String p_new_text); - void _on_action_set_priority_changed(const String p_new_text); + void _on_action_set_name_changed(const String &p_new_text); + void _on_action_set_localized_name_changed(const String &p_new_text); + void _on_action_set_priority_changed(const String &p_new_text); void _on_add_action(); void _on_remove_action_set(); @@ -80,8 +80,8 @@ class OpenXRActionSetEditor : public HBoxContainer { void _notification(int p_what); // used for undo/redo - void _do_set_name(const String p_new_text); - void _do_set_localized_name(const String p_new_text); + void _do_set_name(const String &p_new_text); + void _do_set_localized_name(const String &p_new_text); void _do_set_priority(int64_t value); void _do_add_action_editor(OpenXRActionEditor *p_action_editor); void _do_remove_action_editor(OpenXRActionEditor *p_action_editor); diff --git a/modules/openxr/editor/openxr_interaction_profile_editor.cpp b/modules/openxr/editor/openxr_interaction_profile_editor.cpp index 651171358cb..36768f96832 100644 --- a/modules/openxr/editor/openxr_interaction_profile_editor.cpp +++ b/modules/openxr/editor/openxr_interaction_profile_editor.cpp @@ -66,7 +66,7 @@ void OpenXRInteractionProfileEditorBase::_do_update_interaction_profile() { } } -void OpenXRInteractionProfileEditorBase::_add_binding(const String p_action, const String p_path) { +void OpenXRInteractionProfileEditorBase::_add_binding(const String &p_action, const String &p_path) { ERR_FAIL_COND(action_map.is_null()); ERR_FAIL_COND(interaction_profile.is_null()); @@ -91,7 +91,7 @@ void OpenXRInteractionProfileEditorBase::_add_binding(const String p_action, con _do_update_interaction_profile(); } -void OpenXRInteractionProfileEditorBase::_remove_binding(const String p_action, const String p_path) { +void OpenXRInteractionProfileEditorBase::_remove_binding(const String &p_action, const String &p_path) { ERR_FAIL_COND(action_map.is_null()); ERR_FAIL_COND(interaction_profile.is_null()); @@ -164,12 +164,12 @@ OpenXRInteractionProfileEditorBase::OpenXRInteractionProfileEditorBase(Ref<OpenX /////////////////////////////////////////////////////////////////////////// // Default interaction profile editor -void OpenXRInteractionProfileEditor::select_action_for(const String p_io_path) { +void OpenXRInteractionProfileEditor::select_action_for(const String &p_io_path) { selecting_for_io_path = p_io_path; select_action_dialog->open(); } -void OpenXRInteractionProfileEditor::action_selected(const String p_action) { +void OpenXRInteractionProfileEditor::action_selected(const String &p_action) { undo_redo->create_action(TTR("Add binding")); undo_redo->add_do_method(this, "_add_binding", p_action, selecting_for_io_path); undo_redo->add_undo_method(this, "_remove_binding", p_action, selecting_for_io_path); @@ -178,7 +178,7 @@ void OpenXRInteractionProfileEditor::action_selected(const String p_action) { selecting_for_io_path = ""; } -void OpenXRInteractionProfileEditor::_on_remove_pressed(const String p_action, const String p_for_io_path) { +void OpenXRInteractionProfileEditor::_on_remove_pressed(const String &p_action, const String &p_for_io_path) { undo_redo->create_action(TTR("Remove binding")); undo_redo->add_do_method(this, "_remove_binding", p_action, p_for_io_path); undo_redo->add_undo_method(this, "_add_binding", p_action, p_for_io_path); diff --git a/modules/openxr/editor/openxr_interaction_profile_editor.h b/modules/openxr/editor/openxr_interaction_profile_editor.h index 2ec72127cfc..5308c69391f 100644 --- a/modules/openxr/editor/openxr_interaction_profile_editor.h +++ b/modules/openxr/editor/openxr_interaction_profile_editor.h @@ -61,8 +61,8 @@ class OpenXRInteractionProfileEditorBase : public ScrollContainer { virtual void _theme_changed() {} void _do_update_interaction_profile(); - void _add_binding(const String p_action, const String p_path); - void _remove_binding(const String p_action, const String p_path); + void _add_binding(const String &p_action, const String &p_path); + void _remove_binding(const String &p_action, const String &p_path); void remove_all_bindings_for_action(Ref<OpenXRAction> p_action); @@ -80,9 +80,9 @@ class OpenXRInteractionProfileEditor : public OpenXRInteractionProfileEditorBase void _add_io_path(VBoxContainer *p_container, const OpenXRInteractionProfileMetadata::IOPath *p_io_path); public: - void select_action_for(const String p_io_path); - void action_selected(const String p_action); - void _on_remove_pressed(const String p_action, const String p_for_io_path); + void select_action_for(const String &p_io_path); + void action_selected(const String &p_action); + void _on_remove_pressed(const String &p_action, const String &p_for_io_path); virtual void _update_interaction_profile() override; virtual void _theme_changed() override; diff --git a/modules/openxr/editor/openxr_select_action_dialog.cpp b/modules/openxr/editor/openxr_select_action_dialog.cpp index a4ccc98408a..f661b9dd77f 100644 --- a/modules/openxr/editor/openxr_select_action_dialog.cpp +++ b/modules/openxr/editor/openxr_select_action_dialog.cpp @@ -43,7 +43,7 @@ void OpenXRSelectActionDialog::_notification(int p_what) { } } -void OpenXRSelectActionDialog::_on_select_action(const String p_action) { +void OpenXRSelectActionDialog::_on_select_action(const String &p_action) { if (selected_action != "") { NodePath button_path = action_buttons[selected_action]; Button *button = Object::cast_to<Button>(get_node(button_path)); diff --git a/modules/openxr/editor/openxr_select_action_dialog.h b/modules/openxr/editor/openxr_select_action_dialog.h index cf7a7a19396..a4438795815 100644 --- a/modules/openxr/editor/openxr_select_action_dialog.h +++ b/modules/openxr/editor/openxr_select_action_dialog.h @@ -58,7 +58,7 @@ class OpenXRSelectActionDialog : public ConfirmationDialog { void _notification(int p_what); public: - void _on_select_action(const String p_action); + void _on_select_action(const String &p_action); void open(); virtual void ok_pressed() override; diff --git a/modules/openxr/editor/openxr_select_interaction_profile_dialog.cpp b/modules/openxr/editor/openxr_select_interaction_profile_dialog.cpp index 53b8cbd4016..96da7248253 100644 --- a/modules/openxr/editor/openxr_select_interaction_profile_dialog.cpp +++ b/modules/openxr/editor/openxr_select_interaction_profile_dialog.cpp @@ -43,7 +43,7 @@ void OpenXRSelectInteractionProfileDialog::_notification(int p_what) { } } -void OpenXRSelectInteractionProfileDialog::_on_select_interaction_profile(const String p_interaction_profile) { +void OpenXRSelectInteractionProfileDialog::_on_select_interaction_profile(const String &p_interaction_profile) { if (selected_interaction_profile != "") { NodePath button_path = ip_buttons[selected_interaction_profile]; Button *button = Object::cast_to<Button>(get_node(button_path)); @@ -63,7 +63,7 @@ void OpenXRSelectInteractionProfileDialog::_on_select_interaction_profile(const } } -void OpenXRSelectInteractionProfileDialog::open(PackedStringArray p_do_not_include) { +void OpenXRSelectInteractionProfileDialog::open(const PackedStringArray &p_do_not_include) { int available_count = 0; // out with the old... diff --git a/modules/openxr/editor/openxr_select_interaction_profile_dialog.h b/modules/openxr/editor/openxr_select_interaction_profile_dialog.h index 1d1615321c9..79f3c6e728a 100644 --- a/modules/openxr/editor/openxr_select_interaction_profile_dialog.h +++ b/modules/openxr/editor/openxr_select_interaction_profile_dialog.h @@ -57,8 +57,8 @@ class OpenXRSelectInteractionProfileDialog : public ConfirmationDialog { void _notification(int p_what); public: - void _on_select_interaction_profile(const String p_interaction_profile); - void open(PackedStringArray p_do_not_include); + void _on_select_interaction_profile(const String &p_interaction_profile); + void open(const PackedStringArray &p_do_not_include); virtual void ok_pressed() override; OpenXRSelectInteractionProfileDialog(); diff --git a/modules/openxr/extensions/openxr_ml2_controller_extension.cpp b/modules/openxr/extensions/openxr_ml2_controller_extension.cpp index 979ac22d087..9f13ebe39ec 100644 --- a/modules/openxr/extensions/openxr_ml2_controller_extension.cpp +++ b/modules/openxr/extensions/openxr_ml2_controller_extension.cpp @@ -51,7 +51,7 @@ void OpenXRML2ControllerExtension::on_register_metadata() { // Magic Leap 2 Controller const String profile_path = "/interaction_profiles/ml/ml2_controller"; metadata->register_interaction_profile("Magic Leap 2 controller", "/interaction_profiles/ml/ml2_controller", XR_ML_ML2_CONTROLLER_INTERACTION_EXTENSION_NAME); - for (const String user_path : { "/user/hand/left", "/user/hand/right" }) { + for (const String &user_path : { "/user/hand/left", "/user/hand/right" }) { metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE); metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE); diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp index 98e54841578..6eaa8917d3c 100644 --- a/modules/openxr/openxr_api.cpp +++ b/modules/openxr/openxr_api.cpp @@ -460,7 +460,7 @@ bool OpenXRAPI::interaction_profile_supports_io_path(const String &p_ip_path, co return true; } -void OpenXRAPI::copy_string_to_char_buffer(const String p_string, char *p_buffer, int p_buffer_len) { +void OpenXRAPI::copy_string_to_char_buffer(const String &p_string, char *p_buffer, int p_buffer_len) { CharString char_string = p_string.utf8(); int len = char_string.length(); if (len < p_buffer_len - 1) { @@ -2687,7 +2687,7 @@ void OpenXRAPI::parse_velocities(const XrSpaceVelocity &p_velocity, Vector3 &r_l } } -bool OpenXRAPI::xr_result(XrResult result, const char *format, Array args) const { +bool OpenXRAPI::xr_result(XrResult result, const char *format, const Array &args) const { if (XR_SUCCEEDED(result)) return true; @@ -2725,7 +2725,7 @@ RID OpenXRAPI::find_tracker(const String &p_name) { return RID(); } -RID OpenXRAPI::tracker_create(const String p_name) { +RID OpenXRAPI::tracker_create(const String &p_name) { ERR_FAIL_COND_V(instance == XR_NULL_HANDLE, RID()); Tracker new_tracker; @@ -2798,7 +2798,7 @@ void OpenXRAPI::tracker_free(RID p_tracker) { tracker_owner.free(p_tracker); } -RID OpenXRAPI::action_set_create(const String p_name, const String p_localized_name, const int p_priority) { +RID OpenXRAPI::action_set_create(const String &p_name, const String &p_localized_name, const int p_priority) { ERR_FAIL_COND_V(instance == XR_NULL_HANDLE, RID()); ActionSet action_set; @@ -2932,7 +2932,7 @@ RID OpenXRAPI::find_action(const String &p_name) { return RID(); } -RID OpenXRAPI::action_create(RID p_action_set, const String p_name, const String p_localized_name, OpenXRAction::ActionType p_action_type, const Vector<RID> &p_trackers) { +RID OpenXRAPI::action_create(RID p_action_set, const String &p_name, const String &p_localized_name, OpenXRAction::ActionType p_action_type, const Vector<RID> &p_trackers) { ERR_FAIL_COND_V(instance == XR_NULL_HANDLE, RID()); Action action; @@ -3047,7 +3047,7 @@ XrPath OpenXRAPI::get_interaction_profile_path(RID p_interaction_profile) { return ip->path; } -RID OpenXRAPI::interaction_profile_create(const String p_name) { +RID OpenXRAPI::interaction_profile_create(const String &p_name) { if (!is_interaction_profile_supported(p_name)) { // The extension enabling this path must not be active, we will silently skip this interaction profile return RID(); @@ -3088,7 +3088,7 @@ void OpenXRAPI::interaction_profile_clear_bindings(RID p_interaction_profile) { ip->bindings.clear(); } -bool OpenXRAPI::interaction_profile_add_binding(RID p_interaction_profile, RID p_action, const String p_path) { +bool OpenXRAPI::interaction_profile_add_binding(RID p_interaction_profile, RID p_action, const String &p_path) { InteractionProfile *ip = interaction_profile_owner.get_or_null(p_interaction_profile); ERR_FAIL_NULL_V(ip, false); @@ -3165,7 +3165,7 @@ void OpenXRAPI::interaction_profile_free(RID p_interaction_profile) { interaction_profile_owner.free(p_interaction_profile); } -bool OpenXRAPI::sync_action_sets(const Vector<RID> p_active_sets) { +bool OpenXRAPI::sync_action_sets(const Vector<RID> &p_active_sets) { ERR_FAIL_COND_V(session == XR_NULL_HANDLE, false); if (!running) { diff --git a/modules/openxr/openxr_api.h b/modules/openxr/openxr_api.h index 81e9deb7ab7..bf6c1852088 100644 --- a/modules/openxr/openxr_api.h +++ b/modules/openxr/openxr_api.h @@ -326,7 +326,7 @@ class OpenXRAPI { bool on_state_exiting(); // convenience - void copy_string_to_char_buffer(const String p_string, char *p_buffer, int p_buffer_len); + void copy_string_to_char_buffer(const String &p_string, char *p_buffer, int p_buffer_len); // Render state, Only accessible in rendering thread struct RenderState { @@ -410,7 +410,7 @@ class OpenXRAPI { XRPose::TrackingConfidence transform_from_location(const XrHandJointLocationEXT &p_location, Transform3D &r_transform); void parse_velocities(const XrSpaceVelocity &p_velocity, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity); - bool xr_result(XrResult result, const char *format, Array args = Array()) const; + bool xr_result(XrResult result, const char *format, const Array &args = Array()) const; bool is_top_level_path_supported(const String &p_toplevel_path); bool is_interaction_profile_supported(const String &p_ip_path); bool interaction_profile_supports_io_path(const String &p_ip_path, const String &p_io_path); @@ -502,31 +502,31 @@ class OpenXRAPI { // action map String get_default_action_map_resource_name(); - RID tracker_create(const String p_name); + RID tracker_create(const String &p_name); String tracker_get_name(RID p_tracker); void tracker_check_profile(RID p_tracker, XrSession p_session = XR_NULL_HANDLE); void tracker_free(RID p_tracker); - RID action_set_create(const String p_name, const String p_localized_name, const int p_priority); + RID action_set_create(const String &p_name, const String &p_localized_name, const int p_priority); String action_set_get_name(RID p_action_set); bool attach_action_sets(const Vector<RID> &p_action_sets); void action_set_free(RID p_action_set); - RID action_create(RID p_action_set, const String p_name, const String p_localized_name, OpenXRAction::ActionType p_action_type, const Vector<RID> &p_trackers); + RID action_create(RID p_action_set, const String &p_name, const String &p_localized_name, OpenXRAction::ActionType p_action_type, const Vector<RID> &p_trackers); String action_get_name(RID p_action); void action_free(RID p_action); - RID interaction_profile_create(const String p_name); + RID interaction_profile_create(const String &p_name); String interaction_profile_get_name(RID p_interaction_profile); void interaction_profile_clear_bindings(RID p_interaction_profile); - bool interaction_profile_add_binding(RID p_interaction_profile, RID p_action, const String p_path); + bool interaction_profile_add_binding(RID p_interaction_profile, RID p_action, const String &p_path); bool interaction_profile_suggest_bindings(RID p_interaction_profile); void interaction_profile_free(RID p_interaction_profile); RID find_tracker(const String &p_name); RID find_action(const String &p_name); - bool sync_action_sets(const Vector<RID> p_active_sets); + bool sync_action_sets(const Vector<RID> &p_active_sets); bool get_action_bool(RID p_action, RID p_tracker); float get_action_float(RID p_action, RID p_tracker); Vector2 get_action_vector2(RID p_action, RID p_tracker); diff --git a/modules/openxr/openxr_api_extension.cpp b/modules/openxr/openxr_api_extension.cpp index a1744fa1dbc..58c1dfb3557 100644 --- a/modules/openxr/openxr_api_extension.cpp +++ b/modules/openxr/openxr_api_extension.cpp @@ -85,7 +85,7 @@ Transform3D OpenXRAPIExtension::transform_from_pose(GDExtensionConstPtr<const vo return OpenXRAPI::get_singleton()->transform_from_pose(*(XrPosef *)p_pose.data); } -bool OpenXRAPIExtension::xr_result(uint64_t result, String format, Array args) { +bool OpenXRAPIExtension::xr_result(uint64_t result, const String &format, const Array &args) { ERR_FAIL_NULL_V(OpenXRAPI::get_singleton(), false); return OpenXRAPI::get_singleton()->xr_result((XrResult)result, format.utf8().get_data(), args); } @@ -95,7 +95,7 @@ bool OpenXRAPIExtension::openxr_is_enabled(bool p_check_run_in_editor) { return OpenXRAPI::openxr_is_enabled(p_check_run_in_editor); } -uint64_t OpenXRAPIExtension::get_instance_proc_addr(String p_name) { +uint64_t OpenXRAPIExtension::get_instance_proc_addr(const String &p_name) { ERR_FAIL_NULL_V(OpenXRAPI::get_singleton(), 0); CharString str = p_name.utf8(); PFN_xrVoidFunction addr = nullptr; diff --git a/modules/openxr/openxr_api_extension.h b/modules/openxr/openxr_api_extension.h index cff2c4738e0..e81850e0513 100644 --- a/modules/openxr/openxr_api_extension.h +++ b/modules/openxr/openxr_api_extension.h @@ -56,12 +56,12 @@ class OpenXRAPIExtension : public RefCounted { // Helper method to convert an XrPosef to a Transform3D. Transform3D transform_from_pose(GDExtensionConstPtr<const void> p_pose); - bool xr_result(uint64_t result, String format, Array args = Array()); + bool xr_result(uint64_t result, const String &format, const Array &args = Array()); static bool openxr_is_enabled(bool p_check_run_in_editor = true); //TODO workaround as GDExtensionPtr<void> return type results in build error in godot-cpp - uint64_t get_instance_proc_addr(String p_name); + uint64_t get_instance_proc_addr(const String &p_name); String get_error_string(uint64_t result); String get_swapchain_format_name(int64_t p_swapchain_format); diff --git a/modules/openxr/openxr_interface.cpp b/modules/openxr/openxr_interface.cpp index cce9c093612..445cbc7081a 100644 --- a/modules/openxr/openxr_interface.cpp +++ b/modules/openxr/openxr_interface.cpp @@ -352,7 +352,7 @@ void OpenXRInterface::free_action_sets() { action_sets.clear(); } -OpenXRInterface::Action *OpenXRInterface::create_action(ActionSet *p_action_set, const String &p_action_name, const String &p_localized_name, OpenXRAction::ActionType p_action_type, const Vector<Tracker *> p_trackers) { +OpenXRInterface::Action *OpenXRInterface::create_action(ActionSet *p_action_set, const String &p_action_name, const String &p_localized_name, OpenXRAction::ActionType p_action_type, const Vector<Tracker *> &p_trackers) { ERR_FAIL_NULL_V(openxr_api, nullptr); for (int i = 0; i < p_action_set->actions.size(); i++) { diff --git a/modules/openxr/openxr_interface.h b/modules/openxr/openxr_interface.h index f0ee0dc3c4e..802060b7a6b 100644 --- a/modules/openxr/openxr_interface.h +++ b/modules/openxr/openxr_interface.h @@ -110,7 +110,7 @@ class OpenXRInterface : public XRInterface { ActionSet *create_action_set(const String &p_action_set_name, const String &p_localized_name, const int p_priority); void free_action_sets(); - Action *create_action(ActionSet *p_action_set, const String &p_action_name, const String &p_localized_name, OpenXRAction::ActionType p_action_type, const Vector<Tracker *> p_trackers); + Action *create_action(ActionSet *p_action_set, const String &p_action_name, const String &p_localized_name, OpenXRAction::ActionType p_action_type, const Vector<Tracker *> &p_trackers); Action *find_action(const String &p_action_name); void free_actions(ActionSet *p_action_set); diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp index 70f0ea346b1..d4cf7024e51 100644 --- a/modules/upnp/upnp.cpp +++ b/modules/upnp/upnp.cpp @@ -299,7 +299,7 @@ String UPNP::query_external_address() const { return dev->query_external_address(); } -int UPNP::add_port_mapping(int port, int port_internal, String desc, String proto, int duration) const { +int UPNP::add_port_mapping(int port, int port_internal, const String &desc, const String &proto, int duration) const { Ref<UPNPDevice> dev = get_gateway(); if (dev == nullptr) { @@ -309,7 +309,7 @@ int UPNP::add_port_mapping(int port, int port_internal, String desc, String prot return dev->add_port_mapping(port, port_internal, desc, proto, duration); } -int UPNP::delete_port_mapping(int port, String proto) const { +int UPNP::delete_port_mapping(int port, const String &proto) const { Ref<UPNPDevice> dev = get_gateway(); if (dev == nullptr) { diff --git a/modules/upnp/upnp.h b/modules/upnp/upnp.h index dc9bbdbc221..df6413a8648 100644 --- a/modules/upnp/upnp.h +++ b/modules/upnp/upnp.h @@ -103,8 +103,8 @@ class UPNP : public RefCounted { String query_external_address() const; - int add_port_mapping(int port, int port_internal = 0, String desc = "", String proto = "UDP", int duration = 0) const; - int delete_port_mapping(int port, String proto = "UDP") const; + int add_port_mapping(int port, int port_internal = 0, const String &desc = "", const String &proto = "UDP", int duration = 0) const; + int delete_port_mapping(int port, const String &proto = "UDP") const; void set_discover_multicast_if(const String &m_if); String get_discover_multicast_if() const; diff --git a/modules/upnp/upnp_device.cpp b/modules/upnp/upnp_device.cpp index 11ee3681afd..3859550e0bc 100644 --- a/modules/upnp/upnp_device.cpp +++ b/modules/upnp/upnp_device.cpp @@ -48,7 +48,7 @@ String UPNPDevice::query_external_address() const { return String(addr); } -int UPNPDevice::add_port_mapping(int port, int port_internal, String desc, String proto, int duration) const { +int UPNPDevice::add_port_mapping(int port, int port_internal, const String &desc, const String &proto, int duration) const { ERR_FAIL_COND_V_MSG(!is_valid_gateway(), UPNP::UPNP_RESULT_INVALID_GATEWAY, "The Internet Gateway Device must be valid."); ERR_FAIL_COND_V_MSG(port < 1 || port > 65535, UPNP::UPNP_RESULT_INVALID_PORT, "The port number must be set between 1 and 65535 (inclusive)."); ERR_FAIL_COND_V_MSG(port_internal < 0 || port_internal > 65535, UPNP::UPNP_RESULT_INVALID_PORT, "The port number must be set between 0 and 65535 (inclusive)."); // Needs to allow 0 because 0 signifies "use external port as internal port" @@ -75,7 +75,7 @@ int UPNPDevice::add_port_mapping(int port, int port_internal, String desc, Strin return UPNP::UPNP_RESULT_SUCCESS; } -int UPNPDevice::delete_port_mapping(int port, String proto) const { +int UPNPDevice::delete_port_mapping(int port, const String &proto) const { ERR_FAIL_COND_V_MSG(port < 1 || port > 65535, UPNP::UPNP_RESULT_INVALID_PORT, "The port number must be set between 1 and 65535 (inclusive)."); ERR_FAIL_COND_V_MSG(proto != "UDP" && proto != "TCP", UPNP::UPNP_RESULT_INVALID_PROTOCOL, "The protocol must be either TCP or UDP."); diff --git a/modules/upnp/upnp_device.h b/modules/upnp/upnp_device.h index a49e574890d..7f8763ef117 100644 --- a/modules/upnp/upnp_device.h +++ b/modules/upnp/upnp_device.h @@ -70,8 +70,8 @@ class UPNPDevice : public RefCounted { bool is_valid_gateway() const; String query_external_address() const; - int add_port_mapping(int port, int port_internal = 0, String desc = "", String proto = "UDP", int duration = 0) const; - int delete_port_mapping(int port, String proto = "UDP") const; + int add_port_mapping(int port, int port_internal = 0, const String &desc = "", const String &proto = "UDP", int duration = 0) const; + int delete_port_mapping(int port, const String &proto = "UDP") const; UPNPDevice(); ~UPNPDevice(); diff --git a/modules/webrtc/webrtc_multiplayer_peer.cpp b/modules/webrtc/webrtc_multiplayer_peer.cpp index 45fa9f46ca4..672dfba0ec6 100644 --- a/modules/webrtc/webrtc_multiplayer_peer.cpp +++ b/modules/webrtc/webrtc_multiplayer_peer.cpp @@ -190,20 +190,20 @@ MultiplayerPeer::ConnectionStatus WebRTCMultiplayerPeer::get_connection_status() return connection_status; } -Error WebRTCMultiplayerPeer::create_server(Array p_channels_config) { +Error WebRTCMultiplayerPeer::create_server(const Array &p_channels_config) { return _initialize(1, MODE_SERVER, p_channels_config); } -Error WebRTCMultiplayerPeer::create_client(int p_self_id, Array p_channels_config) { +Error WebRTCMultiplayerPeer::create_client(int p_self_id, const Array &p_channels_config) { ERR_FAIL_COND_V_MSG(p_self_id == 1, ERR_INVALID_PARAMETER, "Clients cannot have ID 1."); return _initialize(p_self_id, MODE_CLIENT, p_channels_config); } -Error WebRTCMultiplayerPeer::create_mesh(int p_self_id, Array p_channels_config) { +Error WebRTCMultiplayerPeer::create_mesh(int p_self_id, const Array &p_channels_config) { return _initialize(p_self_id, MODE_MESH, p_channels_config); } -Error WebRTCMultiplayerPeer::_initialize(int p_self_id, NetworkMode p_mode, Array p_channels_config) { +Error WebRTCMultiplayerPeer::_initialize(int p_self_id, NetworkMode p_mode, const Array &p_channels_config) { ERR_FAIL_COND_V(p_self_id < 1 || p_self_id > ~(1 << 31), ERR_INVALID_PARAMETER); channels_config.clear(); channels_modes.clear(); diff --git a/modules/webrtc/webrtc_multiplayer_peer.h b/modules/webrtc/webrtc_multiplayer_peer.h index d7f4874246c..4c959d54357 100644 --- a/modules/webrtc/webrtc_multiplayer_peer.h +++ b/modules/webrtc/webrtc_multiplayer_peer.h @@ -85,15 +85,15 @@ class WebRTCMultiplayerPeer : public MultiplayerPeer { void _peer_to_dict(Ref<ConnectedPeer> p_connected_peer, Dictionary &r_dict); void _find_next_peer(); Ref<ConnectedPeer> _get_next_peer(); - Error _initialize(int p_self_id, NetworkMode p_mode, Array p_channels_config = Array()); + Error _initialize(int p_self_id, NetworkMode p_mode, const Array &p_channels_config = Array()); public: WebRTCMultiplayerPeer() {} ~WebRTCMultiplayerPeer(); - Error create_server(Array p_channels_config = Array()); - Error create_client(int p_self_id, Array p_channels_config = Array()); - Error create_mesh(int p_self_id, Array p_channels_config = Array()); + Error create_server(const Array &p_channels_config = Array()); + Error create_client(int p_self_id, const Array &p_channels_config = Array()); + Error create_mesh(int p_self_id, const Array &p_channels_config = Array()); Error add_peer(Ref<WebRTCPeerConnection> p_peer, int p_peer_id, int p_unreliable_lifetime = 1); void remove_peer(int p_peer_id); bool has_peer(int p_peer_id); diff --git a/modules/webrtc/webrtc_peer_connection.h b/modules/webrtc/webrtc_peer_connection.h index 0f79c17519b..99a3ab4b82d 100644 --- a/modules/webrtc/webrtc_peer_connection.h +++ b/modules/webrtc/webrtc_peer_connection.h @@ -76,12 +76,12 @@ class WebRTCPeerConnection : public RefCounted { virtual GatheringState get_gathering_state() const = 0; virtual SignalingState get_signaling_state() const = 0; - virtual Error initialize(Dictionary p_config = Dictionary()) = 0; - virtual Ref<WebRTCDataChannel> create_data_channel(String p_label, Dictionary p_options = Dictionary()) = 0; + virtual Error initialize(const Dictionary &p_config = Dictionary()) = 0; + virtual Ref<WebRTCDataChannel> create_data_channel(const String &p_label, const Dictionary &p_options = Dictionary()) = 0; virtual Error create_offer() = 0; - virtual Error set_remote_description(String type, String sdp) = 0; - virtual Error set_local_description(String type, String sdp) = 0; - virtual Error add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) = 0; + virtual Error set_remote_description(const String &type, const String &sdp) = 0; + virtual Error set_local_description(const String &type, const String &sdp) = 0; + virtual Error add_ice_candidate(const String &sdpMidName, int sdpMlineIndexName, const String &sdpName) = 0; virtual Error poll() = 0; virtual void close() = 0; diff --git a/modules/webrtc/webrtc_peer_connection_extension.h b/modules/webrtc/webrtc_peer_connection_extension.h index 05d88e0f658..2764d17a278 100644 --- a/modules/webrtc/webrtc_peer_connection_extension.h +++ b/modules/webrtc/webrtc_peer_connection_extension.h @@ -48,12 +48,12 @@ class WebRTCPeerConnectionExtension : public WebRTCPeerConnection { EXBIND0RC(ConnectionState, get_connection_state); EXBIND0RC(GatheringState, get_gathering_state); EXBIND0RC(SignalingState, get_signaling_state); - EXBIND1R(Error, initialize, Dictionary); - EXBIND2R(Ref<WebRTCDataChannel>, create_data_channel, String, Dictionary); + EXBIND1R(Error, initialize, const Dictionary &); + EXBIND2R(Ref<WebRTCDataChannel>, create_data_channel, const String &, const Dictionary &); EXBIND0R(Error, create_offer); - EXBIND2R(Error, set_remote_description, String, String); - EXBIND2R(Error, set_local_description, String, String); - EXBIND3R(Error, add_ice_candidate, String, int, String); + EXBIND2R(Error, set_remote_description, const String &, const String &); + EXBIND2R(Error, set_local_description, const String &, const String &); + EXBIND3R(Error, add_ice_candidate, const String &, int, const String &); EXBIND0R(Error, poll); EXBIND0(close); diff --git a/modules/webrtc/webrtc_peer_connection_js.cpp b/modules/webrtc/webrtc_peer_connection_js.cpp index 26256a4e30c..d326e1daa36 100644 --- a/modules/webrtc/webrtc_peer_connection_js.cpp +++ b/modules/webrtc/webrtc_peer_connection_js.cpp @@ -83,12 +83,12 @@ Error WebRTCPeerConnectionJS::create_offer() { return OK; } -Error WebRTCPeerConnectionJS::set_local_description(String type, String sdp) { +Error WebRTCPeerConnectionJS::set_local_description(const String &type, const String &sdp) { godot_js_rtc_pc_local_description_set(_js_id, type.utf8().get_data(), sdp.utf8().get_data(), this, &_on_error); return OK; } -Error WebRTCPeerConnectionJS::set_remote_description(String type, String sdp) { +Error WebRTCPeerConnectionJS::set_remote_description(const String &type, const String &sdp) { if (type == "offer") { ERR_FAIL_COND_V(_conn_state != STATE_NEW, FAILED); _conn_state = STATE_CONNECTING; @@ -97,12 +97,12 @@ Error WebRTCPeerConnectionJS::set_remote_description(String type, String sdp) { return OK; } -Error WebRTCPeerConnectionJS::add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) { +Error WebRTCPeerConnectionJS::add_ice_candidate(const String &sdpMidName, int sdpMlineIndexName, const String &sdpName) { godot_js_rtc_pc_ice_candidate_add(_js_id, sdpMidName.utf8().get_data(), sdpMlineIndexName, sdpName.utf8().get_data()); return OK; } -Error WebRTCPeerConnectionJS::initialize(Dictionary p_config) { +Error WebRTCPeerConnectionJS::initialize(const Dictionary &p_config) { if (_js_id) { godot_js_rtc_pc_destroy(_js_id); _js_id = 0; @@ -114,7 +114,7 @@ Error WebRTCPeerConnectionJS::initialize(Dictionary p_config) { return _js_id ? OK : FAILED; } -Ref<WebRTCDataChannel> WebRTCPeerConnectionJS::create_data_channel(String p_channel, Dictionary p_channel_config) { +Ref<WebRTCDataChannel> WebRTCPeerConnectionJS::create_data_channel(const String &p_channel, const Dictionary &p_channel_config) { ERR_FAIL_COND_V(_conn_state != STATE_NEW, nullptr); String config = Variant(p_channel_config).to_json_string(); diff --git a/modules/webrtc/webrtc_peer_connection_js.h b/modules/webrtc/webrtc_peer_connection_js.h index 1d7d10bde80..8ea1736183c 100644 --- a/modules/webrtc/webrtc_peer_connection_js.h +++ b/modules/webrtc/webrtc_peer_connection_js.h @@ -75,12 +75,12 @@ class WebRTCPeerConnectionJS : public WebRTCPeerConnection { virtual GatheringState get_gathering_state() const override; virtual SignalingState get_signaling_state() const override; - virtual Error initialize(Dictionary configuration = Dictionary()) override; - virtual Ref<WebRTCDataChannel> create_data_channel(String p_channel_name, Dictionary p_channel_config = Dictionary()) override; + virtual Error initialize(const Dictionary &configuration = Dictionary()) override; + virtual Ref<WebRTCDataChannel> create_data_channel(const String &p_channel_name, const Dictionary &p_channel_config = Dictionary()) override; virtual Error create_offer() override; - virtual Error set_remote_description(String type, String sdp) override; - virtual Error set_local_description(String type, String sdp) override; - virtual Error add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) override; + virtual Error set_remote_description(const String &type, const String &sdp) override; + virtual Error set_local_description(const String &type, const String &sdp) override; + virtual Error add_ice_candidate(const String &sdpMidName, int sdpMlineIndexName, const String &sdpName) override; virtual Error poll() override; virtual void close() override; diff --git a/modules/websocket/editor/editor_debugger_server_websocket.h b/modules/websocket/editor/editor_debugger_server_websocket.h index aeca227c59f..0815ab06500 100644 --- a/modules/websocket/editor/editor_debugger_server_websocket.h +++ b/modules/websocket/editor/editor_debugger_server_websocket.h @@ -50,7 +50,7 @@ class EditorDebuggerServerWebSocket : public EditorDebuggerServer { public: static EditorDebuggerServer *create(const String &p_protocol); - void _peer_connected(int p_peer, String p_protocol); + void _peer_connected(int p_peer, const String &p_protocol); void _peer_disconnected(int p_peer, bool p_was_clean); virtual void poll() override; diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp index 03a530909bf..15180c40a9d 100644 --- a/modules/websocket/emws_peer.cpp +++ b/modules/websocket/emws_peer.cpp @@ -176,7 +176,7 @@ void EMWSPeer::_clear() { packet_buffer.clear(); } -void EMWSPeer::close(int p_code, String p_reason) { +void EMWSPeer::close(int p_code, const String &p_reason) { if (p_code < 0) { if (peer_sock != -1) { godot_js_websocket_destroy(peer_sock); diff --git a/modules/websocket/emws_peer.h b/modules/websocket/emws_peer.h index 38f15c82e54..f8f64ea2bb9 100644 --- a/modules/websocket/emws_peer.h +++ b/modules/websocket/emws_peer.h @@ -90,7 +90,7 @@ class EMWSPeer : public WebSocketPeer { virtual Error send(const uint8_t *p_buffer, int p_buffer_size, WriteMode p_mode) override; virtual Error connect_to_url(const String &p_url, Ref<TLSOptions> p_tls_client_options) override; virtual Error accept_stream(Ref<StreamPeer> p_stream) override; - virtual void close(int p_code = 1000, String p_reason = "") override; + virtual void close(int p_code = 1000, const String &p_reason = "") override; virtual void poll() override; virtual State get_ready_state() const override; diff --git a/modules/websocket/websocket_peer.h b/modules/websocket/websocket_peer.h index 3110e87071c..588f7ba95dc 100644 --- a/modules/websocket/websocket_peer.h +++ b/modules/websocket/websocket_peer.h @@ -85,7 +85,7 @@ class WebSocketPeer : public PacketPeer { virtual Error accept_stream(Ref<StreamPeer> p_stream) = 0; virtual Error send(const uint8_t *p_buffer, int p_buffer_size, WriteMode p_mode) = 0; - virtual void close(int p_code = 1000, String p_reason = "") = 0; + virtual void close(int p_code = 1000, const String &p_reason = "") = 0; virtual IPAddress get_connected_host() const = 0; virtual uint16_t get_connected_port() const = 0; diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp index 0a9a4053e3a..0fb420bbbf3 100644 --- a/modules/websocket/wsl_peer.cpp +++ b/modules/websocket/wsl_peer.cpp @@ -657,7 +657,7 @@ String WSLPeer::_generate_key() { return CryptoCore::b64_encode_str(bkey.ptrw(), len); } -String WSLPeer::_compute_key_response(String p_key) { +String WSLPeer::_compute_key_response(const String &p_key) { String key = p_key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; // Magic UUID as per RFC Vector<uint8_t> sha = key.sha1_buffer(); return CryptoCore::b64_encode_str(sha.ptr(), sha.size()); @@ -760,7 +760,7 @@ int WSLPeer::get_current_outbound_buffered_amount() const { return wslay_event_get_queued_msg_length(wsl_ctx); } -void WSLPeer::close(int p_code, String p_reason) { +void WSLPeer::close(int p_code, const String &p_reason) { if (p_code < 0) { // Force immediate close. ready_state = STATE_CLOSED; diff --git a/modules/websocket/wsl_peer.h b/modules/websocket/wsl_peer.h index bf9f5c85273..0f87d421df4 100644 --- a/modules/websocket/wsl_peer.h +++ b/modules/websocket/wsl_peer.h @@ -60,7 +60,7 @@ class WSLPeer : public WebSocketPeer { static wslay_event_callbacks _wsl_callbacks; // Helpers - static String _compute_key_response(String p_key); + static String _compute_key_response(const String &p_key); static String _generate_key(); // Client IP resolver. @@ -133,7 +133,7 @@ class WSLPeer : public WebSocketPeer { virtual Error send(const uint8_t *p_buffer, int p_buffer_size, WriteMode p_mode) override; virtual Error connect_to_url(const String &p_url, Ref<TLSOptions> p_options = Ref<TLSOptions>()) override; virtual Error accept_stream(Ref<StreamPeer> p_stream) override; - virtual void close(int p_code = 1000, String p_reason = "") override; + virtual void close(int p_code = 1000, const String &p_reason = "") override; virtual void poll() override; virtual State get_ready_state() const override { return ready_state; } diff --git a/modules/webxr/webxr_interface.h b/modules/webxr/webxr_interface.h index 241dc9fe76e..3c3c38c148a 100644 --- a/modules/webxr/webxr_interface.h +++ b/modules/webxr/webxr_interface.h @@ -58,13 +58,13 @@ class WebXRInterface : public XRInterface { }; virtual void is_session_supported(const String &p_session_mode) = 0; - virtual void set_session_mode(String p_session_mode) = 0; + virtual void set_session_mode(const String &p_session_mode) = 0; virtual String get_session_mode() const = 0; - virtual void set_required_features(String p_required_features) = 0; + virtual void set_required_features(const String &p_required_features) = 0; virtual String get_required_features() const = 0; - virtual void set_optional_features(String p_optional_features) = 0; + virtual void set_optional_features(const String &p_optional_features) = 0; virtual String get_optional_features() const = 0; - virtual void set_requested_reference_space_types(String p_requested_reference_space_types) = 0; + virtual void set_requested_reference_space_types(const String &p_requested_reference_space_types) = 0; virtual String get_requested_reference_space_types() const = 0; virtual String get_reference_space_type() const = 0; virtual String get_enabled_features() const = 0; diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp index 78a9db9b19e..1a62d198c2c 100644 --- a/modules/webxr/webxr_interface_js.cpp +++ b/modules/webxr/webxr_interface_js.cpp @@ -121,7 +121,7 @@ void WebXRInterfaceJS::is_session_supported(const String &p_session_mode) { godot_webxr_is_session_supported(p_session_mode.utf8().get_data(), &_emwebxr_on_session_supported); } -void WebXRInterfaceJS::set_session_mode(String p_session_mode) { +void WebXRInterfaceJS::set_session_mode(const String &p_session_mode) { session_mode = p_session_mode; } @@ -129,7 +129,7 @@ String WebXRInterfaceJS::get_session_mode() const { return session_mode; } -void WebXRInterfaceJS::set_required_features(String p_required_features) { +void WebXRInterfaceJS::set_required_features(const String &p_required_features) { required_features = p_required_features; } @@ -137,7 +137,7 @@ String WebXRInterfaceJS::get_required_features() const { return required_features; } -void WebXRInterfaceJS::set_optional_features(String p_optional_features) { +void WebXRInterfaceJS::set_optional_features(const String &p_optional_features) { optional_features = p_optional_features; } @@ -145,7 +145,7 @@ String WebXRInterfaceJS::get_optional_features() const { return optional_features; } -void WebXRInterfaceJS::set_requested_reference_space_types(String p_requested_reference_space_types) { +void WebXRInterfaceJS::set_requested_reference_space_types(const String &p_requested_reference_space_types) { requested_reference_space_types = p_requested_reference_space_types; } diff --git a/modules/webxr/webxr_interface_js.h b/modules/webxr/webxr_interface_js.h index d02c8d26777..bc9ebeedd0b 100644 --- a/modules/webxr/webxr_interface_js.h +++ b/modules/webxr/webxr_interface_js.h @@ -95,13 +95,13 @@ class WebXRInterfaceJS : public WebXRInterface { public: virtual void is_session_supported(const String &p_session_mode) override; - virtual void set_session_mode(String p_session_mode) override; + virtual void set_session_mode(const String &p_session_mode) override; virtual String get_session_mode() const override; - virtual void set_required_features(String p_required_features) override; + virtual void set_required_features(const String &p_required_features) override; virtual String get_required_features() const override; - virtual void set_optional_features(String p_optional_features) override; + virtual void set_optional_features(const String &p_optional_features) override; virtual String get_optional_features() const override; - virtual void set_requested_reference_space_types(String p_requested_reference_space_types) override; + virtual void set_requested_reference_space_types(const String &p_requested_reference_space_types) override; virtual String get_requested_reference_space_types() const override; virtual String get_reference_space_type() const override; virtual String get_enabled_features() const override; diff --git a/scene/main/multiplayer_api.cpp b/scene/main/multiplayer_api.cpp index bd097ec2d05..bce5d843a4d 100644 --- a/scene/main/multiplayer_api.cpp +++ b/scene/main/multiplayer_api.cpp @@ -371,13 +371,13 @@ int MultiplayerAPIExtension::get_remote_sender_id() { return id; } -Error MultiplayerAPIExtension::object_configuration_add(Object *p_object, Variant p_config) { +Error MultiplayerAPIExtension::object_configuration_add(Object *p_object, const Variant &p_config) { Error err = ERR_UNAVAILABLE; GDVIRTUAL_CALL(_object_configuration_add, p_object, p_config, err); return err; } -Error MultiplayerAPIExtension::object_configuration_remove(Object *p_object, Variant p_config) { +Error MultiplayerAPIExtension::object_configuration_remove(Object *p_object, const Variant &p_config) { Error err = ERR_UNAVAILABLE; GDVIRTUAL_CALL(_object_configuration_remove, p_object, p_config, err); return err; diff --git a/scene/main/multiplayer_api.h b/scene/main/multiplayer_api.h index a578e6f2f17..afdaa4aca15 100644 --- a/scene/main/multiplayer_api.h +++ b/scene/main/multiplayer_api.h @@ -69,8 +69,8 @@ class MultiplayerAPI : public RefCounted { virtual Error rpcp(Object *p_obj, int p_peer_id, const StringName &p_method, const Variant **p_arg, int p_argcount) = 0; virtual int get_remote_sender_id() = 0; - virtual Error object_configuration_add(Object *p_object, Variant p_config) = 0; - virtual Error object_configuration_remove(Object *p_object, Variant p_config) = 0; + virtual Error object_configuration_add(Object *p_object, const Variant &p_config) = 0; + virtual Error object_configuration_remove(Object *p_object, const Variant &p_config) = 0; bool has_multiplayer_peer() { return get_multiplayer_peer().is_valid(); } bool is_server() { return get_unique_id() == MultiplayerPeer::TARGET_PEER_SERVER; } @@ -97,8 +97,8 @@ class MultiplayerAPIExtension : public MultiplayerAPI { virtual Error rpcp(Object *p_obj, int p_peer_id, const StringName &p_method, const Variant **p_arg, int p_argcount) override; virtual int get_remote_sender_id() override; - virtual Error object_configuration_add(Object *p_object, Variant p_config) override; - virtual Error object_configuration_remove(Object *p_object, Variant p_config) override; + virtual Error object_configuration_add(Object *p_object, const Variant &p_config) override; + virtual Error object_configuration_remove(Object *p_object, const Variant &p_config) override; // Extensions GDVIRTUAL0R(Error, _poll);