Add Old-Style Motion Setting

This commit is contained in:
Kung-vr
2019-04-21 17:57:39 +09:00
parent 9fd3ab0dee
commit 48f0743bf9
3 changed files with 59 additions and 2 deletions
+12
View File
@@ -34,6 +34,14 @@ MyStackViewPage {
}
}
MyToggleButton {
id: oldStyleMotionToggle
text: "Old-Style Motion (per-frame disk writes)"
onCheckedChanged: {
MoveCenterTabController.setOldStyleMotion(checked, true)
}
}
Item {
Layout.fillHeight: true
}
@@ -42,6 +50,7 @@ MyStackViewPage {
settingsAutoStartToggle.checked = SettingsTabController.autoStartEnabled
forceReviveToggle.checked = SettingsTabController.forceRevivePage
allowExternalEditsToggle.checked = MoveCenterTabController.allowExternalEdits
oldStyleMotionToggle.checked = MoveCenterTabController.oldStyleMotion
}
Connections {
@@ -59,6 +68,9 @@ MyStackViewPage {
onAllowExternalEditsChanged: {
allowExternalEditsToggle.checked = MoveCenterTabController.allowExternalEdits
}
onOldStyleMotionChanged: {
oldStyleMotionToggle.checked = MoveCenterTabController.oldStyleMotion
}
}
}
}
+41 -2
View File
@@ -128,6 +128,11 @@ void MoveCenterTabController::initStage1()
{
m_allowExternalEdits = value.toBool();
}
value = settings->value( "oldStyleMotion", m_oldStyleMotion );
if ( value.isValid() && !value.isNull() )
{
m_oldStyleMotion = value.toBool();
}
settings->endGroup();
m_lastDragUpdateTimePoint = std::chrono::steady_clock::now();
m_lastGravityUpdateTimePoint = std::chrono::steady_clock::now();
@@ -797,6 +802,31 @@ void MoveCenterTabController::setAllowExternalEdits( bool value, bool notify )
}
}
bool MoveCenterTabController::oldStyleMotion() const
{
return m_oldStyleMotion;
}
void MoveCenterTabController::setOldStyleMotion( bool value, bool notify )
{
// detect incoming change to old style, and hide working set
if ( value && !m_oldStyleMotion )
{
vr::VRChaperoneSetup()->HideWorkingSetPreview();
}
m_oldStyleMotion = value;
auto settings = OverlayController::appSettings();
settings->beginGroup( "playspaceSettings" );
settings->setValue( "oldStyleMotion", m_oldStyleMotion );
settings->endGroup();
settings->sync();
if ( notify )
{
emit oldStyleMotionChanged( m_oldStyleMotion );
}
}
void MoveCenterTabController::modOffsetX( float value, bool notify )
{
if ( !m_lockXToggle )
@@ -2259,8 +2289,17 @@ void MoveCenterTabController::updateSpace()
vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose(
&offsetUniverseCenter );
vr::VRChaperoneSetup()->ShowWorkingSetPreview();
m_chaperoneCommitted = false;
if ( m_oldStyleMotion )
{
vr::VRChaperoneSetup()->CommitWorkingCopy(
vr::EChaperoneConfigFile_Live );
m_chaperoneCommitted = true;
}
else
{
vr::VRChaperoneSetup()->ShowWorkingSetPreview();
m_chaperoneCommitted = false;
}
// loadChaperoneData( false ), false so that we don't load live data, and
// reference the working set instead.
@@ -73,6 +73,8 @@ class MoveCenterTabController : public QObject
setShowLogMatricesButton NOTIFY showLogMatricesButtonChanged )
Q_PROPERTY( bool allowExternalEdits READ allowExternalEdits WRITE
setAllowExternalEdits NOTIFY allowExternalEditsChanged )
Q_PROPERTY( bool oldStyleMotion READ oldStyleMotion WRITE setOldStyleMotion
NOTIFY oldStyleMotionChanged )
private:
OverlayController* parent;
@@ -148,6 +150,7 @@ private:
bool m_seatedModeDetected = false;
bool m_showLogMatricesButton = false;
bool m_allowExternalEdits = false;
bool m_oldStyleMotion = false;
unsigned settingsUpdateCounter = 0;
int m_hmdRotationStatsUpdateCounter = 0;
unsigned m_dragComfortFrameSkipCounter = 0;
@@ -204,6 +207,7 @@ public:
bool lockZToggle() const;
bool showLogMatricesButton() const;
bool allowExternalEdits() const;
bool oldStyleMotion() const;
double getHmdYawTotal();
void resetHmdYawTotal();
void incomingSeatedReset();
@@ -264,6 +268,7 @@ public slots:
void setLockZ( bool value, bool notify = true );
void setShowLogMatricesButton( bool value, bool notify = true );
void setAllowExternalEdits( bool value, bool notify = true );
void setOldStyleMotion( bool value, bool notify = true );
void shutdown();
void reset();
@@ -297,6 +302,7 @@ signals:
void requireLockZChanged( bool value );
void showLogMatricesButtonChanged( bool value );
void allowExternalEditsChanged( bool value );
void oldStyleMotionChanged( bool value );
};
} // namespace advsettings