From 6fd897973f9f82e2ccc00876edb48acd3954cd42 Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Sat, 24 Feb 2024 17:32:58 +1100 Subject: [PATCH] OpenXR: Register eye gaze even when disabled --- modules/openxr/extensions/openxr_eye_gaze_interaction.cpp | 7 ++++++- modules/openxr/register_types.cpp | 4 +--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/openxr/extensions/openxr_eye_gaze_interaction.cpp b/modules/openxr/extensions/openxr_eye_gaze_interaction.cpp index e57491e7c671..477a1c260957 100644 --- a/modules/openxr/extensions/openxr_eye_gaze_interaction.cpp +++ b/modules/openxr/extensions/openxr_eye_gaze_interaction.cpp @@ -30,6 +30,7 @@ #include "openxr_eye_gaze_interaction.h" +#include "core/config/project_settings.h" #include "core/os/os.h" #include "../action_map/openxr_interaction_profile_metadata.h" @@ -52,7 +53,11 @@ OpenXREyeGazeInteractionExtension::~OpenXREyeGazeInteractionExtension() { HashMap OpenXREyeGazeInteractionExtension::get_requested_extensions() { HashMap request_extensions; - request_extensions[XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME] = &available; + // Only enable this extension when requested. + // We still register our meta data or the action map editor will fail. + if (GLOBAL_GET("xr/openxr/extensions/eye_gaze_interaction") && (!OS::get_singleton()->has_feature("mobile") || OS::get_singleton()->has_feature(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME))) { + request_extensions[XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME] = &available; + } return request_extensions; } diff --git a/modules/openxr/register_types.cpp b/modules/openxr/register_types.cpp index a0a93c8694b7..3d34b27407c3 100644 --- a/modules/openxr/register_types.cpp +++ b/modules/openxr/register_types.cpp @@ -117,11 +117,9 @@ void initialize_openxr_module(ModuleInitializationLevel p_level) { OpenXRAPI::register_extension_wrapper(memnew(OpenXRWMRControllerExtension)); OpenXRAPI::register_extension_wrapper(memnew(OpenXRML2ControllerExtension)); OpenXRAPI::register_extension_wrapper(memnew(OpenXRMetaControllerExtension)); + OpenXRAPI::register_extension_wrapper(memnew(OpenXREyeGazeInteractionExtension)); // register gated extensions - if (GLOBAL_GET("xr/openxr/extensions/eye_gaze_interaction") && (!OS::get_singleton()->has_feature("mobile") || OS::get_singleton()->has_feature(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME))) { - OpenXRAPI::register_extension_wrapper(memnew(OpenXREyeGazeInteractionExtension)); - } if (GLOBAL_GET("xr/openxr/extensions/hand_tracking")) { OpenXRAPI::register_extension_wrapper(memnew(OpenXRHandTrackingExtension)); }