diff --git a/common/src/main/cpp/extensions/openxr_fb_hand_tracking_aim_extension_wrapper.cpp b/common/src/main/cpp/extensions/openxr_fb_hand_tracking_aim_extension_wrapper.cpp index d3600724..053864c9 100644 --- a/common/src/main/cpp/extensions/openxr_fb_hand_tracking_aim_extension_wrapper.cpp +++ b/common/src/main/cpp/extensions/openxr_fb_hand_tracking_aim_extension_wrapper.cpp @@ -90,8 +90,14 @@ PackedStringArray OpenXRFbHandTrackingAimExtensionWrapper::_get_suggested_tracke } void OpenXRFbHandTrackingAimExtensionWrapper::_on_state_ready() { - is_project_setting_enabled = ProjectSettings::get_singleton()->get_setting_with_override("xr/openxr/extensions/hand_tracking_aim"); + // It would be great to not even request the extension, but the ProjectSettings singleton isn't available early enough. + ProjectSettings *project_settings = ProjectSettings::get_singleton(); + bool is_project_setting_enabled = (bool)project_settings->get_setting_with_override("xr/openxr/extensions/hand_tracking") && (bool)project_settings->get_setting_with_override("xr/openxr/extensions/hand_tracking_aim"); if (!is_project_setting_enabled) { + fb_hand_tracking_aim_ext = false; + } + + if (!is_enabled()) { return; } @@ -139,7 +145,7 @@ uint64_t OpenXRFbHandTrackingAimExtensionWrapper::_set_hand_joint_locations_and_ } void OpenXRFbHandTrackingAimExtensionWrapper::_on_process() { - if (!is_enabled() || !is_project_setting_enabled) { + if (!is_enabled()) { return; } diff --git a/common/src/main/cpp/extensions/openxr_fb_hand_tracking_capsules_extension_wrapper.cpp b/common/src/main/cpp/extensions/openxr_fb_hand_tracking_capsules_extension_wrapper.cpp index 4a0a6bda..05dde77b 100644 --- a/common/src/main/cpp/extensions/openxr_fb_hand_tracking_capsules_extension_wrapper.cpp +++ b/common/src/main/cpp/extensions/openxr_fb_hand_tracking_capsules_extension_wrapper.cpp @@ -29,6 +29,8 @@ #include "extensions/openxr_fb_hand_tracking_capsules_extension_wrapper.h" +#include + using namespace godot; OpenXRFbHandTrackingCapsulesExtensionWrapper *OpenXRFbHandTrackingCapsulesExtensionWrapper::singleton = nullptr; @@ -79,6 +81,14 @@ void OpenXRFbHandTrackingCapsulesExtensionWrapper::_on_instance_destroyed() { cleanup(); } +void OpenXRFbHandTrackingCapsulesExtensionWrapper::_on_state_ready() { + // It would be great to not even request the extension, but the ProjectSettings singleton isn't available early enough. + bool is_project_setting_enabled = (bool)ProjectSettings::get_singleton()->get_setting_with_override("xr/openxr/extensions/hand_tracking"); + if (!is_project_setting_enabled) { + fb_hand_tracking_capsules_ext = false; + } +} + uint64_t OpenXRFbHandTrackingCapsulesExtensionWrapper::_set_hand_joint_locations_and_get_next_pointer(int32_t p_hand_index, void *p_next_pointer) { if (!fb_hand_tracking_capsules_ext) { return reinterpret_cast(p_next_pointer); diff --git a/common/src/main/cpp/extensions/openxr_fb_hand_tracking_mesh_extension_wrapper.cpp b/common/src/main/cpp/extensions/openxr_fb_hand_tracking_mesh_extension_wrapper.cpp index 35a86efa..da9779a4 100644 --- a/common/src/main/cpp/extensions/openxr_fb_hand_tracking_mesh_extension_wrapper.cpp +++ b/common/src/main/cpp/extensions/openxr_fb_hand_tracking_mesh_extension_wrapper.cpp @@ -30,6 +30,7 @@ #include "extensions/openxr_fb_hand_tracking_mesh_extension_wrapper.h" #include +#include #include #include @@ -101,6 +102,14 @@ void OpenXRFbHandTrackingMeshExtensionWrapper::_on_instance_destroyed() { cleanup(); } +void OpenXRFbHandTrackingMeshExtensionWrapper::_on_state_ready() { + // It would be great to not even request the extension, but the ProjectSettings singleton isn't available early enough. + bool is_project_setting_enabled = (bool)ProjectSettings::get_singleton()->get_setting_with_override("xr/openxr/extensions/hand_tracking"); + if (!is_project_setting_enabled) { + fb_hand_tracking_mesh_ext = false; + } +} + uint64_t OpenXRFbHandTrackingMeshExtensionWrapper::_set_hand_joint_locations_and_get_next_pointer(int32_t p_hand_index, void *p_next_pointer) { if (!fb_hand_tracking_mesh_ext) { return reinterpret_cast(p_next_pointer); diff --git a/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_aim_extension_wrapper.h b/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_aim_extension_wrapper.h index dec10c0f..52380e34 100644 --- a/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_aim_extension_wrapper.h +++ b/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_aim_extension_wrapper.h @@ -83,7 +83,6 @@ class OpenXRFbHandTrackingAimExtensionWrapper : public OpenXRExtensionWrapperExt const String TRACKER_NAME_RIGHT = "/user/fbhandaim/right"; bool fb_hand_tracking_aim_ext = false; - bool is_project_setting_enabled = false; Ref trackers[Hand::HAND_MAX]; diff --git a/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_capsules_extension_wrapper.h b/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_capsules_extension_wrapper.h index 371488e8..ad42c5d8 100644 --- a/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_capsules_extension_wrapper.h +++ b/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_capsules_extension_wrapper.h @@ -47,6 +47,7 @@ class OpenXRFbHandTrackingCapsulesExtensionWrapper : public OpenXRExtensionWrapp godot::Dictionary _get_requested_extensions() override; void _on_instance_destroyed() override; + void _on_state_ready() override; uint64_t _set_hand_joint_locations_and_get_next_pointer(int32_t p_hand_index, void *p_next_pointer) override; diff --git a/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_mesh_extension_wrapper.h b/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_mesh_extension_wrapper.h index c062893f..ef616417 100644 --- a/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_mesh_extension_wrapper.h +++ b/common/src/main/cpp/include/extensions/openxr_fb_hand_tracking_mesh_extension_wrapper.h @@ -59,9 +59,10 @@ class OpenXRFbHandTrackingMeshExtensionWrapper : public OpenXRExtensionWrapperEx godot::Dictionary _get_requested_extensions() override; void _on_instance_created(uint64_t instance) override; - void _on_instance_destroyed() override; + void _on_state_ready() override; + uint64_t _set_hand_joint_locations_and_get_next_pointer(int32_t p_hand_index, void *p_next_pointer) override; void _on_process() override; diff --git a/samples/meta-body-tracking-sample/project.godot b/samples/meta-body-tracking-sample/project.godot index 883d37f0..f0d52e3d 100644 --- a/samples/meta-body-tracking-sample/project.godot +++ b/samples/meta-body-tracking-sample/project.godot @@ -35,5 +35,6 @@ textures/vram_compression/import_etc2_astc=true openxr/enabled=true openxr/reference_space=2 +openxr/extensions/hand_tracking=true openxr/extensions/eye_gaze_interaction=true shaders/enabled=true diff --git a/samples/meta-hand-tracking-sample/project.godot b/samples/meta-hand-tracking-sample/project.godot index 36f8cd16..ed2444c4 100644 --- a/samples/meta-hand-tracking-sample/project.godot +++ b/samples/meta-hand-tracking-sample/project.godot @@ -29,5 +29,6 @@ textures/vram_compression/import_etc2_astc=true openxr/enabled=true openxr/reference_space=2 +openxr/extensions/hand_tracking=true shaders/enabled=true openxr/extensions/hand_tracking_aim=true