OpenXR: Register eye gaze even when disabled

This commit is contained in:
Bastiaan Olij 2024-02-24 17:32:58 +11:00
parent 2e7fc81315
commit 6fd897973f
2 changed files with 7 additions and 4 deletions

View File

@ -30,6 +30,7 @@
#include "openxr_eye_gaze_interaction.h" #include "openxr_eye_gaze_interaction.h"
#include "core/config/project_settings.h"
#include "core/os/os.h" #include "core/os/os.h"
#include "../action_map/openxr_interaction_profile_metadata.h" #include "../action_map/openxr_interaction_profile_metadata.h"
@ -52,7 +53,11 @@ OpenXREyeGazeInteractionExtension::~OpenXREyeGazeInteractionExtension() {
HashMap<String, bool *> OpenXREyeGazeInteractionExtension::get_requested_extensions() { HashMap<String, bool *> OpenXREyeGazeInteractionExtension::get_requested_extensions() {
HashMap<String, bool *> request_extensions; HashMap<String, bool *> 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; return request_extensions;
} }

View File

@ -117,11 +117,9 @@ void initialize_openxr_module(ModuleInitializationLevel p_level) {
OpenXRAPI::register_extension_wrapper(memnew(OpenXRWMRControllerExtension)); OpenXRAPI::register_extension_wrapper(memnew(OpenXRWMRControllerExtension));
OpenXRAPI::register_extension_wrapper(memnew(OpenXRML2ControllerExtension)); OpenXRAPI::register_extension_wrapper(memnew(OpenXRML2ControllerExtension));
OpenXRAPI::register_extension_wrapper(memnew(OpenXRMetaControllerExtension)); OpenXRAPI::register_extension_wrapper(memnew(OpenXRMetaControllerExtension));
OpenXRAPI::register_extension_wrapper(memnew(OpenXREyeGazeInteractionExtension));
// register gated extensions // 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")) { if (GLOBAL_GET("xr/openxr/extensions/hand_tracking")) {
OpenXRAPI::register_extension_wrapper(memnew(OpenXRHandTrackingExtension)); OpenXRAPI::register_extension_wrapper(memnew(OpenXRHandTrackingExtension));
} }