Convert m_turnBounds to new settings API

This commit is contained in:
Vasily
2019-12-10 08:28:41 +01:00
committed by username223
parent 2b7e33b51b
commit 500fe0a98f
2 changed files with 8 additions and 17 deletions
+8 -16
View File
@@ -39,9 +39,6 @@ namespace advsettings
{ {
void MoveCenterTabController::initStage1() void MoveCenterTabController::initStage1()
{ {
m_turnBounds
= settings::getSetting( settings::BoolSetting::PLAYSPACE_turnBounds );
m_dragComfortFactor = static_cast<unsigned int>( settings::getSetting( m_dragComfortFactor = static_cast<unsigned int>( settings::getSetting(
settings::IntSetting::PLAYSPACE_dragComfortFactor ) ); settings::IntSetting::PLAYSPACE_dragComfortFactor ) );
m_turnComfortFactor = static_cast<unsigned int>( settings::getSetting( m_turnComfortFactor = static_cast<unsigned int>( settings::getSetting(
@@ -628,30 +625,25 @@ void MoveCenterTabController::setDragBounds( bool value, bool notify )
bool MoveCenterTabController::turnBounds() const bool MoveCenterTabController::turnBounds() const
{ {
return m_turnBounds; return settings::getSetting( settings::BoolSetting::PLAYSPACE_turnBounds );
} }
void MoveCenterTabController::setTurnBounds( bool value, bool notify ) void MoveCenterTabController::setTurnBounds( bool value, bool notify )
{ {
// detect deactivate // detect deactivate
if ( m_turnBounds && !value ) if ( turnBounds() && !value )
{ {
// set force bounds back to default on deactivate // set force bounds back to default on deactivate
vr::VRChaperone()->ForceBoundsVisible( vr::VRChaperone()->ForceBoundsVisible(
parent->m_chaperoneTabController.forceBounds() ); parent->m_chaperoneTabController.forceBounds() );
} }
m_turnBounds = value;
auto settings = OverlayController::appSettings(); settings::setSetting( settings::BoolSetting::PLAYSPACE_turnBounds, value );
settings->beginGroup( "playspaceSettings" );
settings->setValue( "turnBounds", m_turnBounds );
settings->endGroup();
settings->sync();
if ( notify ) if ( notify )
{ {
emit turnBoundsChanged( m_turnBounds ); emit turnBoundsChanged( value );
} }
LOG( INFO ) << "CHANGED SETTINGS: Space Turn Force Bounds set: "
<< m_turnBounds;
} }
unsigned MoveCenterTabController::dragComfortFactor() const unsigned MoveCenterTabController::dragComfortFactor() const
@@ -2966,13 +2958,13 @@ void MoveCenterTabController::eventLoopTick(
{ {
vr::VRChaperone()->ForceBoundsVisible( true ); vr::VRChaperone()->ForceBoundsVisible( true );
} }
else if ( m_turnBounds else if ( turnBounds()
&& m_activeTurnHand != vr::TrackedControllerRole_Invalid ) && m_activeTurnHand != vr::TrackedControllerRole_Invalid )
{ {
vr::VRChaperone()->ForceBoundsVisible( true ); vr::VRChaperone()->ForceBoundsVisible( true );
} }
// only set back to default every frame if setting is enabled // only set back to default every frame if setting is enabled
else if ( m_turnBounds || dragBounds() ) else if ( turnBounds() || dragBounds() )
{ {
vr::VRChaperone()->ForceBoundsVisible( vr::VRChaperone()->ForceBoundsVisible(
parent->m_chaperoneTabController.forceBounds() ); parent->m_chaperoneTabController.forceBounds() );
@@ -127,7 +127,6 @@ private:
float m_lastControllerPosition[3]; float m_lastControllerPosition[3];
unsigned m_dragComfortFactor = 0; unsigned m_dragComfortFactor = 0;
unsigned m_turnComfortFactor = 0; unsigned m_turnComfortFactor = 0;
bool m_turnBounds = false;
bool m_heightToggle = false; bool m_heightToggle = false;
float m_heightToggleOffset = -1.0f; float m_heightToggleOffset = -1.0f;
float m_gravityFloor = 0.0f; float m_gravityFloor = 0.0f;