summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-09-05 17:44:37 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-05 17:44:37 +0200
commitaf0058c7e69cbdbfc7cda2f69deb2f84baee4e3d (patch)
tree992701e6ee9caaeffa1f22eb55f7f944fb1cf911
parent80b1cbbb639088fc792389bfde75a7f6150f8029 (diff)
parent7c300d8408586a9f2cfe8eed89969ef5f6b8a183 (diff)
downloadredot-engine-af0058c7e69cbdbfc7cda2f69deb2f84baee4e3d.tar.gz
Merge pull request #96587 from Malcolmnixon/check-openxr-hand-tracking
Warn if XRHandModifier3D used with OpenXR and hand-tracking disabled
-rw-r--r--scene/3d/xr_hand_modifier_3d.cpp12
-rw-r--r--scene/3d/xr_hand_modifier_3d.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/scene/3d/xr_hand_modifier_3d.cpp b/scene/3d/xr_hand_modifier_3d.cpp
index aa63fb623f..3b533da701 100644
--- a/scene/3d/xr_hand_modifier_3d.cpp
+++ b/scene/3d/xr_hand_modifier_3d.cpp
@@ -30,6 +30,7 @@
#include "xr_hand_modifier_3d.h"
+#include "core/config/project_settings.h"
#include "servers/xr/xr_pose.h"
#include "servers/xr_server.h"
@@ -283,6 +284,17 @@ void XRHandModifier3D::_skeleton_changed(Skeleton3D *p_old, Skeleton3D *p_new) {
_get_joint_data();
}
+PackedStringArray XRHandModifier3D::get_configuration_warnings() const {
+ PackedStringArray warnings = SkeletonModifier3D::get_configuration_warnings();
+
+ // Detect OpenXR without the Hand Tracking extension.
+ if (GLOBAL_GET("xr/openxr/enabled") && !GLOBAL_GET("xr/openxr/extensions/hand_tracking")) {
+ warnings.push_back("XRHandModifier3D requires the OpenXR Hand Tracking extension to be enabled.");
+ }
+
+ return warnings;
+}
+
void XRHandModifier3D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
diff --git a/scene/3d/xr_hand_modifier_3d.h b/scene/3d/xr_hand_modifier_3d.h
index 3d78f32b64..d58ccd0adf 100644
--- a/scene/3d/xr_hand_modifier_3d.h
+++ b/scene/3d/xr_hand_modifier_3d.h
@@ -55,6 +55,8 @@ public:
void set_bone_update(BoneUpdate p_bone_update);
BoneUpdate get_bone_update() const;
+ PackedStringArray get_configuration_warnings() const override;
+
void _notification(int p_what);
protected: