Settings Tab new options for seated motion and recentering

This commit is contained in:
Kung-vr
2019-10-02 12:40:01 +09:00
parent b4dbbe8857
commit d3b4d30807
5 changed files with 214 additions and 9 deletions
+45
View File
@@ -25,6 +25,17 @@ MyStackViewPage {
Layout.fillWidth: true
}
MyText {
text: "(Disabled in 'Seated' Universe Type)"
id: seatedWarningText
visible: false
wrapMode: Text.WordWrap
font.pointSize: 28
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Layout.fillWidth: true
}
Item {
Layout.fillHeight: true
Layout.fillWidth: true
@@ -94,6 +105,14 @@ MyStackViewPage {
statusMessageText.text = ""
//undoFixButton.enabled = FixFloorTabController.canUndo
fixButton.enabled = true
if (MoveCenterTabController.trackingUniverse === 0) {
fixButton.enabled = false
recenterButton.enabled = false
zeroSpaceButton.enabled = false
undoFixButton.enabled = false
seatedWarningText.visible = true
}
}
Timer {
@@ -129,6 +148,32 @@ MyStackViewPage {
}
}
Connections {
target: MoveCenterTabController
onTrackingUniverseChanged: {
if (MoveCenterTabController.trackingUniverse === 0) {
fixButton.enabled = false
recenterButton.enabled = false
zeroSpaceButton.enabled = false
undoFixButton.enabled = false
seatedWarningText.visible = true
} else if (MoveCenterTabController.trackingUniverse === 1) {
fixButton.enabled = true
recenterButton.enabled = true
zeroSpaceButton.enabled = true
// undoFixButton.enabled = true
// TODO Fix Undo Feature -^
seatedWarningText.visible = false
} else {
fixButton.enabled = false
recenterButton.enabled = false
zeroSpaceButton.enabled = false
undoFixButton.enabled = false
seatedWarningText.visible = false
}
}
}
}
}
+47
View File
@@ -23,8 +23,16 @@ MyStackViewPage {
}
}
MyText {
id: seatedDisableWarningText
visible: false
text: "Settings Tab: 'Disable Motion in Seated Mode' checked"
}
GroupBox {
Layout.fillWidth: true
id: offsetsGroupBox
visible: true
label: MyText {
leftPadding: 10
@@ -220,6 +228,8 @@ MyStackViewPage {
GroupBox {
Layout.fillWidth: true
id: rotationGroupBox
visible: true
label: MyText {
leftPadding: 10
@@ -322,6 +332,8 @@ MyStackViewPage {
ColumnLayout {
RowLayout {
Layout.fillWidth: true
id: resetButtonRow
visible: true
MyPushButton {
id: spaceResetButton
@@ -385,11 +397,24 @@ MyStackViewPage {
if (MoveCenterTabController.trackingUniverse === 0) {
spaceModeText.text = "Sitting"
spaceSeatedRecenter.visible = true
offsetsGroupBox.visible = !MoveCenterTabController.disableSeatedMotion
rotationGroupBox.visible = !MoveCenterTabController.disableSeatedMotion
resetButtonRow.visible = !MoveCenterTabController.disableSeatedMotion
seatedDisableWarningText.visible = MoveCenterTabController.disableSeatedMotion
} else if (MoveCenterTabController.trackingUniverse === 1) {
spaceModeText.text = "Standing"
spaceSeatedRecenter.visible = false
offsetsGroupBox.visible = true
rotationGroupBox.visible = true
resetButtonRow.visible = true
seatedDisableWarningText.visible = false
} else {
spaceModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")"
offsetsGroupBox.visible = false
rotationGroupBox.visible = false
resetButtonRow.visible = false
seatedDisableWarningText.visible = false
}
}
@@ -423,15 +448,37 @@ MyStackViewPage {
onLockZToggleChanged: {
lockZToggle.checked = MoveCenterTabController.lockZToggle
}
onDisableSeatedMotionChanged: {
if (MoveCenterTabController.trackingUniverse === 0) {
spaceModeText.text = "Sitting"
spaceSeatedRecenter.visible = true
offsetsGroupBox.visible = !MoveCenterTabController.disableSeatedMotion
rotationGroupBox.visible = !MoveCenterTabController.disableSeatedMotion
resetButtonRow.visible = !MoveCenterTabController.disableSeatedMotion
seatedDisableWarningText.visible = MoveCenterTabController.disableSeatedMotion
}
}
onTrackingUniverseChanged: {
if (MoveCenterTabController.trackingUniverse === 0) {
spaceModeText.text = "Sitting"
spaceSeatedRecenter.visible = true
offsetsGroupBox.visible = !MoveCenterTabController.disableSeatedMotion
rotationGroupBox.visible = !MoveCenterTabController.disableSeatedMotion
resetButtonRow.visible = !MoveCenterTabController.disableSeatedMotion
seatedDisableWarningText.visible = MoveCenterTabController.disableSeatedMotion
} else if (MoveCenterTabController.trackingUniverse === 1) {
spaceModeText.text = "Standing"
spaceSeatedRecenter.visible = false
offsetsGroupBox.visible = true
rotationGroupBox.visible = true
resetButtonRow.visible = true
seatedDisableWarningText.visible = false
} else {
spaceModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")"
offsetsGroupBox.visible = false
rotationGroupBox.visible = false
resetButtonRow.visible = false
seatedDisableWarningText.visible = false
}
}
}
+24
View File
@@ -42,6 +42,22 @@ MyStackViewPage {
}
}
MyToggleButton {
id: enableSeatedOffsetsRecenterToggle
text: "Enable Auto-set Seated Offsets During Seated Recenter"
onCheckedChanged: {
MoveCenterTabController.setEnableSeatedOffsetsRecenter(checked, true)
}
}
MyToggleButton {
id: disableSeatedMotionToggle
text: "Disable All Motion Features When in Seated Mode"
onCheckedChanged: {
MoveCenterTabController.setDisableSeatedMotion(checked, true)
}
}
RowLayout {
Layout.fillWidth: true
@@ -107,6 +123,8 @@ MyStackViewPage {
allowExternalEditsToggle.checked = MoveCenterTabController.allowExternalEdits
oldStyleMotionToggle.checked = MoveCenterTabController.oldStyleMotion
universeCenteredRotationToggle.checked = MoveCenterTabController.universeCenteredRotation
enableSeatedOffsetsRecenterToggle.checked = MoveCenterTabController.enableSeatedOffsetsRecenter
disableSeatedMotionToggle.checked = MoveCenterTabController.disableSeatedMotion
customTickRateText.text = OverlayController.customTickRateMs
vsyncDisabledToggle.checked = OverlayController.vsyncDisabled
@@ -133,6 +151,12 @@ MyStackViewPage {
onUniverseCenteredRotationChanged: {
universeCenteredRotationToggle.checked = MoveCenterTabController.universeCenteredRotation
}
onEnableSeatedOffsetsRecenterChanged: {
enableSeatedOffsetsRecenterToggle.checked = MoveCenterTabController.enableSeatedOffsetsRecenter
}
onDisableSeatedMotionChanged: {
disableSeatedMotionToggle.checked = MoveCenterTabController.disableSeatedMotion
}
}
Connections {
+84 -9
View File
@@ -153,6 +153,17 @@ void MoveCenterTabController::initStage1()
{
m_universeCenteredRotation = value.toBool();
}
value = settings->value( "enableSeatedOffsetsRecenter",
m_enableSeatedOffsetsRecenter );
if ( value.isValid() && !value.isNull() )
{
m_enableSeatedOffsetsRecenter = value.toBool();
}
value = settings->value( "disableSeatedMotion", m_disableSeatedMotion );
if ( value.isValid() && !value.isNull() )
{
m_disableSeatedMotion = value.toBool();
}
settings->endGroup();
m_lastDragUpdateTimePoint = std::chrono::steady_clock::now();
m_lastGravityUpdateTimePoint = std::chrono::steady_clock::now();
@@ -221,6 +232,14 @@ void MoveCenterTabController::outputLogSettings()
{
LOG( INFO ) << "LOADED SETTINGS: Universe-Centered Rotation Enabled";
}
if ( m_enableSeatedOffsetsRecenter )
{
LOG( INFO ) << "LOADED SETTINGS: Seated Offsets Recenter Enabled";
}
if ( m_disableSeatedMotion )
{
LOG( INFO ) << "LOADED SETTINGS: Seated Motion Disabled";
}
if ( m_dragBounds )
{
LOG( INFO ) << "LOADED SETTINGS: Space Drag Force Bounds Enabled";
@@ -1051,6 +1070,51 @@ void MoveCenterTabController::setUniverseCenteredRotation( bool value,
<< m_universeCenteredRotation;
}
bool MoveCenterTabController::enableSeatedOffsetsRecenter() const
{
return m_enableSeatedOffsetsRecenter;
}
void MoveCenterTabController::setEnableSeatedOffsetsRecenter( bool value,
bool notify )
{
m_enableSeatedOffsetsRecenter = value;
auto settings = OverlayController::appSettings();
settings->beginGroup( "playspaceSettings" );
settings->setValue( "enableSeatedOffsetsRecenter",
m_enableSeatedOffsetsRecenter );
settings->endGroup();
settings->sync();
if ( notify )
{
emit enableSeatedOffsetsRecenterChanged(
m_enableSeatedOffsetsRecenter );
}
LOG( INFO ) << "CHANGED SETTINGS: Enable Seated Offsets Recenter Set: "
<< m_enableSeatedOffsetsRecenter;
}
bool MoveCenterTabController::disableSeatedMotion() const
{
return m_disableSeatedMotion;
}
void MoveCenterTabController::setDisableSeatedMotion( bool value, bool notify )
{
m_disableSeatedMotion = value;
auto settings = OverlayController::appSettings();
settings->beginGroup( "playspaceSettings" );
settings->setValue( "disableSeatedMotion", m_disableSeatedMotion );
settings->endGroup();
settings->sync();
if ( notify )
{
emit disableSeatedMotionChanged( m_disableSeatedMotion );
}
LOG( INFO ) << "CHANGED SETTINGS: Disable Seated Motion Set: "
<< m_disableSeatedMotion;
}
void MoveCenterTabController::modOffsetX( float value, bool notify )
{
if ( !m_lockXToggle )
@@ -1095,7 +1159,10 @@ void MoveCenterTabController::shutdown()
void MoveCenterTabController::incomingSeatedReset()
{
updateSeatedResetData();
if ( !m_disableSeatedMotion )
{
updateSeatedResetData();
}
}
void MoveCenterTabController::reset()
@@ -1299,14 +1366,18 @@ void MoveCenterTabController::updateSeatedResetData()
m_seatedHeight = hmdMatrix.m[1][3];
m_seatedCenterForReset.m[1][3] += m_seatedHeight;
m_offsetX = hmdMatrix.m[0][3];
m_offsetY = 0.0f;
m_offsetZ = hmdMatrix.m[2][3];
m_rotation = hmdYawCentideg;
emit offsetXChanged( m_offsetX );
emit offsetYChanged( m_offsetY );
emit offsetZChanged( m_offsetZ );
emit rotationChanged( m_rotation );
if ( m_enableSeatedOffsetsRecenter )
{
m_offsetX = hmdMatrix.m[0][3];
m_offsetY = 0.0f;
m_offsetZ = hmdMatrix.m[2][3];
m_rotation = hmdYawCentideg;
emit offsetXChanged( m_offsetX );
emit offsetYChanged( m_offsetY );
emit offsetZChanged( m_offsetZ );
emit rotationChanged( m_rotation );
}
unsigned checkQuadCount = 0;
vr::VRChaperoneSetup()->GetWorkingCollisionBoundsInfo( nullptr,
&checkQuadCount );
@@ -2810,6 +2881,10 @@ void MoveCenterTabController::eventLoopTick(
// m_roomSetupModeDetected is set to false in zeroOffsets() if it's
// successful.
}
else if ( m_seatedModeDetected && m_disableSeatedMotion )
{
return;
}
else
{
setTrackingUniverse( int( universe ) );
@@ -89,6 +89,12 @@ class MoveCenterTabController : public QObject
Q_PROPERTY(
bool universeCenteredRotation READ universeCenteredRotation WRITE
setUniverseCenteredRotation NOTIFY universeCenteredRotationChanged )
Q_PROPERTY(
bool enableSeatedOffsetsRecenter READ enableSeatedOffsetsRecenter WRITE
setEnableSeatedOffsetsRecenter NOTIFY
enableSeatedOffsetsRecenterChanged )
Q_PROPERTY( bool disableSeatedMotion READ disableSeatedMotion WRITE
setDisableSeatedMotion NOTIFY disableSeatedMotionChanged )
private:
OverlayController* parent;
@@ -170,6 +176,8 @@ private:
bool m_allowExternalEdits = false;
bool m_oldStyleMotion = false;
bool m_universeCenteredRotation = false;
bool m_enableSeatedOffsetsRecenter = false;
bool m_disableSeatedMotion = false;
unsigned settingsUpdateCounter = 0;
int m_hmdRotationStatsUpdateCounter = 0;
unsigned m_dragComfortFrameSkipCounter = 0;
@@ -238,6 +246,8 @@ public:
bool allowExternalEdits() const;
bool oldStyleMotion() const;
bool universeCenteredRotation() const;
bool enableSeatedOffsetsRecenter() const;
bool disableSeatedMotion() const;
double getHmdYawTotal();
void resetHmdYawTotal();
void incomingSeatedReset();
@@ -305,6 +315,8 @@ public slots:
void setAllowExternalEdits( bool value, bool notify = true );
void setOldStyleMotion( bool value, bool notify = true );
void setUniverseCenteredRotation( bool value, bool notify = true );
void setEnableSeatedOffsetsRecenter( bool value, bool notify = true );
void setDisableSeatedMotion( bool value, bool notify = true );
void shutdown();
void reset();
@@ -343,6 +355,8 @@ signals:
void allowExternalEditsChanged( bool value );
void oldStyleMotionChanged( bool value );
void universeCenteredRotationChanged( bool value );
void enableSeatedOffsetsRecenterChanged( bool value );
void disableSeatedMotionChanged( bool value );
};
} // namespace advsettings