From 24e3081533b2520a4e4cdd4c266ae4f89aabc687 Mon Sep 17 00:00:00 2001 From: Vasily Date: Sun, 1 Dec 2019 15:36:46 +0100 Subject: [PATCH] Convert m_oldStyleMotion to new settings API --- .../MoveCenterTabController.cpp | 22 +++++++------------ src/tabcontrollers/MoveCenterTabController.h | 1 - 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/tabcontrollers/MoveCenterTabController.cpp b/src/tabcontrollers/MoveCenterTabController.cpp index d0e18fe..7b5156a 100644 --- a/src/tabcontrollers/MoveCenterTabController.cpp +++ b/src/tabcontrollers/MoveCenterTabController.cpp @@ -56,8 +56,6 @@ void MoveCenterTabController::initStage1() m_flingStrength = static_cast( settings::getSetting( settings::DoubleSetting::PLAYSPACE_flingStrength ) ); - m_oldStyleMotion = settings::getSetting( - settings::BoolSetting::PLAYSPACE_oldStyleMotion ); m_universeCenteredRotation = settings::getSetting( settings::BoolSetting::PLAYSPACE_universeCenteredRotation ); m_enableSeatedMotion = settings::getSetting( @@ -905,29 +903,25 @@ void MoveCenterTabController::setAllowExternalEdits( bool value, bool notify ) bool MoveCenterTabController::oldStyleMotion() const { - return m_oldStyleMotion; + return settings::getSetting( + settings::BoolSetting::PLAYSPACE_oldStyleMotion ); } void MoveCenterTabController::setOldStyleMotion( bool value, bool notify ) { // detect incoming change to old style, and hide working set - if ( value && !m_oldStyleMotion ) + if ( value && !oldStyleMotion() ) { vr::VRChaperoneSetup()->HideWorkingSetPreview(); } - m_oldStyleMotion = value; - auto settings = OverlayController::appSettings(); - settings->beginGroup( "playspaceSettings" ); - settings->setValue( "oldStyleMotion", m_oldStyleMotion ); - settings->endGroup(); - settings->sync(); + settings::setSetting( settings::BoolSetting::PLAYSPACE_oldStyleMotion, + value ); + if ( notify ) { - emit oldStyleMotionChanged( m_oldStyleMotion ); + emit oldStyleMotionChanged( value ); } - LOG( INFO ) << "CHANGED SETTINGS: Old-Style Motion Set: " - << m_oldStyleMotion; } bool MoveCenterTabController::universeCenteredRotation() const @@ -2774,7 +2768,7 @@ void MoveCenterTabController::updateSpace( bool forceUpdate ) vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose( &offsetUniverseCenter ); - if ( m_oldStyleMotion ) + if ( oldStyleMotion() ) { // check if universe center is outside of OpenVR commit bounds (1km) if ( abs( offsetUniverseCenterXyz[0] ) > k_maxOpenvrCommitOffset ) diff --git a/src/tabcontrollers/MoveCenterTabController.h b/src/tabcontrollers/MoveCenterTabController.h index 23d8235..a34132c 100644 --- a/src/tabcontrollers/MoveCenterTabController.h +++ b/src/tabcontrollers/MoveCenterTabController.h @@ -170,7 +170,6 @@ private: bool m_dashWasOpenPreviousFrame = false; bool m_roomSetupModeDetected = false; bool m_seatedModeDetected = false; - bool m_oldStyleMotion = false; bool m_universeCenteredRotation = false; bool m_enableSeatedMotion = false; bool m_simpleRecenter = false;