From 9e9eac46763feec5334f50c55b5ffdd233ae6472 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Sun, 15 Jan 2023 20:33:20 +0100 Subject: [PATCH] Use enum instead of int in virtual methods return type --- core/io/resource_loader.cpp | 4 +-- core/io/resource_loader.h | 2 +- core/io/resource_saver.cpp | 6 ++-- core/io/resource_saver.h | 2 +- doc/classes/EditorImportPlugin.xml | 2 +- doc/classes/MultiplayerAPIExtension.xml | 8 ++--- doc/classes/ResourceFormatLoader.xml | 2 +- doc/classes/ResourceFormatSaver.xml | 2 +- doc/classes/VisualShaderNodeCustom.xml | 6 ++-- doc/classes/XRInterfaceExtension.xml | 6 ++-- editor/import/editor_import_plugin.cpp | 6 ++-- editor/import/editor_import_plugin.h | 2 +- editor/import/resource_importer_scene.cpp | 2 +- editor/import/resource_importer_scene.h | 2 +- .../doc_classes/GLTFDocumentExtension.xml | 16 +++++----- .../extensions/gltf_document_extension.cpp | 32 +++++++++---------- .../gltf/extensions/gltf_document_extension.h | 16 +++++----- scene/main/multiplayer_api.cpp | 16 +++++----- scene/main/multiplayer_api.h | 8 ++--- scene/main/multiplayer_peer.cpp | 2 +- scene/resources/visual_shader.cpp | 10 ++++-- scene/resources/visual_shader.h | 6 ++-- servers/xr/xr_interface_extension.cpp | 8 ++--- servers/xr/xr_interface_extension.h | 6 ++-- 24 files changed, 88 insertions(+), 84 deletions(-) diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 7447119ab76..fc3547261bd 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -176,9 +176,9 @@ Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Hash deps_dict[E.key] = E.value; } - int64_t err = OK; + Error err = OK; GDVIRTUAL_CALL(_rename_dependencies, p_path, deps_dict, err); - return (Error)err; + return err; } void ResourceFormatLoader::_bind_methods() { diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h index eb8155e0462..c47b6c950a6 100644 --- a/core/io/resource_loader.h +++ b/core/io/resource_loader.h @@ -58,7 +58,7 @@ protected: GDVIRTUAL1RC(ResourceUID::ID, _get_resource_uid, String) GDVIRTUAL2RC(Vector, _get_dependencies, String, bool) GDVIRTUAL1RC(Vector, _get_classes_used, String) - GDVIRTUAL2RC(int64_t, _rename_dependencies, String, Dictionary) + GDVIRTUAL2RC(Error, _rename_dependencies, String, Dictionary) GDVIRTUAL1RC(bool, _exists, String) GDVIRTUAL4RC(Variant, _load, String, String, bool, int) diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index b8201cc6b92..6e377847a81 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -42,9 +42,9 @@ ResourceSavedCallback ResourceSaver::save_callback = nullptr; ResourceSaverGetResourceIDForPath ResourceSaver::save_get_id_for_path = nullptr; Error ResourceFormatSaver::save(const Ref &p_resource, const String &p_path, uint32_t p_flags) { - int64_t res = ERR_METHOD_NOT_FOUND; - GDVIRTUAL_CALL(_save, p_resource, p_path, p_flags, res); - return (Error)res; + Error err = ERR_METHOD_NOT_FOUND; + GDVIRTUAL_CALL(_save, p_resource, p_path, p_flags, err); + return err; } Error ResourceFormatSaver::set_uid(const String &p_path, ResourceUID::ID p_uid) { diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h index 9e88b2086b0..572742d1294 100644 --- a/core/io/resource_saver.h +++ b/core/io/resource_saver.h @@ -41,7 +41,7 @@ class ResourceFormatSaver : public RefCounted { protected: static void _bind_methods(); - GDVIRTUAL3R(int64_t, _save, Ref, String, uint32_t) + GDVIRTUAL3R(Error, _save, Ref, String, uint32_t) GDVIRTUAL2R(Error, _set_uid, String, ResourceUID::ID) GDVIRTUAL1RC(bool, _recognize, Ref) GDVIRTUAL1RC(Vector, _get_recognized_extensions, Ref) diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index ec9efcc9c46..50cabf3c8c1 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -210,7 +210,7 @@ - + diff --git a/doc/classes/MultiplayerAPIExtension.xml b/doc/classes/MultiplayerAPIExtension.xml index c4012a920a5..b853c32407a 100644 --- a/doc/classes/MultiplayerAPIExtension.xml +++ b/doc/classes/MultiplayerAPIExtension.xml @@ -99,7 +99,7 @@ - + @@ -107,7 +107,7 @@ - + @@ -115,13 +115,13 @@ - + Callback for [method MultiplayerAPI.poll]. - + diff --git a/doc/classes/ResourceFormatLoader.xml b/doc/classes/ResourceFormatLoader.xml index bb55123b37e..1d509d29380 100644 --- a/doc/classes/ResourceFormatLoader.xml +++ b/doc/classes/ResourceFormatLoader.xml @@ -88,7 +88,7 @@ - + diff --git a/doc/classes/ResourceFormatSaver.xml b/doc/classes/ResourceFormatSaver.xml index b0c57bc7cbe..7e8e2ec67d4 100644 --- a/doc/classes/ResourceFormatSaver.xml +++ b/doc/classes/ResourceFormatSaver.xml @@ -34,7 +34,7 @@ - + diff --git a/doc/classes/VisualShaderNodeCustom.xml b/doc/classes/VisualShaderNodeCustom.xml index d96969b3830..279295a434f 100644 --- a/doc/classes/VisualShaderNodeCustom.xml +++ b/doc/classes/VisualShaderNodeCustom.xml @@ -81,7 +81,7 @@ - + Override this method to define the returned type of each input port of the associated custom node (see [enum VisualShaderNode.PortType] for possible types). @@ -111,7 +111,7 @@ - + Override this method to define the returned type of each output port of the associated custom node (see [enum VisualShaderNode.PortType] for possible types). @@ -119,7 +119,7 @@ - + Override this method to define the return icon of the associated custom node in the Visual Shader Editor's members dialog. Defining this method is [b]optional[/b]. If not overridden, no return icon is shown. diff --git a/doc/classes/XRInterfaceExtension.xml b/doc/classes/XRInterfaceExtension.xml index 5ad67a7ea9a..b74ac1e469e 100644 --- a/doc/classes/XRInterfaceExtension.xml +++ b/doc/classes/XRInterfaceExtension.xml @@ -64,7 +64,7 @@ - + Returns the [enum XRInterface.PlayAreaMode] that sets up our play area. @@ -99,7 +99,7 @@ - + Returns a [enum XRInterface.TrackingStatus] specifying the current status of our tracking. @@ -177,7 +177,7 @@ - + Set the play area mode for this interface. diff --git a/editor/import/editor_import_plugin.cpp b/editor/import/editor_import_plugin.cpp index fb14dcf8884..ef3d3d12766 100644 --- a/editor/import/editor_import_plugin.cpp +++ b/editor/import/editor_import_plugin.cpp @@ -172,17 +172,15 @@ Error EditorImportPlugin::import(const String &p_source_file, const String &p_sa ++E; } - int err = 0; + Error err = OK; if (GDVIRTUAL_CALL(_import, p_source_file, p_save_path, options, platform_variants, gen_files, err)) { - Error ret_err = Error(err); - for (int i = 0; i < platform_variants.size(); i++) { r_platform_variants->push_back(platform_variants[i]); } for (int i = 0; i < gen_files.size(); i++) { r_gen_files->push_back(gen_files[i]); } - return ret_err; + return err; } ERR_FAIL_V_MSG(ERR_METHOD_NOT_FOUND, "Unimplemented _import in add-on."); } diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h index 0f79ba4783c..bf912058a29 100644 --- a/editor/import/editor_import_plugin.h +++ b/editor/import/editor_import_plugin.h @@ -51,7 +51,7 @@ protected: GDVIRTUAL0RC(float, _get_priority) GDVIRTUAL0RC(int, _get_import_order) GDVIRTUAL3RC(bool, _get_option_visibility, String, StringName, Dictionary) - GDVIRTUAL5RC(int, _import, String, String, Dictionary, TypedArray, TypedArray) + GDVIRTUAL5RC(Error, _import, String, String, Dictionary, TypedArray, TypedArray) public: EditorImportPlugin(); diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 6c6c89bcc06..5b05120a763 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -54,7 +54,7 @@ #include "scene/resources/world_boundary_shape_3d.h" uint32_t EditorSceneFormatImporter::get_import_flags() const { - int ret; + uint32_t ret; if (GDVIRTUAL_CALL(_get_import_flags, ret)) { return ret; } diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h index aa057d34048..d6d83a45d35 100644 --- a/editor/import/resource_importer_scene.h +++ b/editor/import/resource_importer_scene.h @@ -56,7 +56,7 @@ protected: Node *import_scene_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options); Ref import_animation_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options); - GDVIRTUAL0RC(int, _get_import_flags) + GDVIRTUAL0RC(uint32_t, _get_import_flags) GDVIRTUAL0RC(Vector, _get_extensions) GDVIRTUAL3R(Object *, _import_scene, String, uint32_t, Dictionary) GDVIRTUAL1(_get_import_options, String) diff --git a/modules/gltf/doc_classes/GLTFDocumentExtension.xml b/modules/gltf/doc_classes/GLTFDocumentExtension.xml index 6004de32f19..6e8340f618d 100644 --- a/modules/gltf/doc_classes/GLTFDocumentExtension.xml +++ b/modules/gltf/doc_classes/GLTFDocumentExtension.xml @@ -22,7 +22,7 @@ - + @@ -33,7 +33,7 @@ - + Part of the export process. This method is run last, after all other parts of the export process. @@ -41,7 +41,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -78,7 +78,7 @@ - + @@ -87,7 +87,7 @@ - + Part of the import process. This method is run after [method _generate_scene_node] and before [method _import_node]. @@ -95,7 +95,7 @@ - + @@ -104,7 +104,7 @@ - + diff --git a/modules/gltf/extensions/gltf_document_extension.cpp b/modules/gltf/extensions/gltf_document_extension.cpp index 496a8f6cb8b..bedb42eb321 100644 --- a/modules/gltf/extensions/gltf_document_extension.cpp +++ b/modules/gltf/extensions/gltf_document_extension.cpp @@ -49,9 +49,9 @@ void GLTFDocumentExtension::_bind_methods() { // Import process. Error GLTFDocumentExtension::import_preflight(Ref p_state, Vector p_extensions) { ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER); - int err = OK; + Error err = OK; GDVIRTUAL_CALL(_import_preflight, p_state, p_extensions, err); - return Error(err); + return err; } Vector GLTFDocumentExtension::get_supported_extensions() { @@ -63,9 +63,9 @@ Vector GLTFDocumentExtension::get_supported_extensions() { Error GLTFDocumentExtension::parse_node_extensions(Ref p_state, Ref p_gltf_node, Dictionary &p_extensions) { ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER); ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER); - int err = OK; + Error err = OK; GDVIRTUAL_CALL(_parse_node_extensions, p_state, p_gltf_node, p_extensions, err); - return Error(err); + return err; } Node3D *GLTFDocumentExtension::generate_scene_node(Ref p_state, Ref p_gltf_node, Node *p_scene_parent) { @@ -79,34 +79,34 @@ Node3D *GLTFDocumentExtension::generate_scene_node(Ref p_state, Ref p_state) { ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER); - int err = OK; + Error err = OK; GDVIRTUAL_CALL(_import_post_parse, p_state, err); - return Error(err); + return err; } Error GLTFDocumentExtension::import_node(Ref p_state, Ref p_gltf_node, Dictionary &r_dict, Node *p_node) { ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER); ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER); ERR_FAIL_NULL_V(p_node, ERR_INVALID_PARAMETER); - int err = OK; + Error err = OK; GDVIRTUAL_CALL(_import_node, p_state, p_gltf_node, r_dict, p_node, err); - return Error(err); + return err; } Error GLTFDocumentExtension::import_post(Ref p_state, Node *p_root) { ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER); ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER); - int err = OK; + Error err = OK; GDVIRTUAL_CALL(_import_post, p_state, p_root, err); - return Error(err); + return err; } // Export process. Error GLTFDocumentExtension::export_preflight(Ref p_state, Node *p_root) { ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER); - int err = OK; + Error err = OK; GDVIRTUAL_CALL(_export_preflight, p_state, p_root, err); - return Error(err); + return err; } void GLTFDocumentExtension::convert_scene_node(Ref p_state, Ref p_gltf_node, Node *p_scene_node) { @@ -120,14 +120,14 @@ Error GLTFDocumentExtension::export_node(Ref p_state, Ref p ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER); ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER); ERR_FAIL_NULL_V(p_node, ERR_INVALID_PARAMETER); - int err = OK; + Error err = OK; GDVIRTUAL_CALL(_export_node, p_state, p_gltf_node, r_dict, p_node, err); - return Error(err); + return err; } Error GLTFDocumentExtension::export_post(Ref p_state) { ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER); - int err = OK; + Error err = OK; GDVIRTUAL_CALL(_export_post, p_state, err); - return Error(err); + return err; } diff --git a/modules/gltf/extensions/gltf_document_extension.h b/modules/gltf/extensions/gltf_document_extension.h index 97f5045a1c0..3531f81f6fa 100644 --- a/modules/gltf/extensions/gltf_document_extension.h +++ b/modules/gltf/extensions/gltf_document_extension.h @@ -55,18 +55,18 @@ public: virtual Error export_post(Ref p_state); // Import process. - GDVIRTUAL2R(int, _import_preflight, Ref, Vector); + GDVIRTUAL2R(Error, _import_preflight, Ref, Vector); GDVIRTUAL0R(Vector, _get_supported_extensions); - GDVIRTUAL3R(int, _parse_node_extensions, Ref, Ref, Dictionary); + GDVIRTUAL3R(Error, _parse_node_extensions, Ref, Ref, Dictionary); GDVIRTUAL3R(Node3D *, _generate_scene_node, Ref, Ref, Node *); - GDVIRTUAL1R(int, _import_post_parse, Ref); - GDVIRTUAL4R(int, _import_node, Ref, Ref, Dictionary, Node *); - GDVIRTUAL2R(int, _import_post, Ref, Node *); + GDVIRTUAL1R(Error, _import_post_parse, Ref); + GDVIRTUAL4R(Error, _import_node, Ref, Ref, Dictionary, Node *); + GDVIRTUAL2R(Error, _import_post, Ref, Node *); // Export process. - GDVIRTUAL2R(int, _export_preflight, Ref, Node *); + GDVIRTUAL2R(Error, _export_preflight, Ref, Node *); GDVIRTUAL3(_convert_scene_node, Ref, Ref, Node *); - GDVIRTUAL4R(int, _export_node, Ref, Ref, Dictionary, Node *); - GDVIRTUAL1R(int, _export_post, Ref); + GDVIRTUAL4R(Error, _export_node, Ref, Ref, Dictionary, Node *); + GDVIRTUAL1R(Error, _export_post, Ref); }; #endif // GLTF_DOCUMENT_EXTENSION_H diff --git a/scene/main/multiplayer_api.cpp b/scene/main/multiplayer_api.cpp index c54e61580f5..950eb2809cd 100644 --- a/scene/main/multiplayer_api.cpp +++ b/scene/main/multiplayer_api.cpp @@ -329,9 +329,9 @@ void MultiplayerAPI::_bind_methods() { /// MultiplayerAPIExtension Error MultiplayerAPIExtension::poll() { - int err = OK; + Error err = OK; GDVIRTUAL_CALL(_poll, err); - return (Error)err; + return err; } void MultiplayerAPIExtension::set_multiplayer_peer(const Ref &p_peer) { @@ -364,9 +364,9 @@ Error MultiplayerAPIExtension::rpcp(Object *p_obj, int p_peer_id, const StringNa for (int i = 0; i < p_argcount; i++) { args.push_back(*p_arg[i]); } - int ret = FAILED; + Error ret = FAILED; GDVIRTUAL_CALL(_rpc, p_peer_id, p_obj, p_method, args, ret); - return (Error)ret; + return ret; } int MultiplayerAPIExtension::get_remote_sender_id() { @@ -376,15 +376,15 @@ int MultiplayerAPIExtension::get_remote_sender_id() { } Error MultiplayerAPIExtension::object_configuration_add(Object *p_object, Variant p_config) { - int err = ERR_UNAVAILABLE; + Error err = ERR_UNAVAILABLE; GDVIRTUAL_CALL(_object_configuration_add, p_object, p_config, err); - return (Error)err; + return err; } Error MultiplayerAPIExtension::object_configuration_remove(Object *p_object, Variant p_config) { - int err = ERR_UNAVAILABLE; + Error err = ERR_UNAVAILABLE; GDVIRTUAL_CALL(_object_configuration_remove, p_object, p_config, err); - return (Error)err; + return err; } void MultiplayerAPIExtension::_bind_methods() { diff --git a/scene/main/multiplayer_api.h b/scene/main/multiplayer_api.h index 0b107ee50b3..a578e6f2f17 100644 --- a/scene/main/multiplayer_api.h +++ b/scene/main/multiplayer_api.h @@ -101,15 +101,15 @@ public: virtual Error object_configuration_remove(Object *p_object, Variant p_config) override; // Extensions - GDVIRTUAL0R(int, _poll); + GDVIRTUAL0R(Error, _poll); GDVIRTUAL1(_set_multiplayer_peer, Ref); GDVIRTUAL0R(Ref, _get_multiplayer_peer); GDVIRTUAL0RC(int, _get_unique_id); GDVIRTUAL0RC(PackedInt32Array, _get_peer_ids); - GDVIRTUAL4R(int, _rpc, int, Object *, StringName, Array); + GDVIRTUAL4R(Error, _rpc, int, Object *, StringName, Array); GDVIRTUAL0RC(int, _get_remote_sender_id); - GDVIRTUAL2R(int, _object_configuration_add, Object *, Variant); - GDVIRTUAL2R(int, _object_configuration_remove, Object *, Variant); + GDVIRTUAL2R(Error, _object_configuration_add, Object *, Variant); + GDVIRTUAL2R(Error, _object_configuration_remove, Object *, Variant); }; #endif // MULTIPLAYER_API_H diff --git a/scene/main/multiplayer_peer.cpp b/scene/main/multiplayer_peer.cpp index 83555966d71..f3e56a14552 100644 --- a/scene/main/multiplayer_peer.cpp +++ b/scene/main/multiplayer_peer.cpp @@ -163,7 +163,7 @@ Error MultiplayerPeerExtension::put_packet(const uint8_t *p_buffer, int p_buffer if (!GDVIRTUAL_CALL(_put_packet_script, a, err)) { return FAILED; } - return (Error)err; + return err; } WARN_PRINT_ONCE("MultiplayerPeerExtension::_put_packet_native is unimplemented!"); return FAILED; diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index bfcf5cb1376..c18cad48d5a 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -427,7 +427,10 @@ void VisualShaderNodeCustom::update_ports() { if (!GDVIRTUAL_CALL(_get_input_port_name, i, port.name)) { port.name = "in" + itos(i); } - if (!GDVIRTUAL_CALL(_get_input_port_type, i, port.type)) { + PortType port_type; + if (GDVIRTUAL_CALL(_get_input_port_type, i, port_type)) { + port.type = (int)port_type; + } else { port.type = (int)PortType::PORT_TYPE_SCALAR; } @@ -445,7 +448,10 @@ void VisualShaderNodeCustom::update_ports() { if (!GDVIRTUAL_CALL(_get_output_port_name, i, port.name)) { port.name = "out" + itos(i); } - if (!GDVIRTUAL_CALL(_get_output_port_type, i, port.type)) { + PortType port_type; + if (GDVIRTUAL_CALL(_get_output_port_type, i, port_type)) { + port.type = (int)port_type; + } else { port.type = (int)PortType::PORT_TYPE_SCALAR; } diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index 0d53589fa5e..fc5e48410b1 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -369,12 +369,12 @@ protected: GDVIRTUAL0RC(String, _get_name) GDVIRTUAL0RC(String, _get_description) GDVIRTUAL0RC(String, _get_category) - GDVIRTUAL0RC(int, _get_return_icon_type) + GDVIRTUAL0RC(PortType, _get_return_icon_type) GDVIRTUAL0RC(int, _get_input_port_count) - GDVIRTUAL1RC(int, _get_input_port_type, int) + GDVIRTUAL1RC(PortType, _get_input_port_type, int) GDVIRTUAL1RC(String, _get_input_port_name, int) GDVIRTUAL0RC(int, _get_output_port_count) - GDVIRTUAL1RC(int, _get_output_port_type, int) + GDVIRTUAL1RC(PortType, _get_output_port_type, int) GDVIRTUAL1RC(String, _get_output_port_name, int) GDVIRTUAL4RC(String, _get_code, TypedArray, TypedArray, Shader::Mode, VisualShader::Type) GDVIRTUAL2RC(String, _get_func_code, Shader::Mode, VisualShader::Type) diff --git a/servers/xr/xr_interface_extension.cpp b/servers/xr/xr_interface_extension.cpp index 63e862f6057..0ff59d2a39c 100644 --- a/servers/xr/xr_interface_extension.cpp +++ b/servers/xr/xr_interface_extension.cpp @@ -136,9 +136,9 @@ PackedStringArray XRInterfaceExtension::get_suggested_pose_names(const StringNam } XRInterface::TrackingStatus XRInterfaceExtension::get_tracking_status() const { - uint32_t status = XR_UNKNOWN_TRACKING; + XRInterface::TrackingStatus status = XR_UNKNOWN_TRACKING; GDVIRTUAL_CALL(_get_tracking_status, status); - return TrackingStatus(status); + return status; } void XRInterfaceExtension::trigger_haptic_pulse(const String &p_action_name, const StringName &p_tracker_name, double p_frequency, double p_amplitude, double p_duration_sec, double p_delay_sec) { @@ -152,9 +152,9 @@ bool XRInterfaceExtension::supports_play_area_mode(XRInterface::PlayAreaMode p_m } XRInterface::PlayAreaMode XRInterfaceExtension::get_play_area_mode() const { - uint32_t mode = XR_PLAY_AREA_UNKNOWN; + XRInterface::PlayAreaMode mode = XR_PLAY_AREA_UNKNOWN; GDVIRTUAL_CALL(_get_play_area_mode, mode); - return XRInterface::PlayAreaMode(mode); + return mode; } bool XRInterfaceExtension::set_play_area_mode(XRInterface::PlayAreaMode p_mode) { diff --git a/servers/xr/xr_interface_extension.h b/servers/xr/xr_interface_extension.h index 39cd284e5c0..454a50cb287 100644 --- a/servers/xr/xr_interface_extension.h +++ b/servers/xr/xr_interface_extension.h @@ -71,7 +71,7 @@ public: GDVIRTUAL0RC(PackedStringArray, _get_suggested_tracker_names); GDVIRTUAL1RC(PackedStringArray, _get_suggested_pose_names, const StringName &); - GDVIRTUAL0RC(uint32_t, _get_tracking_status); + GDVIRTUAL0RC(XRInterface::TrackingStatus, _get_tracking_status); GDVIRTUAL6(_trigger_haptic_pulse, const String &, const StringName &, double, double, double, double); /** specific to VR **/ @@ -81,8 +81,8 @@ public: virtual PackedVector3Array get_play_area() const override; /* if available, returns an array of vectors denoting the play area the player can move around in */ GDVIRTUAL1RC(bool, _supports_play_area_mode, XRInterface::PlayAreaMode); - GDVIRTUAL0RC(uint32_t, _get_play_area_mode); - GDVIRTUAL1RC(bool, _set_play_area_mode, uint32_t); + GDVIRTUAL0RC(XRInterface::PlayAreaMode, _get_play_area_mode); + GDVIRTUAL1RC(bool, _set_play_area_mode, XRInterface::PlayAreaMode); GDVIRTUAL0RC(PackedVector3Array, _get_play_area); /** specific to AR **/