From b1548e8b19e005823bfb125f31eddd96afb40a94 Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Mon, 11 Sep 2023 14:12:34 +1000 Subject: [PATCH] OpenXR fix error spam if session hasn't started yet --- modules/openxr/openxr_api.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp index a66afee1c52..8f9d1d8fd5f 100644 --- a/modules/openxr/openxr_api.cpp +++ b/modules/openxr/openxr_api.cpp @@ -1434,7 +1434,9 @@ Size2 OpenXRAPI::get_recommended_target_size() { XRPose::TrackingConfidence OpenXRAPI::get_head_center(Transform3D &r_transform, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity) { XrResult result; - ERR_FAIL_COND_V(!running, XRPose::XR_TRACKING_CONFIDENCE_NONE); + if (!running) { + return XRPose::XR_TRACKING_CONFIDENCE_NONE; + } // xrWaitFrame not run yet if (frame_state.predictedDisplayTime == 0) { @@ -1487,7 +1489,9 @@ XRPose::TrackingConfidence OpenXRAPI::get_head_center(Transform3D &r_transform, } bool OpenXRAPI::get_view_transform(uint32_t p_view, Transform3D &r_transform) { - ERR_FAIL_COND_V(!running, false); + if (!running) { + return false; + } // xrWaitFrame not run yet if (frame_state.predictedDisplayTime == 0) { @@ -1506,9 +1510,12 @@ bool OpenXRAPI::get_view_transform(uint32_t p_view, Transform3D &r_transform) { } bool OpenXRAPI::get_view_projection(uint32_t p_view, double p_z_near, double p_z_far, Projection &p_camera_matrix) { - ERR_FAIL_COND_V(!running, false); ERR_FAIL_NULL_V(graphics_extension, false); + if (!running) { + return false; + } + // xrWaitFrame not run yet if (frame_state.predictedDisplayTime == 0) { return false;