Swap default to unchecked enable seated motion and add debug states

This commit is contained in:
Kung-vr
2019-10-13 17:02:15 +09:00
parent 2e6dd3b8fe
commit f05f6f7deb
6 changed files with 211 additions and 49 deletions
+55 -1
View File
@@ -337,6 +337,16 @@ OverlayController::OverlayController( bool desktopMode,
{ {
m_crashRecoveryDisabled = value.toBool(); m_crashRecoveryDisabled = value.toBool();
} }
value = appSettings()->value( "enableDebug", m_enableDebug );
if ( value.isValid() && !value.isNull() )
{
m_enableDebug = value.toBool();
}
value = appSettings()->value( "debugState", m_debugState );
if ( value.isValid() && !value.isNull() )
{
m_debugState = value.toInt();
}
appSettings()->endGroup(); appSettings()->endGroup();
} }
@@ -481,7 +491,7 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
this, this,
SLOT( OnTimeoutPumpEvents() ) ); SLOT( OnTimeoutPumpEvents() ) );
// Every 1ms we check if the current frame has advanced (for vysnc) // Every 1ms we check if the current frame has advanced (for vsync)
m_pPumpEventsTimer->setInterval( 1 ); m_pPumpEventsTimer->setInterval( 1 );
m_pPumpEventsTimer->start(); m_pPumpEventsTimer->start();
@@ -776,6 +786,50 @@ void OverlayController::setVsyncDisabled( bool value, bool notify )
} }
} }
bool OverlayController::enableDebug() const
{
return m_enableDebug;
}
void OverlayController::setEnableDebug( bool value, bool notify )
{
if ( m_enableDebug == value )
{
return;
}
m_enableDebug = value;
appSettings()->beginGroup( "applicationSettings" );
appSettings()->setValue( "enableDebug", m_enableDebug );
appSettings()->endGroup();
appSettings()->sync();
if ( notify )
{
emit enableDebugChanged( m_enableDebug );
}
}
int OverlayController::debugState() const
{
return m_debugState;
}
void OverlayController::setDebugState( int value, bool notify )
{
if ( m_debugState == value )
{
return;
}
m_debugState = value;
appSettings()->beginGroup( "applicationSettings" );
appSettings()->setValue( "debugState", m_debugState );
appSettings()->endGroup();
appSettings()->sync();
if ( notify )
{
emit debugStateChanged( m_debugState );
}
}
void OverlayController::setPreviousShutdownSafe( bool value ) void OverlayController::setPreviousShutdownSafe( bool value )
{ {
if ( m_previousShutdownSafe == value ) if ( m_previousShutdownSafe == value )
+12
View File
@@ -82,8 +82,12 @@ class OverlayController : public QObject
setCrashRecoveryDisabled NOTIFY crashRecoveryDisabledChanged ) setCrashRecoveryDisabled NOTIFY crashRecoveryDisabledChanged )
Q_PROPERTY( bool vsyncDisabled READ vsyncDisabled WRITE setVsyncDisabled Q_PROPERTY( bool vsyncDisabled READ vsyncDisabled WRITE setVsyncDisabled
NOTIFY vsyncDisabledChanged ) NOTIFY vsyncDisabledChanged )
Q_PROPERTY( bool enableDebug READ enableDebug WRITE setEnableDebug NOTIFY
enableDebugChanged )
Q_PROPERTY( int customTickRateMs READ customTickRateMs WRITE Q_PROPERTY( int customTickRateMs READ customTickRateMs WRITE
setCustomTickRateMs NOTIFY customTickRateMsChanged ) setCustomTickRateMs NOTIFY customTickRateMsChanged )
Q_PROPERTY( int debugState READ debugState WRITE setDebugState NOTIFY
debugStateChanged )
private: private:
vr::VROverlayHandle_t m_ulOverlayHandle = vr::k_ulOverlayHandleInvalid; vr::VROverlayHandle_t m_ulOverlayHandle = vr::k_ulOverlayHandleInvalid;
@@ -108,7 +112,9 @@ private:
bool m_noSound; bool m_noSound;
bool m_crashRecoveryDisabled = false; bool m_crashRecoveryDisabled = false;
bool m_vsyncDisabled = false; bool m_vsyncDisabled = false;
bool m_enableDebug = false;
int m_customTickRateMs = 20; int m_customTickRateMs = 20;
int m_debugState = 0;
QUrl m_runtimePathUrl; QUrl m_runtimePathUrl;
@@ -211,8 +217,10 @@ public:
void mainEventLoop(); void mainEventLoop();
bool crashRecoveryDisabled() const; bool crashRecoveryDisabled() const;
bool enableDebug() const;
bool vsyncDisabled() const; bool vsyncDisabled() const;
int customTickRateMs() const; int customTickRateMs() const;
int debugState() const;
public slots: public slots:
void renderOverlay(); void renderOverlay();
@@ -228,14 +236,18 @@ public slots:
void cancelAlarm01Sound(); void cancelAlarm01Sound();
void setCrashRecoveryDisabled( bool value, bool notify = true ); void setCrashRecoveryDisabled( bool value, bool notify = true );
void setEnableDebug( bool value, bool notify = true );
void setVsyncDisabled( bool value, bool notify = true ); void setVsyncDisabled( bool value, bool notify = true );
void setCustomTickRateMs( int value, bool notify = true ); void setCustomTickRateMs( int value, bool notify = true );
void setDebugState( int value, bool notify = true );
signals: signals:
void keyBoardInputSignal( QString input, unsigned long userValue = 0 ); void keyBoardInputSignal( QString input, unsigned long userValue = 0 );
void crashRecoveryDisabledChanged( bool value ); void crashRecoveryDisabledChanged( bool value );
void enableDebugChanged( bool value );
void vsyncDisabledChanged( bool value ); void vsyncDisabledChanged( bool value );
void customTickRateMsChanged( int value ); void customTickRateMsChanged( int value );
void debugStateChanged( int value );
private: private:
static QSettings* _appSettings; static QSettings* _appSettings;
+13 -13
View File
@@ -528,10 +528,10 @@ MyStackViewPage {
if (MoveCenterTabController.trackingUniverse === 0) { if (MoveCenterTabController.trackingUniverse === 0) {
spaceModeText.text = "Sitting" spaceModeText.text = "Sitting"
spaceSeatedRecenter.visible = true spaceSeatedRecenter.visible = true
offsetsGroupBox.visible = !MoveCenterTabController.disableSeatedMotion offsetsGroupBox.visible = MoveCenterTabController.enableSeatedMotion
rotationGroupBox.visible = !MoveCenterTabController.disableSeatedMotion rotationGroupBox.visible = MoveCenterTabController.enableSeatedMotion
resetButtonRow.visible = !MoveCenterTabController.disableSeatedMotion resetButtonRow.visible = MoveCenterTabController.enableSeatedMotion
seatedDisableWarningText.visible = MoveCenterTabController.disableSeatedMotion seatedDisableWarningText.visible = !MoveCenterTabController.enableSeatedMotion
} else if (MoveCenterTabController.trackingUniverse === 1) { } else if (MoveCenterTabController.trackingUniverse === 1) {
spaceModeText.text = "Standing" spaceModeText.text = "Standing"
@@ -580,24 +580,24 @@ MyStackViewPage {
onLockZToggleChanged: { onLockZToggleChanged: {
lockZToggle.checked = MoveCenterTabController.lockZToggle lockZToggle.checked = MoveCenterTabController.lockZToggle
} }
onDisableSeatedMotionChanged: { onEnableSeatedMotionChanged: {
if (MoveCenterTabController.trackingUniverse === 0) { if (MoveCenterTabController.trackingUniverse === 0) {
spaceModeText.text = "Sitting" spaceModeText.text = "Sitting"
spaceSeatedRecenter.visible = true spaceSeatedRecenter.visible = true
offsetsGroupBox.visible = !MoveCenterTabController.disableSeatedMotion offsetsGroupBox.visible = MoveCenterTabController.enableSeatedMotion
rotationGroupBox.visible = !MoveCenterTabController.disableSeatedMotion rotationGroupBox.visible = MoveCenterTabController.enableSeatedMotion
resetButtonRow.visible = !MoveCenterTabController.disableSeatedMotion resetButtonRow.visible = MoveCenterTabController.enableSeatedMotion
seatedDisableWarningText.visible = MoveCenterTabController.disableSeatedMotion seatedDisableWarningText.visible = !MoveCenterTabController.enableSeatedMotion
} }
} }
onTrackingUniverseChanged: { onTrackingUniverseChanged: {
if (MoveCenterTabController.trackingUniverse === 0) { if (MoveCenterTabController.trackingUniverse === 0) {
spaceModeText.text = "Sitting" spaceModeText.text = "Sitting"
spaceSeatedRecenter.visible = true spaceSeatedRecenter.visible = true
offsetsGroupBox.visible = !MoveCenterTabController.disableSeatedMotion offsetsGroupBox.visible = MoveCenterTabController.enableSeatedMotion
rotationGroupBox.visible = !MoveCenterTabController.disableSeatedMotion rotationGroupBox.visible = MoveCenterTabController.enableSeatedMotion
resetButtonRow.visible = !MoveCenterTabController.disableSeatedMotion resetButtonRow.visible = MoveCenterTabController.enableSeatedMotion
seatedDisableWarningText.visible = MoveCenterTabController.disableSeatedMotion seatedDisableWarningText.visible = !MoveCenterTabController.enableSeatedMotion
} else if (MoveCenterTabController.trackingUniverse === 1) { } else if (MoveCenterTabController.trackingUniverse === 1) {
spaceModeText.text = "Standing" spaceModeText.text = "Standing"
spaceSeatedRecenter.visible = false spaceSeatedRecenter.visible = false
+64 -11
View File
@@ -43,19 +43,30 @@ MyStackViewPage {
} }
MyToggleButton { MyToggleButton {
id: enableSeatedOffsetsRecenterToggle id: enableSeatedMotionToggle
text: "Enable Auto-set Seated Offsets During Seated Recenter" text: "Enable Motion Features When in Seated Mode (Experimental)"
onCheckedChanged: { onCheckedChanged: {
MoveCenterTabController.setEnableSeatedOffsetsRecenter(checked, true) MoveCenterTabController.setEnableSeatedMotion(checked, true)
seatedOffsetsRecenterRow.visible = checked
} }
} }
MyToggleButton { RowLayout {
id: disableSeatedMotionToggle Layout.fillWidth: true
text: "Disable All Motion Features When in Seated Mode" id: seatedOffsetsRecenterRow
onCheckedChanged: {
MoveCenterTabController.setDisableSeatedMotion(checked, true) Item {
Layout.preferredWidth: 50
} }
MyToggleButton {
id: enableSeatedOffsetsRecenterToggle
text: "Enable Auto-set Seated Offsets During Seated Recenter"
onCheckedChanged: {
MoveCenterTabController.setEnableSeatedOffsetsRecenter(checked, true)
}
}
} }
MyToggleButton { MyToggleButton {
@@ -119,6 +130,41 @@ MyStackViewPage {
} }
} }
RowLayout {
id: debugStateRow
Layout.fillWidth: true
MyText {
id: debugStateLabel
text: "Debug State: "
horizontalAlignment: Text.AlignRight
Layout.leftMargin: 20
Layout.rightMargin: 2
}
MyTextField {
id: debugStateText
text: "0"
keyBoardUID: 1002
Layout.preferredWidth: 140
Layout.leftMargin: 10
Layout.rightMargin: 1
horizontalAlignment: Text.AlignHCenter
function onInputEvent(input) {
var val = parseInt(input, 10)
if (!isNaN(val)) {
OverlayController.debugState = val
text = OverlayController.debugState
} else {
text = OverlayController.debugState
}
}
}
Item {
Layout.fillWidth: true
}
}
Item { Item {
Layout.fillHeight: true Layout.fillHeight: true
} }
@@ -131,7 +177,8 @@ MyStackViewPage {
oldStyleMotionToggle.checked = MoveCenterTabController.oldStyleMotion oldStyleMotionToggle.checked = MoveCenterTabController.oldStyleMotion
universeCenteredRotationToggle.checked = MoveCenterTabController.universeCenteredRotation universeCenteredRotationToggle.checked = MoveCenterTabController.universeCenteredRotation
enableSeatedOffsetsRecenterToggle.checked = MoveCenterTabController.enableSeatedOffsetsRecenter enableSeatedOffsetsRecenterToggle.checked = MoveCenterTabController.enableSeatedOffsetsRecenter
disableSeatedMotionToggle.checked = MoveCenterTabController.disableSeatedMotion enableSeatedMotionToggle.checked = MoveCenterTabController.enableSeatedMotion
seatedOffsetsRecenterRow.visible = MoveCenterTabController.enableSeatedMotion
disableCrashRecoveryToggle.checked = OverlayController.crashRecoveryDisabled disableCrashRecoveryToggle.checked = OverlayController.crashRecoveryDisabled
customTickRateText.text = OverlayController.customTickRateMs customTickRateText.text = OverlayController.customTickRateMs
@@ -139,6 +186,7 @@ MyStackViewPage {
customTickRateText.visible = vsyncDisabledToggle.checked customTickRateText.visible = vsyncDisabledToggle.checked
customTickRateLabel.visible = vsyncDisabledToggle.checked customTickRateLabel.visible = vsyncDisabledToggle.checked
customTickRateMsLabel.visible = vsyncDisabledToggle.checked customTickRateMsLabel.visible = vsyncDisabledToggle.checked
debugStateRow.visible = OverlayController.enableDebug
} }
Connections { Connections {
@@ -162,8 +210,9 @@ MyStackViewPage {
onEnableSeatedOffsetsRecenterChanged: { onEnableSeatedOffsetsRecenterChanged: {
enableSeatedOffsetsRecenterToggle.checked = MoveCenterTabController.enableSeatedOffsetsRecenter enableSeatedOffsetsRecenterToggle.checked = MoveCenterTabController.enableSeatedOffsetsRecenter
} }
onDisableSeatedMotionChanged: { onEnableSeatedMotionChanged: {
disableSeatedMotionToggle.checked = MoveCenterTabController.disableSeatedMotion enableSeatedMotionToggle.checked = MoveCenterTabController.enableSeatedMotion
seatedOffsetsRecenterRow.visible = MoveCenterTabController.enableSeatedMotion
} }
} }
@@ -182,6 +231,10 @@ MyStackViewPage {
onCustomTickRateMsChanged: { onCustomTickRateMsChanged: {
customTickRateText.text = OverlayController.customTickRateMs customTickRateText.text = OverlayController.customTickRateMs
} }
onEnableDebugChanged: {
debugStateRow.visible = OverlayController.enableDebug
}
} }
} }
} }
+61 -18
View File
@@ -159,10 +159,10 @@ void MoveCenterTabController::initStage1()
{ {
m_enableSeatedOffsetsRecenter = value.toBool(); m_enableSeatedOffsetsRecenter = value.toBool();
} }
value = settings->value( "disableSeatedMotion", m_disableSeatedMotion ); value = settings->value( "enableSeatedMotion", m_enableSeatedMotion );
if ( value.isValid() && !value.isNull() ) if ( value.isValid() && !value.isNull() )
{ {
m_disableSeatedMotion = value.toBool(); m_enableSeatedMotion = value.toBool();
} }
settings->endGroup(); settings->endGroup();
reloadOffsetProfiles(); reloadOffsetProfiles();
@@ -357,9 +357,9 @@ void MoveCenterTabController::outputLogSettings()
{ {
LOG( INFO ) << "LOADED SETTINGS: Seated Offsets Recenter Enabled"; LOG( INFO ) << "LOADED SETTINGS: Seated Offsets Recenter Enabled";
} }
if ( m_disableSeatedMotion ) if ( m_enableSeatedMotion )
{ {
LOG( INFO ) << "LOADED SETTINGS: Seated Motion Disabled"; LOG( INFO ) << "LOADED SETTINGS: Seated Motion Enabled";
} }
if ( m_dragBounds ) if ( m_dragBounds )
{ {
@@ -1220,25 +1220,25 @@ bool MoveCenterTabController::isInitComplete() const
return m_initComplete; return m_initComplete;
} }
bool MoveCenterTabController::disableSeatedMotion() const bool MoveCenterTabController::enableSeatedMotion() const
{ {
return m_disableSeatedMotion; return m_enableSeatedMotion;
} }
void MoveCenterTabController::setDisableSeatedMotion( bool value, bool notify ) void MoveCenterTabController::setEnableSeatedMotion( bool value, bool notify )
{ {
m_disableSeatedMotion = value; m_enableSeatedMotion = value;
auto settings = OverlayController::appSettings(); auto settings = OverlayController::appSettings();
settings->beginGroup( "playspaceSettings" ); settings->beginGroup( "playspaceSettings" );
settings->setValue( "disableSeatedMotion", m_disableSeatedMotion ); settings->setValue( "enableSeatedMotion", m_enableSeatedMotion );
settings->endGroup(); settings->endGroup();
settings->sync(); settings->sync();
if ( notify ) if ( notify )
{ {
emit disableSeatedMotionChanged( m_disableSeatedMotion ); emit enableSeatedMotionChanged( m_enableSeatedMotion );
} }
LOG( INFO ) << "CHANGED SETTINGS: Disable Seated Motion Set: " LOG( INFO ) << "CHANGED SETTINGS: Enable Seated Motion Set: "
<< m_disableSeatedMotion; << m_enableSeatedMotion;
} }
void MoveCenterTabController::modOffsetX( float value, bool notify ) void MoveCenterTabController::modOffsetX( float value, bool notify )
@@ -1285,7 +1285,12 @@ void MoveCenterTabController::shutdown()
void MoveCenterTabController::incomingSeatedReset() void MoveCenterTabController::incomingSeatedReset()
{ {
if ( !m_disableSeatedMotion ) if ( parent->enableDebug() && parent->debugState() == 2 )
{
return;
}
if ( m_enableSeatedMotion )
{ {
updateSeatedResetData(); updateSeatedResetData();
} }
@@ -1487,7 +1492,10 @@ void MoveCenterTabController::clampVelocity( double* velocity )
void MoveCenterTabController::updateSeatedResetData() void MoveCenterTabController::updateSeatedResetData()
{ {
reset(); if ( !( parent->enableDebug() && parent->debugState() == 1 ) )
{
reset();
}
vr::VRChaperoneSetup()->RevertWorkingCopy(); vr::VRChaperoneSetup()->RevertWorkingCopy();
vr::TrackedDevicePose_t devicePosesStanding[vr::k_unMaxTrackedDeviceCount]; vr::TrackedDevicePose_t devicePosesStanding[vr::k_unMaxTrackedDeviceCount];
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose( vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(
@@ -1527,6 +1535,38 @@ void MoveCenterTabController::updateSeatedResetData()
emit rotationChanged( m_rotation ); emit rotationChanged( m_rotation );
} }
if ( parent->enableDebug() )
{
switch ( parent->debugState() )
{
case 3:
{
vr::VRChaperoneSetup()->GetWorkingStandingZeroPoseToRawTrackingPose(
&m_seatedCenterForReset );
}
break;
case 4:
{
vr::VRChaperoneSetup()->GetWorkingSeatedZeroPoseToRawTrackingPose(
&m_seatedCenterForReset );
}
break;
case 5:
{
vr::VRChaperoneSetup()->GetLiveSeatedZeroPoseToRawTrackingPose(
&m_seatedCenterForReset );
}
break;
case 6:
{
m_seatedCenterForReset
= vr::VRSystem()
->GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
}
break;
}
}
unsigned checkQuadCount = 0; unsigned checkQuadCount = 0;
vr::VRChaperoneSetup()->GetWorkingCollisionBoundsInfo( nullptr, vr::VRChaperoneSetup()->GetWorkingCollisionBoundsInfo( nullptr,
&checkQuadCount ); &checkQuadCount );
@@ -3030,10 +3070,6 @@ void MoveCenterTabController::eventLoopTick(
// m_roomSetupModeDetected is set to false in zeroOffsets() if it's // m_roomSetupModeDetected is set to false in zeroOffsets() if it's
// successful. // successful.
} }
else if ( m_seatedModeDetected && m_disableSeatedMotion )
{
return;
}
else else
{ {
setTrackingUniverse( int( universe ) ); setTrackingUniverse( int( universe ) );
@@ -3054,6 +3090,13 @@ void MoveCenterTabController::eventLoopTick(
m_hmdRotationStatsUpdateCounter++; m_hmdRotationStatsUpdateCounter++;
} }
// stop everything before processing motion if we're in seated mode and
// don't have seated motion enabled
if ( m_seatedModeDetected && !m_enableSeatedMotion )
{
return;
}
// only update dynamic motion if the dash is closed // only update dynamic motion if the dash is closed
if ( !parent->isDashboardVisible() ) if ( !parent->isDashboardVisible() )
{ {
+6 -6
View File
@@ -102,8 +102,8 @@ class MoveCenterTabController : public QObject
bool enableSeatedOffsetsRecenter READ enableSeatedOffsetsRecenter WRITE bool enableSeatedOffsetsRecenter READ enableSeatedOffsetsRecenter WRITE
setEnableSeatedOffsetsRecenter NOTIFY setEnableSeatedOffsetsRecenter NOTIFY
enableSeatedOffsetsRecenterChanged ) enableSeatedOffsetsRecenterChanged )
Q_PROPERTY( bool disableSeatedMotion READ disableSeatedMotion WRITE Q_PROPERTY( bool enableSeatedMotion READ enableSeatedMotion WRITE
setDisableSeatedMotion NOTIFY disableSeatedMotionChanged ) setEnableSeatedMotion NOTIFY enableSeatedMotionChanged )
private: private:
OverlayController* parent; OverlayController* parent;
@@ -186,7 +186,7 @@ private:
bool m_oldStyleMotion = false; bool m_oldStyleMotion = false;
bool m_universeCenteredRotation = false; bool m_universeCenteredRotation = false;
bool m_enableSeatedOffsetsRecenter = false; bool m_enableSeatedOffsetsRecenter = false;
bool m_disableSeatedMotion = false; bool m_enableSeatedMotion = false;
unsigned settingsUpdateCounter = 0; unsigned settingsUpdateCounter = 0;
int m_hmdRotationStatsUpdateCounter = 0; int m_hmdRotationStatsUpdateCounter = 0;
unsigned m_dragComfortFrameSkipCounter = 0; unsigned m_dragComfortFrameSkipCounter = 0;
@@ -258,7 +258,7 @@ public:
bool oldStyleMotion() const; bool oldStyleMotion() const;
bool universeCenteredRotation() const; bool universeCenteredRotation() const;
bool enableSeatedOffsetsRecenter() const; bool enableSeatedOffsetsRecenter() const;
bool disableSeatedMotion() const; bool enableSeatedMotion() const;
bool isInitComplete() const; bool isInitComplete() const;
double getHmdYawTotal(); double getHmdYawTotal();
void resetHmdYawTotal(); void resetHmdYawTotal();
@@ -333,7 +333,7 @@ public slots:
void setOldStyleMotion( bool value, bool notify = true ); void setOldStyleMotion( bool value, bool notify = true );
void setUniverseCenteredRotation( bool value, bool notify = true ); void setUniverseCenteredRotation( bool value, bool notify = true );
void setEnableSeatedOffsetsRecenter( bool value, bool notify = true ); void setEnableSeatedOffsetsRecenter( bool value, bool notify = true );
void setDisableSeatedMotion( bool value, bool notify = true ); void setEnableSeatedMotion( bool value, bool notify = true );
void shutdown(); void shutdown();
void reset(); void reset();
@@ -377,7 +377,7 @@ signals:
void oldStyleMotionChanged( bool value ); void oldStyleMotionChanged( bool value );
void universeCenteredRotationChanged( bool value ); void universeCenteredRotationChanged( bool value );
void enableSeatedOffsetsRecenterChanged( bool value ); void enableSeatedOffsetsRecenterChanged( bool value );
void disableSeatedMotionChanged( bool value ); void enableSeatedMotionChanged( bool value );
void offsetProfilesUpdated(); void offsetProfilesUpdated();
}; };