From 72e91e91165fff97df09c0a24464bc9856fe387c Mon Sep 17 00:00:00 2001 From: ykeara Date: Fri, 29 Mar 2024 01:09:46 -0500 Subject: [PATCH] 5.8.11 (#668) * change fix floor re-center to just be standard recenter * add some error handling around calibration state, force chaperone to live state on 0 offset * fix commit * Changed fix floor functions to operate off of move center controller * add cur offset to center rebased to move center tab controller * update version number * fix initialization issue for universe center * add check to re-initialize if calibration state is not yet set i.e. lighthouse sleep * increment version number, slight change for specifically 200 error * remove commented code * fix conversion error warning --- build_scripts/compile_version_string.txt | 2 +- src/overlaycontroller.cpp | 89 ++----------------- src/overlaycontroller.h | 9 -- src/res/qml/FixFloorPage.qml | 2 +- src/tabcontrollers/FixFloorTabController.cpp | 20 +---- .../MoveCenterTabController.cpp | 86 ++++++++++++++---- src/tabcontrollers/MoveCenterTabController.h | 4 + ver/versioncheck.json | 2 +- 8 files changed, 84 insertions(+), 130 deletions(-) diff --git a/build_scripts/compile_version_string.txt b/build_scripts/compile_version_string.txt index 55505cf6..e65ab39b 100644 --- a/build_scripts/compile_version_string.txt +++ b/build_scripts/compile_version_string.txt @@ -1 +1 @@ -5.8.9-release +5.8.11-release diff --git a/src/overlaycontroller.cpp b/src/overlaycontroller.cpp index fb80cebe..382cf7a2 100644 --- a/src/overlaycontroller.cpp +++ b/src/overlaycontroller.cpp @@ -861,23 +861,6 @@ void OverlayController::setExclusiveInputEnabled( bool value, bool notify ) emit exclusiveInputEnabledChanged( value ); } } - -/*void OverlayController::setOpenXRFixEnabled( bool value, bool notify ) -{ - settings::setSetting( settings::BoolSetting::APPLICATION_openXRWorkAround, - value ); - if ( notify ) - { - emit openXRFixEnabledChanged( value ); - } -} - -bool OverlayController::openXRFixEnabled() const -{ - return settings::getSetting( - settings::BoolSetting::APPLICATION_openXRWorkAround ); -}*/ - void OverlayController::setAutoApplyChaperoneEnabled( bool value, bool notify ) { settings::setSetting( settings::BoolSetting::APPLICATION_autoApplyChaperone, @@ -1268,6 +1251,11 @@ void OverlayController::mainEventLoop() m_chaperoneUtils.loadChaperoneData(); chaperoneDataAlreadyUpdated = true; } + if ( previousUniverseId == 0 + && !m_moveCenterTabController.isInitComplete() ) + { + m_moveCenterTabController.zeroOffsets(); + } } break; case vr::VREvent_Input_ActionManifestReloaded: @@ -1359,73 +1347,6 @@ void OverlayController::mainEventLoop() } } -void OverlayController::AddOffsetToUniverseCenter( - vr::ETrackingUniverseOrigin universe, - unsigned axisId, - float offset, - bool adjustBounds, - bool commit ) -{ - float offsetArray[3] = { 0, 0, 0 }; - offsetArray[axisId] = offset; - AddOffsetToUniverseCenter( universe, offsetArray, adjustBounds, commit ); -} - -void OverlayController::AddOffsetToUniverseCenter( - vr::ETrackingUniverseOrigin universe, - float offset[3], - bool adjustBounds, - bool commit ) -{ - if ( offset[0] != 0.0f || offset[1] != 0.0f || offset[2] != 0.0f ) - { - if ( commit ) - { - vr::VRChaperoneSetup()->HideWorkingSetPreview(); - vr::VRChaperoneSetup()->RevertWorkingCopy(); - } - vr::HmdMatrix34_t curPos; - if ( universe == vr::TrackingUniverseStanding ) - { - vr::VRChaperoneSetup()->GetWorkingStandingZeroPoseToRawTrackingPose( - &curPos ); - } - else - { - vr::VRChaperoneSetup()->GetWorkingSeatedZeroPoseToRawTrackingPose( - &curPos ); - } - for ( int i = 0; i < 3; i++ ) - { - curPos.m[0][3] += curPos.m[0][i] * offset[i]; - curPos.m[1][3] += curPos.m[1][i] * offset[i]; - curPos.m[2][3] += curPos.m[2][i] * offset[i]; - } - if ( universe == vr::TrackingUniverseStanding ) - { - vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose( - &curPos ); - } - else - { - vr::VRChaperoneSetup()->SetWorkingSeatedZeroPoseToRawTrackingPose( - &curPos ); - } - if ( adjustBounds && universe == vr::TrackingUniverseStanding ) - { - float collisionOffset[] = { -offset[0], -offset[1], -offset[2] }; - AddOffsetToCollisionBounds( collisionOffset, false ); - } - if ( commit ) - { - vr::VRChaperoneSetup()->CommitWorkingCopy( - vr::EChaperoneConfigFile_Live ); - vr::VRChaperoneSetup()->ReloadFromDisk( - vr::EChaperoneConfigFile_Temp ); - } - } -} - void OverlayController::RotateUniverseCenter( vr::ETrackingUniverseOrigin universe, float yAngle, diff --git a/src/overlaycontroller.h b/src/overlaycontroller.h index 3a819d56..24b26d3c 100644 --- a/src/overlaycontroller.h +++ b/src/overlaycontroller.h @@ -200,15 +200,6 @@ class OverlayController : public QObject const std::string& name, const std::string& key = "" ); - void AddOffsetToUniverseCenter( vr::ETrackingUniverseOrigin universe, - unsigned axisId, - float offset, - bool adjustBounds = true, - bool commit = true ); - void AddOffsetToUniverseCenter( vr::ETrackingUniverseOrigin universe, - float offset[3], - bool adjustBounds = true, - bool commit = true ); void RotateUniverseCenter( vr::ETrackingUniverseOrigin universe, float yAngle, bool adjustBounds = true, diff --git a/src/res/qml/FixFloorPage.qml b/src/res/qml/FixFloorPage.qml index 641b35ac..c19bdc78 100644 --- a/src/res/qml/FixFloorPage.qml +++ b/src/res/qml/FixFloorPage.qml @@ -93,7 +93,7 @@ MyStackViewPage { text: "Apply Space Settings Offsets as Center" Layout.preferredHeight: 80 onClicked: { - MoveCenterTabController.zeroOffsets() + MoveCenterTabController.addCurOffsetAsCenter() } } diff --git a/src/tabcontrollers/FixFloorTabController.cpp b/src/tabcontrollers/FixFloorTabController.cpp index 959e7351..80f1ecfb 100644 --- a/src/tabcontrollers/FixFloorTabController.cpp +++ b/src/tabcontrollers/FixFloorTabController.cpp @@ -207,8 +207,7 @@ void FixFloorTabController::dashboardLoopTick( offset[0] = floorOffsetX; offset[2] = floorOffsetZ; } - parent->AddOffsetToUniverseCenter( - vr::TrackingUniverseStanding, offset, true ); + parent->m_moveCenterTabController.addOffset( offset ); statusMessage = ( state == 2 ) ? "Recentering ... Ok" : "Fixing ... OK"; statusMessageTimeout = 1.0; @@ -302,24 +301,13 @@ void FixFloorTabController::fixFloorClicked() void FixFloorTabController::recenterClicked() { - parent->m_moveCenterTabController.reset(); - statusMessage = "Fixing ..."; - statusMessageTimeout = 1.0; - emit statusMessageSignal(); - emit measureStartSignal(); - measurementCount = 0; - state = 2; + parent->m_moveCenterTabController.sendSeatedRecenter(); } void FixFloorTabController::undoFixFloorClicked() { - parent->m_moveCenterTabController.reset(); - parent->AddOffsetToUniverseCenter( - vr::TrackingUniverseStanding, 0, -floorOffsetX, false ); - parent->AddOffsetToUniverseCenter( - vr::TrackingUniverseStanding, 1, -floorOffsetY, false ); - parent->AddOffsetToUniverseCenter( - vr::TrackingUniverseStanding, 2, -floorOffsetZ, false ); + float off[3] = { -floorOffsetX, -floorOffsetY, -floorOffsetZ }; + parent->m_moveCenterTabController.addOffset( off ); LOG( INFO ) << "Fix Floor: Undo Floor Offset = [" << -floorOffsetX << ", " << -floorOffsetY << ", " << -floorOffsetZ << "]"; floorOffsetY = 0.0f; diff --git a/src/tabcontrollers/MoveCenterTabController.cpp b/src/tabcontrollers/MoveCenterTabController.cpp index a71beb8a..565edcaa 100644 --- a/src/tabcontrollers/MoveCenterTabController.cpp +++ b/src/tabcontrollers/MoveCenterTabController.cpp @@ -123,6 +123,27 @@ void MoveCenterTabController::applyOffsetProfile( unsigned index ) } } +void MoveCenterTabController::addOffset( float offset[] ) +{ + m_universeCenterForReset.m[0][3] += offset[0]; + m_universeCenterForReset.m[1][3] += offset[1]; + m_universeCenterForReset.m[2][3] += offset[2]; + + m_seatedCenterForReset.m[0][3] += offset[0]; + m_seatedCenterForReset.m[1][3] += offset[1]; + m_seatedCenterForReset.m[2][3] += offset[2]; + + updateSpace( true ); +} + +void MoveCenterTabController::addCurOffsetAsCenter() +{ + float off[3] = { -m_offsetX, m_offsetY, -m_offsetZ }; + // zeroOffsets(); + resetOffsets( true ); + addOffset( off ); +} + void MoveCenterTabController::deleteOffsetProfile( unsigned index ) { if ( index < m_offsetProfiles.size() ) @@ -1097,18 +1118,25 @@ void MoveCenterTabController::zeroOffsets() setTrackingUniverse( vr::VRCompositor()->GetTrackingSpace() ); if ( parent->isPreviousShutdownSafe() ) { - // all init complete, safe to autosave chaperone profile - parent->m_chaperoneTabController.createNewAutosaveProfile(); - m_initComplete = true; auto calState = vr::VRChaperone()->GetCalibrationState(); - LOG( INFO ) << "Calibration State after autosave profile is: " - << calState; + if ( calState == 200 ) + { + LOG( WARNING ) + << "Chaperone State Does Not Exist Yet, will wait for " + "universe change to finish initialization"; + } + else + { + // all init complete, safe to autosave chaperone profile + parent->m_chaperoneTabController.createNewAutosaveProfile(); + m_initComplete = true; + } } else { // shutdown was unsafe last session! LOG( WARNING ) << "DETECTED UNSAFE SHUTDOWN FROM LAST SESSION"; - m_initComplete = true; + m_initComplete = false; if ( !parent->crashRecoveryDisabled() ) { parent->m_chaperoneTabController.applyAutosavedProfile(); @@ -1165,8 +1193,18 @@ void MoveCenterTabController::clampVelocity( double* velocity ) void MoveCenterTabController::updateChaperoneResetData() { - // TODO - // vr::VRChaperoneSetup()->RevertWorkingCopy(); + auto cstate = vr::VRChaperone()->GetCalibrationState(); + if ( cstate > 199 ) + { + LOG( WARNING ) << "Chaperone Calibration State is error: " << cstate + << " While Trying to Update Reset Data"; + } + else + { + vr::VRChaperoneSetup()->CommitWorkingCopy( + vr::EChaperoneConfigFile_Live ); + vr::VRChaperoneSetup()->RevertWorkingCopy(); + } unsigned currentQuadCount = 0; vr::VRChaperoneSetup()->GetWorkingCollisionBoundsInfo( nullptr, ¤tQuadCount ); @@ -1857,16 +1895,6 @@ void MoveCenterTabController::resetOffsets( bool resetOffsetsJustPressed ) // of keyboard input. if ( resetOffsetsJustPressed ) { - auto calState = vr::VRChaperone()->GetCalibrationState(); - LOG( INFO ) << "Calibration State on Reset Offsets is: " << calState; - - if ( calState > 199 && m_initComplete ) - { - LOG( INFO ) << "Chaperone calibration state is error, attempting " - "to apply autosaved profile to fix issue"; - parent->m_chaperoneTabController.applyAutosavedProfile(); - } - m_offsetX = 0.0f; m_offsetY = 0.0f; m_offsetZ = 0.0f; @@ -1876,6 +1904,16 @@ void MoveCenterTabController::resetOffsets( bool resetOffsetsJustPressed ) emit offsetZChanged( m_offsetZ ); emit rotationChanged( m_rotation ); updateSpace( true ); + auto calState = vr::VRChaperone()->GetCalibrationState(); + LOG( INFO ) << "Calibration State on Reset Offsets is: " << calState; + + // if ( calState > 199 && m_initComplete ) + // { + // LOG( INFO ) << "Chaperone calibration state is error, + // attempting " + // "to apply autosaved profile to fix issue"; + // parent->m_chaperoneTabController.applyAutosavedProfile(); + // } // reset(); } } @@ -2478,6 +2516,18 @@ void MoveCenterTabController::updateSpace( bool forceUpdate ) { return; } + if ( ( abs( m_offsetX ) + abs( m_offsetY ) + abs( m_offsetZ ) + + abs( static_cast( m_rotation ) ) ) + == 0 + && !forceUpdate ) + { + if ( m_chaperoneHasCommit ) + { + m_chaperoneHasCommit = true; + updateChaperoneResetData(); + } + } + m_chaperoneHasCommit = false; vr::HmdMatrix34_t offsetUniverseCenter; diff --git a/src/tabcontrollers/MoveCenterTabController.h b/src/tabcontrollers/MoveCenterTabController.h index d468ef6c..2606a190 100644 --- a/src/tabcontrollers/MoveCenterTabController.h +++ b/src/tabcontrollers/MoveCenterTabController.h @@ -196,6 +196,7 @@ class MoveCenterTabController : public QObject unsigned m_dragComfortFrameSkipCounter = 0; unsigned m_turnComfortFrameSkipCounter = 0; int m_recenterStages = 0; + int m_chaperoneHasCommit = false; // Matrix used For Center Marker vr::HmdMatrix34_t m_offsetmatrix = utils::k_forwardUpMatrix; @@ -279,6 +280,8 @@ class MoveCenterTabController : public QObject Q_INVOKABLE unsigned getOffsetProfileCount(); Q_INVOKABLE QString getOffsetProfileName( unsigned index ); + void addOffset( float offset[3] ); + // actions: void leftHandSpaceDrag( bool leftHandDragActive ); void rightHandSpaceDrag( bool rightHandDragActive ); @@ -353,6 +356,7 @@ public slots: void addOffsetProfile( QString name ); void applyOffsetProfile( unsigned index ); void deleteOffsetProfile( unsigned index ); + void addCurOffsetAsCenter(); signals: void trackingUniverseChanged( int value ); diff --git a/ver/versioncheck.json b/ver/versioncheck.json index 6b53ef15..1abd405c 100644 --- a/ver/versioncheck.json +++ b/ver/versioncheck.json @@ -1 +1 @@ -{ "major": 5, "minor": 8, "patch": 9, "updateMessage": "", "optionalMessage": "" } +{ "major": 5, "minor": 8, "patch": 11, "updateMessage": "", "optionalMessage": "" }