Skip to content

Commit

Permalink
Merge pull request #88754 from BastiaanOlij/fix_openxr_eye_gaze_init
Browse files Browse the repository at this point in the history
OpenXR: Register eye gaze even when disabled
  • Loading branch information
akien-mga committed Feb 26, 2024
2 parents 762ea7a + 6fd8979 commit f91e74a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 6 additions & 1 deletion modules/openxr/extensions/openxr_eye_gaze_interaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -52,7 +53,11 @@ OpenXREyeGazeInteractionExtension::~OpenXREyeGazeInteractionExtension() {
HashMap<String, bool *> OpenXREyeGazeInteractionExtension::get_requested_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;
}
Expand Down
4 changes: 1 addition & 3 deletions modules/openxr/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit f91e74a

Please sign in to comment.