1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-02 16:48:55 +00:00

Add OpenXR 1.1 support

This commit is contained in:
Bastiaan Olij
2025-07-28 10:13:23 +10:00
parent 9dd6c4dbac
commit c0bc43d1de
88 changed files with 638 additions and 251 deletions

View File

@@ -198,10 +198,10 @@ void OpenXRInteractionProfileEditorBase::setup(const Ref<OpenXRActionMap> &p_act
if (profile_def != nullptr) {
profile_name = profile_def->display_name;
if (!profile_def->openxr_extension_name.is_empty()) {
if (!profile_def->openxr_extension_names.is_empty()) {
profile_name += "*";
tooltip = vformat(TTR("Note: This interaction profile requires extension %s support."), profile_def->openxr_extension_name);
tooltip = vformat(TTR("Note: This interaction profile requires extension %s support."), profile_def->openxr_extension_names);
}
}
@@ -242,11 +242,13 @@ void OpenXRInteractionProfileEditor::_add_io_path(VBoxContainer *p_container, co
Label *path_label = memnew(Label);
path_label->set_focus_mode(FOCUS_ACCESSIBILITY);
if (p_io_path->openxr_extension_name.is_empty()) {
if (p_io_path->openxr_extension_names.is_empty()) {
path_label->set_text(p_io_path->display_name);
} else {
path_label->set_text(p_io_path->display_name + "*");
path_hb->set_tooltip_text(vformat(TTR("Note: This binding path requires extension %s support."), p_io_path->openxr_extension_name));
String extension_names = p_io_path->openxr_extension_names.replace(",", " or ").replace(XR_OPENXR_1_1_NAME, "OpenXR 1.1");
path_hb->set_tooltip_text(vformat(TTR("Note: This binding path requires extension %s support."), extension_names));
}
path_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
path_hb->add_child(path_label);
@@ -334,7 +336,7 @@ void OpenXRInteractionProfileEditor::_update_interaction_profile() {
return;
}
PackedStringArray requested_extensions = OpenXRAPI::get_all_requested_extensions();
PackedStringArray requested_extensions = OpenXRAPI::get_all_requested_extensions(0);
// out with the old...
while (interaction_profile_hb->get_child_count() > 0) {
@@ -369,7 +371,14 @@ void OpenXRInteractionProfileEditor::_update_interaction_profile() {
for (int j = 0; j < profile_def->io_paths.size(); j++) {
const OpenXRInteractionProfileMetadata::IOPath *io_path = &profile_def->io_paths[j];
if (io_path->top_level_path == top_level_paths[i] && (io_path->openxr_extension_name.is_empty() || requested_extensions.has(io_path->openxr_extension_name))) {
const Vector<String> extensions = io_path->openxr_extension_names.split(",", false);
bool extension_is_requested = extensions.is_empty(); // If none, then yes we can use this.
for (const String &extension : extensions) {
extension_is_requested |= requested_extensions.has(extension);
}
if (io_path->top_level_path == top_level_paths[i] && extension_is_requested) {
_add_io_path(container, io_path);
}
}