diff --git a/bin/win64/res/qml/ChaperonePage.qml b/bin/win64/res/qml/ChaperonePage.qml index de12834..0fca311 100644 --- a/bin/win64/res/qml/ChaperonePage.qml +++ b/bin/win64/res/qml/ChaperonePage.qml @@ -256,7 +256,7 @@ MyStackViewPage { chaperoneVisibilityText.text = Math.round(val) + "%" } onValueChanged: { - ChaperoneTabController.setBoundsVisibility(Math.round(value), false) + ChaperoneTabController.setBoundsVisibility(value.toFixed(2), false) } } @@ -372,7 +372,9 @@ MyStackViewPage { Layout.fillWidth: true onPositionChanged: { var val = (this.from + ( this.position * (this.to - this.from))).toFixed(2) - ChaperoneTabController.setHeight(val, false); + if (activeFocus) { + ChaperoneTabController.setHeight(val, false); + } chaperoneHeightText.text = val } onValueChanged: { @@ -459,11 +461,7 @@ MyStackViewPage { text: "Reset" Layout.preferredWidth: 250 onClicked: { - chaperoneVisibilitySlider.value = 0.6 - chaperoneFadeDistanceSlider.value = 0.7 - chaperoneCenterMarkerToggle.checked = false - chaperonePlaySpaceToggle.checked = false - chaperoneForceBoundsToggle.checked = false + ChaperoneTabController.reset() } } diff --git a/bin/win64/res/qml/PlayspacePage.qml b/bin/win64/res/qml/PlayspacePage.qml index e8ffce9..178d6be 100644 --- a/bin/win64/res/qml/PlayspacePage.qml +++ b/bin/win64/res/qml/PlayspacePage.qml @@ -289,9 +289,9 @@ MyStackViewPage { Component.onCompleted: { playspaceAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone - playSpaceMoveXText.text = MoveCenterTabController.offsetX.toFixed(1) - playSpaceMoveYText.text = MoveCenterTabController.offsetY.toFixed(1) - playSpaceMoveZText.text = MoveCenterTabController.offsetZ.toFixed(1) + playSpaceMoveXText.text = MoveCenterTabController.offsetX.toFixed(2) + playSpaceMoveYText.text = MoveCenterTabController.offsetY.toFixed(2) + playSpaceMoveZText.text = MoveCenterTabController.offsetZ.toFixed(2) playspaceRotationSlider.value = MoveCenterTabController.rotation if (MoveCenterTabController.trackingUniverse === 0) { playspaceModeText.text = "Sitting" diff --git a/bin/win64/res/qml/SteamVRPage.qml b/bin/win64/res/qml/SteamVRPage.qml index d3aa79f..79ebeff 100644 --- a/bin/win64/res/qml/SteamVRPage.qml +++ b/bin/win64/res/qml/SteamVRPage.qml @@ -184,11 +184,7 @@ MyStackViewPage { text: "Reset" Layout.preferredWidth: 250 onClicked: { - steamvrSupersamplingSlider.value = 1.0 - steamvrCompositorSupersamplingSlider.value = 1.0 - steamvrAllowInterleavedReprojectionToggle.checked = true - steamvrAllowAsyncReprojectionToggle.checked = true - steamvrForceReprojectionToggle.checked = false + SteamVRTabController.reset() } } diff --git a/src/tabcontrollers/ChaperoneTabController.cpp b/src/tabcontrollers/ChaperoneTabController.cpp index b800856..152a1c4 100644 --- a/src/tabcontrollers/ChaperoneTabController.cpp +++ b/src/tabcontrollers/ChaperoneTabController.cpp @@ -495,4 +495,33 @@ float ChaperoneTabController::getBoundsMaxY() { return result; } +void ChaperoneTabController::reset() { + vr::EVRSettingsError vrSettingsError; + + vr::VRSettings()->RemoveKeyInSection(vr::k_pch_CollisionBounds_Section, vr::k_pch_CollisionBounds_ColorGammaA_Int32, &vrSettingsError); + if (vrSettingsError != vr::VRSettingsError_None) { + LOG(WARNING) << "Could not remove \"" << vr::k_pch_CollisionBounds_ColorGammaA_Int32 << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError); + } + + vr::VRSettings()->RemoveKeyInSection(vr::k_pch_CollisionBounds_Section, vr::k_pch_CollisionBounds_FadeDistance_Float, &vrSettingsError); + if (vrSettingsError != vr::VRSettingsError_None) { + LOG(WARNING) << "Could not remove \"" << vr::k_pch_CollisionBounds_FadeDistance_Float << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError); + } + + vr::VRSettings()->RemoveKeyInSection(vr::k_pch_CollisionBounds_Section, vr::k_pch_CollisionBounds_CenterMarkerOn_Bool, &vrSettingsError); + if (vrSettingsError != vr::VRSettingsError_None) { + LOG(WARNING) << "Could not remove \"" << vr::k_pch_CollisionBounds_CenterMarkerOn_Bool << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError); + } + + vr::VRSettings()->RemoveKeyInSection(vr::k_pch_CollisionBounds_Section, vr::k_pch_CollisionBounds_PlaySpaceOn_Bool, &vrSettingsError); + if (vrSettingsError != vr::VRSettingsError_None) { + LOG(WARNING) << "Could not remove \"" << vr::k_pch_CollisionBounds_PlaySpaceOn_Bool << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError); + } + + setForceBounds(false); + + vr::VRSettings()->Sync(); + settingsUpdateCounter = 999; // Easiest way to get default values +} + } // namespace advconfig diff --git a/src/tabcontrollers/ChaperoneTabController.h b/src/tabcontrollers/ChaperoneTabController.h index 8d6adea..121e914 100644 --- a/src/tabcontrollers/ChaperoneTabController.h +++ b/src/tabcontrollers/ChaperoneTabController.h @@ -111,6 +111,8 @@ public slots: void applyChaperoneProfile(unsigned index); void deleteChaperoneProfile(unsigned index); + void reset(); + signals: void boundsVisibilityChanged(float value); void fadeDistanceChanged(float value); diff --git a/src/tabcontrollers/MoveCenterTabController.cpp b/src/tabcontrollers/MoveCenterTabController.cpp index e29e1de..f36f208 100644 --- a/src/tabcontrollers/MoveCenterTabController.cpp +++ b/src/tabcontrollers/MoveCenterTabController.cpp @@ -101,7 +101,8 @@ void MoveCenterTabController::setAdjustChaperone(bool value, bool notify) { parent->AddOffsetToCollisionBounds(2, -m_offsetZ, false); } if (m_rotation != 0) { - parent->RotateCollisionBounds(-m_rotation, false); + float angle = m_rotation * 2 * M_PI / 360.0; + parent->RotateCollisionBounds(-angle, false); } } else { if (m_offsetX != 0.0f) { @@ -114,7 +115,8 @@ void MoveCenterTabController::setAdjustChaperone(bool value, bool notify) { parent->AddOffsetToCollisionBounds(2, m_offsetZ, false); } if (m_rotation != 0) { - parent->RotateCollisionBounds(m_rotation, false); + float angle = m_rotation * 2 * M_PI / 360.0; + parent->RotateCollisionBounds(angle, false); } } vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live); diff --git a/src/tabcontrollers/SteamVRTabController.cpp b/src/tabcontrollers/SteamVRTabController.cpp index bc0a43b..5a10dff 100644 --- a/src/tabcontrollers/SteamVRTabController.cpp +++ b/src/tabcontrollers/SteamVRTabController.cpp @@ -67,11 +67,13 @@ void SteamVRTabController::eventLoopTick() { void SteamVRTabController::setSuperSampling(float value, bool notify) { + bool override = false; if (value <= 0.01f) { LOG(WARNING) << "Encountered a supersampling value <= 0.01, setting supersampling to 1.0"; value = 1.0f; + override = true; } - if (m_superSampling != value) { + if (override || m_superSampling != value) { LOG(DEBUG) << "Supersampling value changed: " << m_superSampling << " => " << value; m_superSampling = value; vr::VRSettings()->SetFloat(vr::k_pch_SteamVR_Section, vr::k_pch_SteamVR_RenderTargetMultiplier_Float, m_superSampling); @@ -84,11 +86,13 @@ void SteamVRTabController::setSuperSampling(float value, bool notify) { void SteamVRTabController::setCompositorSuperSampling(float value, bool notify) { + bool override = false; if (value <= 0.01f) { LOG(WARNING) << "Encountered a compositor supersampling value <= 0.01, setting supersampling to 1.0"; value = 1.0f; + override = true; } - if (m_compositorSuperSampling != value) { + if (override || m_compositorSuperSampling != value) { LOG(DEBUG) << "Compositor supersampling value changed: " << m_compositorSuperSampling << " => " << value; m_compositorSuperSampling = value; vr::VRSettings()->SetFloat(vrsettings_compositor_category, vr::k_pch_SteamVR_RenderTargetMultiplier_Float, m_compositorSuperSampling); @@ -160,6 +164,40 @@ void SteamVRTabController::setForceReprojection(bool value, bool notify) { } +void SteamVRTabController::reset() { + vr::EVRSettingsError vrSettingsError; + + vr::VRSettings()->RemoveKeyInSection(vr::k_pch_SteamVR_Section, vr::k_pch_SteamVR_RenderTargetMultiplier_Float, &vrSettingsError); + if (vrSettingsError != vr::VRSettingsError_None) { + LOG(WARNING) << "Could not remove \"" << vr::k_pch_SteamVR_RenderTargetMultiplier_Float << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError); + } + + setCompositorSuperSampling(1.0f); // Is not in default.vrsettings yet + vr::VRSettings()->RemoveKeyInSection(vrsettings_compositor_category, vr::k_pch_SteamVR_RenderTargetMultiplier_Float, &vrSettingsError); + if (vrSettingsError != vr::VRSettingsError_None) { + LOG(WARNING) << "Could not remove \"" << vrsettings_compositor_category << "::" << vr::k_pch_SteamVR_RenderTargetMultiplier_Float << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError); + } + + vr::VRSettings()->RemoveKeyInSection(vr::k_pch_SteamVR_Section, vrsettings_steamvr_allowInterleavedReprojection, &vrSettingsError); + if (vrSettingsError != vr::VRSettingsError_None) { + LOG(WARNING) << "Could not remove \"" << vrsettings_steamvr_allowInterleavedReprojection << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError); + } + + vr::VRSettings()->RemoveKeyInSection(vr::k_pch_SteamVR_Section, vrsettings_steamvr_allowAsyncReprojection, &vrSettingsError); + if (vrSettingsError != vr::VRSettingsError_None) { + LOG(WARNING) << "Could not remove \"" << vrsettings_steamvr_allowAsyncReprojection << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError); + } + + vr::VRSettings()->RemoveKeyInSection(vr::k_pch_SteamVR_Section, vr::k_pch_SteamVR_ForceReprojection_Bool, &vrSettingsError); + if (vrSettingsError != vr::VRSettingsError_None) { + LOG(WARNING) << "Could not remove \"" << vr::k_pch_SteamVR_ForceReprojection_Bool << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError); + } + + vr::VRSettings()->Sync(); + settingsUpdateCounter = 999; // Easiest way to get default values +} + + void SteamVRTabController::restartSteamVR() { QString cmd = QString("cmd.exe /C restartvrserver.bat \"") + parent->getVRRuntimePathUrl().toLocalFile() + QString("\""); LOG(INFO) << "SteamVR Restart Command: " << cmd; diff --git a/src/tabcontrollers/SteamVRTabController.h b/src/tabcontrollers/SteamVRTabController.h index 1902d90..55a4a5f 100644 --- a/src/tabcontrollers/SteamVRTabController.h +++ b/src/tabcontrollers/SteamVRTabController.h @@ -56,6 +56,7 @@ public slots: void setAllowAsyncReprojection(bool value, bool notify = true); void setForceReprojection(bool value, bool notify = true); + void reset(); void restartSteamVR(); signals: