From c23bd8b1431a745991a19f7cb89e4111efedf555 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Sat, 26 Aug 2023 17:39:43 +0200 Subject: [PATCH] Ensure OpenXR classes are declared properly Co-authored-by: Bastiaan Olij --- .../openxr/action_map/openxr_action_map.cpp | 4 +- .../action_map/openxr_interaction_profile.h | 2 +- ...> openxr_interaction_profile_metadata.cpp} | 48 +++++++++---------- ... => openxr_interaction_profile_metadata.h} | 22 +++++---- modules/openxr/config.py | 3 ++ .../doc_classes}/OpenXRAPIExtension.xml | 2 +- .../OpenXRExtensionWrapperExtension.xml | 2 +- .../doc_classes/OpenXRInteractionProfile.xml | 2 +- .../OpenXRInteractionProfileMetadata.xml | 46 ++++++++++++++++++ .../openxr_interaction_profile_editor.cpp | 10 ++-- .../openxr_interaction_profile_editor.h | 6 +-- ...enxr_select_interaction_profile_dialog.cpp | 4 +- ...openxr_select_interaction_profile_dialog.h | 2 +- .../openxr_htc_controller_extension.cpp | 4 +- .../openxr_htc_vive_tracker_extension.cpp | 4 +- .../openxr_huawei_controller_extension.cpp | 4 +- .../openxr_ml2_controller_extension.cpp | 4 +- .../openxr_pico_controller_extension.cpp | 4 +- .../openxr_wmr_controller_extension.cpp | 4 +- modules/openxr/openxr_api.cpp | 8 ++-- modules/openxr/register_types.cpp | 24 +++++----- servers/xr/xr_interface.h | 2 +- tests/scene/test_arraymesh.h | 2 +- 23 files changed, 132 insertions(+), 81 deletions(-) rename modules/openxr/action_map/{openxr_interaction_profile_meta_data.cpp => openxr_interaction_profile_metadata.cpp} (95%) rename modules/openxr/action_map/{openxr_interaction_profile_meta_data.h => openxr_interaction_profile_metadata.h} (91%) rename {doc/classes => modules/openxr/doc_classes}/OpenXRAPIExtension.xml (99%) rename {doc/classes => modules/openxr/doc_classes}/OpenXRExtensionWrapperExtension.xml (99%) create mode 100644 modules/openxr/doc_classes/OpenXRInteractionProfileMetadata.xml diff --git a/modules/openxr/action_map/openxr_action_map.cpp b/modules/openxr/action_map/openxr_action_map.cpp index 63abbf0d71e..80beed807e6 100644 --- a/modules/openxr/action_map/openxr_action_map.cpp +++ b/modules/openxr/action_map/openxr_action_map.cpp @@ -547,7 +547,7 @@ PackedStringArray OpenXRActionMap::get_top_level_paths(const Ref p for (int i = 0; i < interaction_profiles.size(); i++) { Ref ip = interaction_profiles[i]; - const OpenXRInteractionProfileMetaData::InteractionProfile *profile = OpenXRInteractionProfileMetaData::get_singleton()->get_profile(ip->get_interaction_profile_path()); + const OpenXRInteractionProfileMetadata::InteractionProfile *profile = OpenXRInteractionProfileMetadata::get_singleton()->get_profile(ip->get_interaction_profile_path()); if (profile != nullptr) { for (int j = 0; j < ip->get_binding_count(); j++) { @@ -556,7 +556,7 @@ PackedStringArray OpenXRActionMap::get_top_level_paths(const Ref p PackedStringArray paths = binding->get_paths(); for (int k = 0; k < paths.size(); k++) { - const OpenXRInteractionProfileMetaData::IOPath *io_path = profile->get_io_path(paths[k]); + const OpenXRInteractionProfileMetadata::IOPath *io_path = profile->get_io_path(paths[k]); if (io_path != nullptr) { String top_path = io_path->top_level_path; diff --git a/modules/openxr/action_map/openxr_interaction_profile.h b/modules/openxr/action_map/openxr_interaction_profile.h index 4a82785f14a..479cc3c5270 100644 --- a/modules/openxr/action_map/openxr_interaction_profile.h +++ b/modules/openxr/action_map/openxr_interaction_profile.h @@ -32,7 +32,7 @@ #define OPENXR_INTERACTION_PROFILE_H #include "openxr_action.h" -#include "openxr_interaction_profile_meta_data.h" +#include "openxr_interaction_profile_metadata.h" #include "core/io/resource.h" diff --git a/modules/openxr/action_map/openxr_interaction_profile_meta_data.cpp b/modules/openxr/action_map/openxr_interaction_profile_metadata.cpp similarity index 95% rename from modules/openxr/action_map/openxr_interaction_profile_meta_data.cpp rename to modules/openxr/action_map/openxr_interaction_profile_metadata.cpp index 11449bdfb4d..9f0198dfc4f 100644 --- a/modules/openxr/action_map/openxr_interaction_profile_meta_data.cpp +++ b/modules/openxr/action_map/openxr_interaction_profile_metadata.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* openxr_interaction_profile_meta_data.cpp */ +/* openxr_interaction_profile_metadata.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,30 +28,30 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#include "openxr_interaction_profile_meta_data.h" +#include "openxr_interaction_profile_metadata.h" #include "../openxr_api.h" -OpenXRInteractionProfileMetaData *OpenXRInteractionProfileMetaData::singleton = nullptr; +OpenXRInteractionProfileMetadata *OpenXRInteractionProfileMetadata::singleton = nullptr; -OpenXRInteractionProfileMetaData::OpenXRInteractionProfileMetaData() { +OpenXRInteractionProfileMetadata::OpenXRInteractionProfileMetadata() { singleton = this; _register_core_metadata(); OpenXRAPI::register_extension_metadata(); } -OpenXRInteractionProfileMetaData::~OpenXRInteractionProfileMetaData() { +OpenXRInteractionProfileMetadata::~OpenXRInteractionProfileMetadata() { singleton = nullptr; } -void OpenXRInteractionProfileMetaData::_bind_methods() { - ClassDB::bind_method(D_METHOD("register_top_level_path", "display_name", "openxr_path", "openxr_extension_name"), &OpenXRInteractionProfileMetaData::register_top_level_path); - ClassDB::bind_method(D_METHOD("register_interaction_profile", "display_name", "openxr_path", "openxr_extension_name"), &OpenXRInteractionProfileMetaData::register_interaction_profile); - ClassDB::bind_method(D_METHOD("register_io_path", "interaction_profile", "display_name", "toplevel_path", "openxr_path", "openxr_extension_name", "action_type"), &OpenXRInteractionProfileMetaData::register_io_path); +void OpenXRInteractionProfileMetadata::_bind_methods() { + ClassDB::bind_method(D_METHOD("register_top_level_path", "display_name", "openxr_path", "openxr_extension_name"), &OpenXRInteractionProfileMetadata::register_top_level_path); + ClassDB::bind_method(D_METHOD("register_interaction_profile", "display_name", "openxr_path", "openxr_extension_name"), &OpenXRInteractionProfileMetadata::register_interaction_profile); + ClassDB::bind_method(D_METHOD("register_io_path", "interaction_profile", "display_name", "toplevel_path", "openxr_path", "openxr_extension_name", "action_type"), &OpenXRInteractionProfileMetadata::register_io_path); } -void OpenXRInteractionProfileMetaData::register_top_level_path(const String &p_display_name, const String &p_openxr_path, const String &p_openxr_extension_name) { +void OpenXRInteractionProfileMetadata::register_top_level_path(const String &p_display_name, const String &p_openxr_path, const String &p_openxr_extension_name) { ERR_FAIL_COND_MSG(has_top_level_path(p_openxr_path), p_openxr_path + " had already been registered"); TopLevelPath new_toplevel_path = { @@ -63,7 +63,7 @@ void OpenXRInteractionProfileMetaData::register_top_level_path(const String &p_d top_level_paths.push_back(new_toplevel_path); } -void OpenXRInteractionProfileMetaData::register_interaction_profile(const String &p_display_name, const String &p_openxr_path, const String &p_openxr_extension_name) { +void OpenXRInteractionProfileMetadata::register_interaction_profile(const String &p_display_name, const String &p_openxr_path, const String &p_openxr_extension_name) { ERR_FAIL_COND_MSG(has_interaction_profile(p_openxr_path), p_openxr_path + " has already been registered"); InteractionProfile new_profile; @@ -74,7 +74,7 @@ void OpenXRInteractionProfileMetaData::register_interaction_profile(const String interaction_profiles.push_back(new_profile); } -void OpenXRInteractionProfileMetaData::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) { +void OpenXRInteractionProfileMetadata::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) { ERR_FAIL_COND_MSG(!has_interaction_profile(p_interaction_profile), "Unknown interaction profile " + p_interaction_profile); ERR_FAIL_COND_MSG(!has_top_level_path(p_toplevel_path), "Unknown top level path " + p_toplevel_path); @@ -95,7 +95,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; @@ -105,7 +105,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; @@ -115,7 +115,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; @@ -125,7 +125,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; @@ -135,7 +135,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; @@ -145,7 +145,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]; @@ -155,7 +155,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; @@ -165,7 +165,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]; @@ -175,8 +175,8 @@ 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::InteractionProfile *profile = get_profile(p_interaction_profile); +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); } @@ -184,7 +184,7 @@ const OpenXRInteractionProfileMetaData::IOPath *OpenXRInteractionProfileMetaData return nullptr; } -PackedStringArray OpenXRInteractionProfileMetaData::get_interaction_profile_paths() const { +PackedStringArray OpenXRInteractionProfileMetadata::get_interaction_profile_paths() const { PackedStringArray arr; for (int i = 0; i < interaction_profiles.size(); i++) { @@ -194,7 +194,7 @@ PackedStringArray OpenXRInteractionProfileMetaData::get_interaction_profile_path return arr; } -void OpenXRInteractionProfileMetaData::_register_core_metadata() { +void OpenXRInteractionProfileMetadata::_register_core_metadata() { // Note, currently we add definitions that belong in extensions. // Extensions are registered when our OpenXRAPI is instantiated // however this does not happen in the editor. diff --git a/modules/openxr/action_map/openxr_interaction_profile_meta_data.h b/modules/openxr/action_map/openxr_interaction_profile_metadata.h similarity index 91% rename from modules/openxr/action_map/openxr_interaction_profile_meta_data.h rename to modules/openxr/action_map/openxr_interaction_profile_metadata.h index 3eab2139ffd..91f97c73a65 100644 --- a/modules/openxr/action_map/openxr_interaction_profile_meta_data.h +++ b/modules/openxr/action_map/openxr_interaction_profile_metadata.h @@ -1,5 +1,5 @@ /**************************************************************************/ -/* openxr_interaction_profile_meta_data.h */ +/* openxr_interaction_profile_metadata.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef OPENXR_INTERACTION_PROFILE_META_DATA_H -#define OPENXR_INTERACTION_PROFILE_META_DATA_H +#ifndef OPENXR_INTERACTION_PROFILE_METADATA_H +#define OPENXR_INTERACTION_PROFILE_METADATA_H /////////////////////////////////////////////////////////////////////////// -// Stores available interaction profile meta data +// Stores available interaction profile metadata // // OpenXR defines and hardcodes all the supported input devices and their // paths as part of the OpenXR spec. When support for new devices is @@ -57,7 +57,9 @@ #define XR_PATH_UNSUPPORTED_NAME "unsupported" -class OpenXRInteractionProfileMetaData : public Object { +class OpenXRInteractionProfileMetadata : public Object { + GDCLASS(OpenXRInteractionProfileMetadata, Object); + public: struct TopLevelPath { String display_name; // User friendly display name (i.e. Left controller) @@ -84,7 +86,7 @@ public: }; private: - static OpenXRInteractionProfileMetaData *singleton; + static OpenXRInteractionProfileMetadata *singleton; Vector top_level_paths; Vector interaction_profiles; @@ -95,10 +97,10 @@ protected: static void _bind_methods(); public: - static OpenXRInteractionProfileMetaData *get_singleton() { return singleton; } + static OpenXRInteractionProfileMetadata *get_singleton() { return singleton; } - OpenXRInteractionProfileMetaData(); - ~OpenXRInteractionProfileMetaData(); + OpenXRInteractionProfileMetadata(); + ~OpenXRInteractionProfileMetadata(); 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; @@ -115,4 +117,4 @@ public: const IOPath *get_io_path(const String p_interaction_profile, const String p_io_path) const; }; -#endif // OPENXR_INTERACTION_PROFILE_META_DATA_H +#endif // OPENXR_INTERACTION_PROFILE_METADATA_H diff --git a/modules/openxr/config.py b/modules/openxr/config.py index 8ed06a1606d..92aaf06fcea 100644 --- a/modules/openxr/config.py +++ b/modules/openxr/config.py @@ -16,7 +16,10 @@ def get_doc_classes(): "OpenXRAction", "OpenXRActionSet", "OpenXRActionMap", + "OpenXRAPIExtension", + "OpenXRExtensionWrapperExtension", "OpenXRInteractionProfile", + "OpenXRInteractionProfileMetadata", "OpenXRIPBinding", "OpenXRHand", ] diff --git a/doc/classes/OpenXRAPIExtension.xml b/modules/openxr/doc_classes/OpenXRAPIExtension.xml similarity index 99% rename from doc/classes/OpenXRAPIExtension.xml rename to modules/openxr/doc_classes/OpenXRAPIExtension.xml index 181da916d14..e795311651b 100644 --- a/doc/classes/OpenXRAPIExtension.xml +++ b/modules/openxr/doc_classes/OpenXRAPIExtension.xml @@ -1,5 +1,5 @@ - + Makes the OpenXR API available for GDExtension. diff --git a/doc/classes/OpenXRExtensionWrapperExtension.xml b/modules/openxr/doc_classes/OpenXRExtensionWrapperExtension.xml similarity index 99% rename from doc/classes/OpenXRExtensionWrapperExtension.xml rename to modules/openxr/doc_classes/OpenXRExtensionWrapperExtension.xml index 004d10e5886..e09b58e5b49 100644 --- a/doc/classes/OpenXRExtensionWrapperExtension.xml +++ b/modules/openxr/doc_classes/OpenXRExtensionWrapperExtension.xml @@ -1,5 +1,5 @@ - + Allows clients to implement OpenXR extensions with GDExtension. diff --git a/modules/openxr/doc_classes/OpenXRInteractionProfile.xml b/modules/openxr/doc_classes/OpenXRInteractionProfile.xml index a69bb875fa7..ed5113f83c9 100644 --- a/modules/openxr/doc_classes/OpenXRInteractionProfile.xml +++ b/modules/openxr/doc_classes/OpenXRInteractionProfile.xml @@ -4,7 +4,7 @@ Suggested bindings object for OpenXR. - This object stores suggested bindings for an interaction profile. Interaction profiles define the meta data for a tracked XR device such as an XR controller. + This object stores suggested bindings for an interaction profile. Interaction profiles define the metadata for a tracked XR device such as an XR controller. For more information see the [url=https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#semantic-path-interaction-profiles]interaction profiles info in the OpenXR specification[/url]. diff --git a/modules/openxr/doc_classes/OpenXRInteractionProfileMetadata.xml b/modules/openxr/doc_classes/OpenXRInteractionProfileMetadata.xml new file mode 100644 index 00000000000..111f41293c8 --- /dev/null +++ b/modules/openxr/doc_classes/OpenXRInteractionProfileMetadata.xml @@ -0,0 +1,46 @@ + + + + Meta class registering supported devices in OpenXR. + + + This class allows OpenXR core and extensions to register metadata relating to supported interaction devices such as controllers, trackers, haptic devices, etc. It is primarily used by the action map editor and to sanitize any action map by removing extension-dependent entries when applicable. + + + + + + + + + + + Registers an interaction profile using its OpenXR designation (e.g. [code]/interaction_profiles/khr/simple_controller[/code] is the profile for OpenXR's simple controller profile). + [param display_name] is the description shown to the user. [param openxr_path] is the interaction profile path being registered. [param openxr_extension_name] optionally restricts this profile to the given extension being enabled/available. If the extension is not available, the profile and all related entries used in an action map are filtered out. + + + + + + + + + + + + Registers an input/output path for the given [param interaction_profile]. The profile should previously have been registered using [method register_interaction_profile]. [param display_name] is the description shown to the user. [param toplevel_path] specifies the bind path this input/output can be bound to (e.g. [code]/user/hand/left[/code] or [code]/user/hand/right[/code]). [param openxr_path] is the action input/output being registered (e.g. [code]/user/hand/left/input/aim/pose[/code]). [param openxr_extension_name] restricts this input/output to an enabled/available extension, this doesn't need to repeat the extension on the profile but relates to overlapping extension (e.g. [code]XR_EXT_palm_pose[/code] that introduces [code]…/input/palm_ext/pose[/code] input paths). [param action_type] defines the type of input or output provided by OpenXR. + + + + + + + + + Registers a top level path to which profiles can be bound. For instance [code]/user/hand/left[/code] refers to the bind point for the player's left hand. Extensions can register additional top level paths, for instance a haptic vest extension might register [code]/user/body/vest[/code]. + [param display_name] is the name shown to the user. [param openxr_path] is the top level path being registered. [param openxr_extension_name] is optional and ensures the top level path is only used if the specified extension is available/enabled. + When a top level path ends up being bound by OpenXR, a [XRPositionalTracker] is instantiated to manage the state of the device. + + + + diff --git a/modules/openxr/editor/openxr_interaction_profile_editor.cpp b/modules/openxr/editor/openxr_interaction_profile_editor.cpp index 1f63399ee7e..9998bb80e3e 100644 --- a/modules/openxr/editor/openxr_interaction_profile_editor.cpp +++ b/modules/openxr/editor/openxr_interaction_profile_editor.cpp @@ -148,7 +148,7 @@ OpenXRInteractionProfileEditorBase::OpenXRInteractionProfileEditorBase(Refget_interaction_profile_path(); String profile_name = profile_path; - profile_def = OpenXRInteractionProfileMetaData::get_singleton()->get_profile(profile_path); + profile_def = OpenXRInteractionProfileMetadata::get_singleton()->get_profile(profile_path); if (profile_def != nullptr) { profile_name = profile_def->display_name; } @@ -185,7 +185,7 @@ void OpenXRInteractionProfileEditor::_on_remove_pressed(const String p_action, c undo_redo->commit_action(true); } -void OpenXRInteractionProfileEditor::_add_io_path(VBoxContainer *p_container, const OpenXRInteractionProfileMetaData::IOPath *p_io_path) { +void OpenXRInteractionProfileEditor::_add_io_path(VBoxContainer *p_container, const OpenXRInteractionProfileMetadata::IOPath *p_io_path) { HBoxContainer *path_hb = memnew(HBoxContainer); path_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); p_container->add_child(path_hb); @@ -274,7 +274,7 @@ void OpenXRInteractionProfileEditor::_update_interaction_profile() { // Determine toplevel paths Vector top_level_paths; for (int i = 0; i < profile_def->io_paths.size(); i++) { - const OpenXRInteractionProfileMetaData::IOPath *io_path = &profile_def->io_paths[i]; + const OpenXRInteractionProfileMetadata::IOPath *io_path = &profile_def->io_paths[i]; if (!top_level_paths.has(io_path->top_level_path)) { top_level_paths.push_back(io_path->top_level_path); @@ -291,11 +291,11 @@ void OpenXRInteractionProfileEditor::_update_interaction_profile() { panel->add_child(container); Label *label = memnew(Label); - label->set_text(OpenXRInteractionProfileMetaData::get_singleton()->get_top_level_name(top_level_paths[i])); + label->set_text(OpenXRInteractionProfileMetadata::get_singleton()->get_top_level_name(top_level_paths[i])); container->add_child(label); for (int j = 0; j < profile_def->io_paths.size(); j++) { - const OpenXRInteractionProfileMetaData::IOPath *io_path = &profile_def->io_paths[j]; + const OpenXRInteractionProfileMetadata::IOPath *io_path = &profile_def->io_paths[j]; if (io_path->top_level_path == top_level_paths[i]) { _add_io_path(container, io_path); } diff --git a/modules/openxr/editor/openxr_interaction_profile_editor.h b/modules/openxr/editor/openxr_interaction_profile_editor.h index b9b3fbd81d2..2ec72127cfc 100644 --- a/modules/openxr/editor/openxr_interaction_profile_editor.h +++ b/modules/openxr/editor/openxr_interaction_profile_editor.h @@ -33,7 +33,7 @@ #include "../action_map/openxr_action_map.h" #include "../action_map/openxr_interaction_profile.h" -#include "../action_map/openxr_interaction_profile_meta_data.h" +#include "../action_map/openxr_interaction_profile_metadata.h" #include "openxr_select_action_dialog.h" #include "editor/editor_undo_redo_manager.h" @@ -52,7 +52,7 @@ protected: static void _bind_methods(); void _notification(int p_what); - const OpenXRInteractionProfileMetaData::InteractionProfile *profile_def = nullptr; + const OpenXRInteractionProfileMetadata::InteractionProfile *profile_def = nullptr; public: Ref get_interaction_profile() { return interaction_profile; } @@ -77,7 +77,7 @@ private: HBoxContainer *main_hb = nullptr; OpenXRSelectActionDialog *select_action_dialog = nullptr; - void _add_io_path(VBoxContainer *p_container, const OpenXRInteractionProfileMetaData::IOPath *p_io_path); + void _add_io_path(VBoxContainer *p_container, const OpenXRInteractionProfileMetadata::IOPath *p_io_path); public: void select_action_for(const String p_io_path); diff --git a/modules/openxr/editor/openxr_select_interaction_profile_dialog.cpp b/modules/openxr/editor/openxr_select_interaction_profile_dialog.cpp index 9362c081746..08fcdaf771f 100644 --- a/modules/openxr/editor/openxr_select_interaction_profile_dialog.cpp +++ b/modules/openxr/editor/openxr_select_interaction_profile_dialog.cpp @@ -75,13 +75,13 @@ void OpenXRSelectInteractionProfileDialog::open(PackedStringArray p_do_not_inclu ip_buttons.clear(); // in with the new - PackedStringArray interaction_profiles = OpenXRInteractionProfileMetaData::get_singleton()->get_interaction_profile_paths(); + PackedStringArray interaction_profiles = OpenXRInteractionProfileMetadata::get_singleton()->get_interaction_profile_paths(); for (int i = 0; i < interaction_profiles.size(); i++) { String path = interaction_profiles[i]; if (!p_do_not_include.has(path)) { Button *ip_button = memnew(Button); ip_button->set_flat(true); - ip_button->set_text(OpenXRInteractionProfileMetaData::get_singleton()->get_profile(path)->display_name); + ip_button->set_text(OpenXRInteractionProfileMetadata::get_singleton()->get_profile(path)->display_name); ip_button->connect("pressed", callable_mp(this, &OpenXRSelectInteractionProfileDialog::_on_select_interaction_profile).bind(path)); main_vb->add_child(ip_button); diff --git a/modules/openxr/editor/openxr_select_interaction_profile_dialog.h b/modules/openxr/editor/openxr_select_interaction_profile_dialog.h index aae0368f674..1d1615321c9 100644 --- a/modules/openxr/editor/openxr_select_interaction_profile_dialog.h +++ b/modules/openxr/editor/openxr_select_interaction_profile_dialog.h @@ -31,7 +31,7 @@ #ifndef OPENXR_SELECT_INTERACTION_PROFILE_DIALOG_H #define OPENXR_SELECT_INTERACTION_PROFILE_DIALOG_H -#include "../action_map/openxr_interaction_profile_meta_data.h" +#include "../action_map/openxr_interaction_profile_metadata.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" diff --git a/modules/openxr/extensions/openxr_htc_controller_extension.cpp b/modules/openxr/extensions/openxr_htc_controller_extension.cpp index 51364d83d81..c4ecb4e57c6 100644 --- a/modules/openxr/extensions/openxr_htc_controller_extension.cpp +++ b/modules/openxr/extensions/openxr_htc_controller_extension.cpp @@ -30,7 +30,7 @@ #include "openxr_htc_controller_extension.h" -#include "../action_map/openxr_interaction_profile_meta_data.h" +#include "../action_map/openxr_interaction_profile_metadata.h" HashMap OpenXRHTCControllerExtension::get_requested_extensions() { HashMap request_extensions; @@ -46,7 +46,7 @@ bool OpenXRHTCControllerExtension::is_available(HTCControllers p_type) { } void OpenXRHTCControllerExtension::on_register_metadata() { - OpenXRInteractionProfileMetaData *metadata = OpenXRInteractionProfileMetaData::get_singleton(); + OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton(); ERR_FAIL_NULL(metadata); // HTC Vive Cosmos controller diff --git a/modules/openxr/extensions/openxr_htc_vive_tracker_extension.cpp b/modules/openxr/extensions/openxr_htc_vive_tracker_extension.cpp index 087631a8b90..8b8c6c53538 100644 --- a/modules/openxr/extensions/openxr_htc_vive_tracker_extension.cpp +++ b/modules/openxr/extensions/openxr_htc_vive_tracker_extension.cpp @@ -30,7 +30,7 @@ #include "openxr_htc_vive_tracker_extension.h" -#include "../action_map/openxr_interaction_profile_meta_data.h" +#include "../action_map/openxr_interaction_profile_metadata.h" #include "core/string/print_string.h" @@ -47,7 +47,7 @@ bool OpenXRHTCViveTrackerExtension::is_available() { } void OpenXRHTCViveTrackerExtension::on_register_metadata() { - OpenXRInteractionProfileMetaData *metadata = OpenXRInteractionProfileMetaData::get_singleton(); + OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton(); ERR_FAIL_NULL(metadata); // HTC Vive tracker diff --git a/modules/openxr/extensions/openxr_huawei_controller_extension.cpp b/modules/openxr/extensions/openxr_huawei_controller_extension.cpp index 8b8662cfcb9..baa6d6ded85 100644 --- a/modules/openxr/extensions/openxr_huawei_controller_extension.cpp +++ b/modules/openxr/extensions/openxr_huawei_controller_extension.cpp @@ -30,7 +30,7 @@ #include "openxr_huawei_controller_extension.h" -#include "../action_map/openxr_interaction_profile_meta_data.h" +#include "../action_map/openxr_interaction_profile_metadata.h" HashMap OpenXRHuaweiControllerExtension::get_requested_extensions() { HashMap request_extensions; @@ -45,7 +45,7 @@ bool OpenXRHuaweiControllerExtension::is_available() { } void OpenXRHuaweiControllerExtension::on_register_metadata() { - OpenXRInteractionProfileMetaData *metadata = OpenXRInteractionProfileMetaData::get_singleton(); + OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton(); ERR_FAIL_NULL(metadata); // Huawei controller diff --git a/modules/openxr/extensions/openxr_ml2_controller_extension.cpp b/modules/openxr/extensions/openxr_ml2_controller_extension.cpp index 7dad8deb8ca..979ac22d087 100644 --- a/modules/openxr/extensions/openxr_ml2_controller_extension.cpp +++ b/modules/openxr/extensions/openxr_ml2_controller_extension.cpp @@ -30,7 +30,7 @@ #include "openxr_ml2_controller_extension.h" -#include "../action_map/openxr_interaction_profile_meta_data.h" +#include "../action_map/openxr_interaction_profile_metadata.h" HashMap OpenXRML2ControllerExtension::get_requested_extensions() { HashMap request_extensions; @@ -45,7 +45,7 @@ bool OpenXRML2ControllerExtension::is_available() { } void OpenXRML2ControllerExtension::on_register_metadata() { - OpenXRInteractionProfileMetaData *metadata = OpenXRInteractionProfileMetaData::get_singleton(); + OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton(); ERR_FAIL_NULL(metadata); // Magic Leap 2 Controller diff --git a/modules/openxr/extensions/openxr_pico_controller_extension.cpp b/modules/openxr/extensions/openxr_pico_controller_extension.cpp index 8be961a68e4..6c492d2e5ab 100644 --- a/modules/openxr/extensions/openxr_pico_controller_extension.cpp +++ b/modules/openxr/extensions/openxr_pico_controller_extension.cpp @@ -30,7 +30,7 @@ #include "openxr_pico_controller_extension.h" -#include "../action_map/openxr_interaction_profile_meta_data.h" +#include "../action_map/openxr_interaction_profile_metadata.h" // Pico controllers are not part of the OpenXR spec at the time of writing this // code. We'll hardcode the extension name that is used internally, verified by @@ -53,7 +53,7 @@ bool OpenXRPicoControllerExtension::is_available() { } void OpenXRPicoControllerExtension::on_register_metadata() { - OpenXRInteractionProfileMetaData *metadata = OpenXRInteractionProfileMetaData::get_singleton(); + OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton(); ERR_FAIL_NULL(metadata); // Pico controller (Pico 4 and Pico Neo 3 controllers) diff --git a/modules/openxr/extensions/openxr_wmr_controller_extension.cpp b/modules/openxr/extensions/openxr_wmr_controller_extension.cpp index a9b27013f13..7d43d2e3049 100644 --- a/modules/openxr/extensions/openxr_wmr_controller_extension.cpp +++ b/modules/openxr/extensions/openxr_wmr_controller_extension.cpp @@ -30,7 +30,7 @@ #include "openxr_wmr_controller_extension.h" -#include "../action_map/openxr_interaction_profile_meta_data.h" +#include "../action_map/openxr_interaction_profile_metadata.h" HashMap OpenXRWMRControllerExtension::get_requested_extensions() { HashMap request_extensions; @@ -47,7 +47,7 @@ bool OpenXRWMRControllerExtension::is_available(WMRControllers p_type) { } void OpenXRWMRControllerExtension::on_register_metadata() { - OpenXRInteractionProfileMetaData *metadata = OpenXRInteractionProfileMetaData::get_singleton(); + OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton(); ERR_FAIL_NULL(metadata); // HP MR controller (newer G2 controllers) diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp index 2bd5376b219..17f1c3940cf 100644 --- a/modules/openxr/openxr_api.cpp +++ b/modules/openxr/openxr_api.cpp @@ -216,7 +216,7 @@ bool OpenXRAPI::is_extension_enabled(const String &p_extension) const { } bool OpenXRAPI::is_top_level_path_supported(const String &p_toplevel_path) { - String required_extension = OpenXRInteractionProfileMetaData::get_singleton()->get_top_level_extension(p_toplevel_path); + String required_extension = OpenXRInteractionProfileMetadata::get_singleton()->get_top_level_extension(p_toplevel_path); // If unsupported is returned we likely have a misspelled interaction profile path in our action map. Always output that as an error. ERR_FAIL_COND_V_MSG(required_extension == XR_PATH_UNSUPPORTED_NAME, false, "OpenXR: Unsupported toplevel path " + p_toplevel_path); @@ -236,7 +236,7 @@ bool OpenXRAPI::is_top_level_path_supported(const String &p_toplevel_path) { } bool OpenXRAPI::is_interaction_profile_supported(const String &p_ip_path) { - String required_extension = OpenXRInteractionProfileMetaData::get_singleton()->get_interaction_profile_extension(p_ip_path); + String required_extension = OpenXRInteractionProfileMetadata::get_singleton()->get_interaction_profile_extension(p_ip_path); // If unsupported is returned we likely have a misspelled interaction profile path in our action map. Always output that as an error. ERR_FAIL_COND_V_MSG(required_extension == XR_PATH_UNSUPPORTED_NAME, false, "OpenXR: Unsupported interaction profile " + p_ip_path); @@ -260,9 +260,9 @@ bool OpenXRAPI::interaction_profile_supports_io_path(const String &p_ip_path, co return false; } - const OpenXRInteractionProfileMetaData::IOPath *io_path = OpenXRInteractionProfileMetaData::get_singleton()->get_io_path(p_ip_path, p_io_path); + const OpenXRInteractionProfileMetadata::IOPath *io_path = OpenXRInteractionProfileMetadata::get_singleton()->get_io_path(p_ip_path, p_io_path); - // If the io_path is not part of our meta data we've likely got a misspelled name or a bad action map, report + // If the io_path is not part of our metadata we've likely got a misspelled name or a bad action map, report ERR_FAIL_NULL_V_MSG(io_path, false, "OpenXR: Unsupported io path " + String(p_ip_path) + String(p_io_path)); if (io_path->openxr_extension_name == "") { diff --git a/modules/openxr/register_types.cpp b/modules/openxr/register_types.cpp index 5d636c2b70c..d69c803502a 100644 --- a/modules/openxr/register_types.cpp +++ b/modules/openxr/register_types.cpp @@ -34,7 +34,7 @@ #include "action_map/openxr_action_map.h" #include "action_map/openxr_action_set.h" #include "action_map/openxr_interaction_profile.h" -#include "action_map/openxr_interaction_profile_meta_data.h" +#include "action_map/openxr_interaction_profile_metadata.h" #include "openxr_interface.h" #include "extensions/openxr_extension_wrapper_extension.h" @@ -69,7 +69,7 @@ #endif static OpenXRAPI *openxr_api = nullptr; -static OpenXRInteractionProfileMetaData *openxr_interaction_profile_meta_data = nullptr; +static OpenXRInteractionProfileMetadata *openxr_interaction_profile_metadata = nullptr; static Ref openxr_interface; #ifdef TOOLS_ENABLED @@ -77,10 +77,10 @@ static void _editor_init() { if (OpenXRAPI::openxr_is_enabled(false)) { // Only add our OpenXR action map editor if OpenXR is enabled for our project - if (openxr_interaction_profile_meta_data == nullptr) { - // If we didn't initialize our actionmap meta data at startup, we initialize it now. - openxr_interaction_profile_meta_data = memnew(OpenXRInteractionProfileMetaData); - ERR_FAIL_NULL(openxr_interaction_profile_meta_data); + if (openxr_interaction_profile_metadata == nullptr) { + // If we didn't initialize our actionmap metadata at startup, we initialize it now. + openxr_interaction_profile_metadata = memnew(OpenXRInteractionProfileMetadata); + ERR_FAIL_NULL(openxr_interaction_profile_metadata); } OpenXREditorPlugin *openxr_plugin = memnew(OpenXREditorPlugin()); @@ -118,8 +118,8 @@ void initialize_openxr_module(ModuleInitializationLevel p_level) { } if (OpenXRAPI::openxr_is_enabled()) { - openxr_interaction_profile_meta_data = memnew(OpenXRInteractionProfileMetaData); - ERR_FAIL_NULL(openxr_interaction_profile_meta_data); + openxr_interaction_profile_metadata = memnew(OpenXRInteractionProfileMetadata); + ERR_FAIL_NULL(openxr_interaction_profile_metadata); openxr_api = memnew(OpenXRAPI); ERR_FAIL_NULL(openxr_api); @@ -150,7 +150,7 @@ void initialize_openxr_module(ModuleInitializationLevel p_level) { GDREGISTER_CLASS(OpenXRAction); GDREGISTER_CLASS(OpenXRActionSet); GDREGISTER_CLASS(OpenXRActionMap); - GDREGISTER_CLASS(OpenXRInteractionProfileMetaData); + GDREGISTER_CLASS(OpenXRInteractionProfileMetadata); GDREGISTER_CLASS(OpenXRIPBinding); GDREGISTER_CLASS(OpenXRInteractionProfile); @@ -203,9 +203,9 @@ void uninitialize_openxr_module(ModuleInitializationLevel p_level) { openxr_api = nullptr; } - if (openxr_interaction_profile_meta_data) { - memdelete(openxr_interaction_profile_meta_data); - openxr_interaction_profile_meta_data = nullptr; + if (openxr_interaction_profile_metadata) { + memdelete(openxr_interaction_profile_metadata); + openxr_interaction_profile_metadata = nullptr; } // cleanup our extension wrappers diff --git a/servers/xr/xr_interface.h b/servers/xr/xr_interface.h index 44275285c83..b42cb372344 100644 --- a/servers/xr/xr_interface.h +++ b/servers/xr/xr_interface.h @@ -52,7 +52,7 @@ class XRInterface : public RefCounted { GDCLASS(XRInterface, RefCounted); public: - enum Capabilities { /* purely meta data, provides some info about what this interface supports */ + enum Capabilities { /* purely metadata, provides some info about what this interface supports */ XR_NONE = 0, /* no capabilities */ XR_MONO = 1, /* can be used with mono output */ XR_STEREO = 2, /* can be used with stereo output */ diff --git a/tests/scene/test_arraymesh.h b/tests/scene/test_arraymesh.h index b2a2ecc3bf7..0e97e7d75f4 100644 --- a/tests/scene/test_arraymesh.h +++ b/tests/scene/test_arraymesh.h @@ -154,7 +154,7 @@ TEST_CASE("[SceneTree][ArrayMesh] Adding and modifying blendshapes.") { } } -TEST_CASE("[SceneTree][ArrayMesh] Surface meta data tests.") { +TEST_CASE("[SceneTree][ArrayMesh] Surface metadata tests.") { Ref mesh = memnew(ArrayMesh); Ref cylinder = memnew(CylinderMesh); Array cylinder_array{};