Ensure OpenXR classes are declared properly
Co-authored-by: Bastiaan Olij <mux213@gmail.com>
(cherry picked from commit c23bd8b143
)
This commit is contained in:
parent
18f69e9ee1
commit
d5c246bbd3
|
@ -547,7 +547,7 @@ PackedStringArray OpenXRActionMap::get_top_level_paths(const Ref<OpenXRAction> p
|
|||
|
||||
for (int i = 0; i < interaction_profiles.size(); i++) {
|
||||
Ref<OpenXRInteractionProfile> 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<OpenXRAction> 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;
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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.
|
|
@ -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<TopLevelPath> top_level_paths;
|
||||
Vector<InteractionProfile> 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
|
|
@ -16,7 +16,10 @@ def get_doc_classes():
|
|||
"OpenXRAction",
|
||||
"OpenXRActionSet",
|
||||
"OpenXRActionMap",
|
||||
"OpenXRAPIExtension",
|
||||
"OpenXRExtensionWrapperExtension",
|
||||
"OpenXRInteractionProfile",
|
||||
"OpenXRInteractionProfileMetadata",
|
||||
"OpenXRIPBinding",
|
||||
"OpenXRHand",
|
||||
]
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Suggested bindings object for OpenXR.
|
||||
</brief_description>
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
<tutorials>
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="OpenXRInteractionProfileMetadata" inherits="Object" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Meta class registering supported devices in OpenXR.
|
||||
</brief_description>
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="register_interaction_profile">
|
||||
<return type="void" />
|
||||
<param index="0" name="display_name" type="String" />
|
||||
<param index="1" name="openxr_path" type="String" />
|
||||
<param index="2" name="openxr_extension_name" type="String" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="register_io_path">
|
||||
<return type="void" />
|
||||
<param index="0" name="interaction_profile" type="String" />
|
||||
<param index="1" name="display_name" type="String" />
|
||||
<param index="2" name="toplevel_path" type="String" />
|
||||
<param index="3" name="openxr_path" type="String" />
|
||||
<param index="4" name="openxr_extension_name" type="String" />
|
||||
<param index="5" name="action_type" type="int" enum="OpenXRAction.ActionType" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="register_top_level_path">
|
||||
<return type="void" />
|
||||
<param index="0" name="display_name" type="String" />
|
||||
<param index="1" name="openxr_path" type="String" />
|
||||
<param index="2" name="openxr_extension_name" type="String" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
</class>
|
|
@ -148,7 +148,7 @@ OpenXRInteractionProfileEditorBase::OpenXRInteractionProfileEditorBase(Ref<OpenX
|
|||
String profile_path = interaction_profile->get_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<String> 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);
|
||||
}
|
||||
|
|
|
@ -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<OpenXRInteractionProfile> 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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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<String, bool *> OpenXRHTCControllerExtension::get_requested_extensions() {
|
||||
HashMap<String, bool *> 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<String, bool *> OpenXRHuaweiControllerExtension::get_requested_extensions() {
|
||||
HashMap<String, bool *> 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
|
||||
|
|
|
@ -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<String, bool *> OpenXRML2ControllerExtension::get_requested_extensions() {
|
||||
HashMap<String, bool *> 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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<String, bool *> OpenXRWMRControllerExtension::get_requested_extensions() {
|
||||
HashMap<String, bool *> 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)
|
||||
|
|
|
@ -215,7 +215,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);
|
||||
|
@ -235,7 +235,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);
|
||||
|
@ -259,9 +259,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 == "") {
|
||||
|
|
|
@ -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 "scene/openxr_hand.h"
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
|||
#endif
|
||||
|
||||
static OpenXRAPI *openxr_api = nullptr;
|
||||
static OpenXRInteractionProfileMetaData *openxr_interaction_profile_meta_data = nullptr;
|
||||
static OpenXRInteractionProfileMetadata *openxr_interaction_profile_metadata = nullptr;
|
||||
static Ref<OpenXRInterface> openxr_interface;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
@ -74,10 +74,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());
|
||||
|
@ -110,8 +110,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);
|
||||
|
||||
|
@ -142,7 +142,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);
|
||||
|
||||
|
@ -195,9 +195,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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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<ArrayMesh> mesh = memnew(ArrayMesh);
|
||||
Ref<CylinderMesh> cylinder = memnew(CylinderMesh);
|
||||
Array cylinder_array{};
|
||||
|
|
Loading…
Reference in New Issue