Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.4.0 Raw Restriction Setting, Apply Offsets #577

Merged
merged 17 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ Override actions will take priority over non-override actions during simultaneou
| Gravity Toggle | Binary/Button | Toggles Gravity state when pressed. |
| Gravity Reverse | Binary/Button | Temporarily Reverses Gravity while held. |
| Reset Offsets | Binary/Button | Resets your offset and rotation to 0. |
| Apply Offsets | Binary/Button | Recalibrates center/rotation from offsets |
| Height Toggle | Binary/Button | Shifts the gravity floor level by offset configured in motion tab. If gravity is inactive: also shifts the user's current y-axis position by offset configured in motion tab. |
| Snap-Turn Left | Binary/Button | Rotates a set value to the left based on settings in motion tab. |
| Snap-Turn Right | Binary/Button | Rotates a set value to the right based on settings in motion tab. |
Expand Down
2 changes: 1 addition & 1 deletion build_scripts/compile_version_string.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.3.2-release
5.4.0-release
6 changes: 6 additions & 0 deletions src/openvr/ivrinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ SteamIVRInput::SteamIVRInput()
m_gravityReverse( action_keys::gravityReverse ),
m_heightToggle( action_keys::heightToggle ),
m_resetOffsets( action_keys::resetOffsets ),
m_applyOffsets( action_keys::applyOffsets ),
m_snapTurnLeft( action_keys::snapTurnLeft ),
m_snapTurnRight( action_keys::snapTurnRight ),
m_smoothTurnLeft( action_keys::smoothTurnLeft ),
Expand Down Expand Up @@ -277,6 +278,11 @@ bool SteamIVRInput::resetOffsets()
return isDigitalActionActivatedOnce( m_resetOffsets );
}

bool SteamIVRInput::applyOffsets()
{
return isDigitalActionActivatedOnce( m_applyOffsets );
}

bool SteamIVRInput::snapTurnLeft()
{
return isDigitalActionActivatedOnce( m_snapTurnLeft );
Expand Down
3 changes: 3 additions & 0 deletions src/openvr/ivrinput.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace action_keys
constexpr auto gravityToggle = "/actions/motion/in/GravityToggle";
constexpr auto gravityReverse = "/actions/motion/in/GravityReverse";
constexpr auto resetOffsets = "/actions/motion/in/ResetOffsets";
constexpr auto applyOffsets = "/actions/motion/in/ApplyOffsets";
constexpr auto heightToggle = "/actions/motion/in/HeightToggle";
constexpr auto snapTurnLeft = "/actions/motion/in/SnapTurnLeft";
constexpr auto snapTurnRight = "/actions/motion/in/SnapTurnRight";
Expand Down Expand Up @@ -146,6 +147,7 @@ class SteamIVRInput
bool gravityReverse();
bool heightToggle();
bool resetOffsets();
bool applyOffsets();
bool snapTurnLeft();
bool snapTurnRight();
bool smoothTurnLeft();
Expand Down Expand Up @@ -228,6 +230,7 @@ class SteamIVRInput
DigitalAction m_gravityReverse;
DigitalAction m_heightToggle;
DigitalAction m_resetOffsets;
DigitalAction m_applyOffsets;
DigitalAction m_snapTurnLeft;
DigitalAction m_snapTurnRight;
DigitalAction m_smoothTurnLeft;
Expand Down
5 changes: 3 additions & 2 deletions src/overlaycontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ void OverlayController::processMotionBindings()
m_actions.gravityReverse() );
m_moveCenterTabController.heightToggleAction( m_actions.heightToggle() );
m_moveCenterTabController.resetOffsets( m_actions.resetOffsets() );
m_moveCenterTabController.applyOffsets( m_actions.applyOffsets() );
m_moveCenterTabController.snapTurnLeft( m_actions.snapTurnLeft() );
m_moveCenterTabController.snapTurnRight( m_actions.snapTurnRight() );
m_moveCenterTabController.smoothTurnLeft( m_actions.smoothTurnLeft() );
Expand Down Expand Up @@ -821,13 +822,13 @@ void OverlayController::setExclusiveInputEnabled( bool value, bool notify )
bool OverlayController::crashRecoveryDisabled() const
{
return settings::getSetting(
settings::BoolSetting::APPLICATION_crashRecoveryDisabled );
settings::BoolSetting::APPLICATION_crashRecoveryDisabled2 );
}

void OverlayController::setCrashRecoveryDisabled( bool value, bool notify )
{
settings::setSetting(
settings::BoolSetting::APPLICATION_crashRecoveryDisabled, value );
settings::BoolSetting::APPLICATION_crashRecoveryDisabled2, value );
if ( notify )
{
emit crashRecoveryDisabledChanged( value );
Expand Down
8 changes: 7 additions & 1 deletion src/package_files/action_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@
"requirement": "optional",
"type": "boolean"
},

{
"name": "/actions/motion/in/ApplyOffsets",
"requirement": "optional",
"type": "boolean"
},

{

"name": "/actions/motion/in/HeightToggle",
Expand Down Expand Up @@ -282,6 +287,7 @@
"/actions/motion/in/GravityToggle" : "Gravity Toggle",
"/actions/motion/in/GravityReverse" : "Gravity Reverse",
"/actions/motion/in/ResetOffsets" : "Reset Offsets",
"/actions/motion/in/ApplyOffsets" : "Apply Offsets",
"/actions/motion/in/HeightToggle" : "Height Toggle",
"/actions/motion/in/SnapTurnLeft" : "Snap-Turn Left",
"/actions/motion/in/SnapTurnRight" : "Snap-Turn Right",
Expand Down
12 changes: 12 additions & 0 deletions src/res/qml/SettingsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ MyStackViewPage {
}
}

MyToggleButton {
id: enableUnccalMotionToggle
text: "Enable Motion Features When in Uncalibrated Mode (Experimental)"
onCheckedChanged: {
MoveCenterTabController.setEnableUncalMotion(checked, true);
}
}

MyToggleButton {
id: disableCrashRecoveryToggle
text: "Disable Automatic Crash Recovery of Chaperone Config"
Expand Down Expand Up @@ -251,6 +259,7 @@ MyStackViewPage {
oldStyleMotionToggle.checked = MoveCenterTabController.oldStyleMotion
universeCenteredRotationToggle.checked = MoveCenterTabController.universeCenteredRotation
enableSeatedMotionToggle.checked = MoveCenterTabController.enableSeatedMotion
enableUnccalMotionToggle.checked = MoveCenterTabController.enableUncalMotion

disableCrashRecoveryToggle.checked = OverlayController.crashRecoveryDisabled
customTickRateText.text = OverlayController.customTickRateMs
Expand Down Expand Up @@ -299,6 +308,9 @@ MyStackViewPage {
enableSeatedMotionToggle.checked = MoveCenterTabController.enableSeatedMotion
seatedOldExternalWarning.visible = MoveCenterTabController.allowExternalEdits && MoveCenterTabController.oldStyleMotion && MoveCenterTabController.enableSeatedMotion
}
onEnableUncalMotionChanged: {
enableUnccalMotionToggle.checked = MoveCenterTabController.enableUncalMotion
}
onAdjustChaperoneChanged: {
spaceAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone
}
Expand Down
8 changes: 8 additions & 0 deletions src/settings/internal/settings_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ class SettingsController
SettingCategory::Playspace,
QtInfo{ "adjustChaperone2" },
false },
BoolSettingValue{ BoolSetting::PLAYSPACE_enableUncalMotion,
SettingCategory::Playspace,
QtInfo{ "enableUncalMotion" },
false },

BoolSettingValue{ BoolSetting::APPLICATION_disableVersionCheck,
SettingCategory::Application,
Expand All @@ -306,6 +310,10 @@ class SettingsController
SettingCategory::Application,
QtInfo{ "enableExclusiveInput" },
false },
BoolSettingValue{ BoolSetting::APPLICATION_crashRecoveryDisabled2,
SettingCategory::Application,
QtInfo{ "crashRecoveryDisabled2" },
true },
BoolSettingValue{ BoolSetting::AUDIO_pttEnabled,
SettingCategory::Audio,
QtInfo{ "pttEnabled" },
Expand Down
2 changes: 2 additions & 0 deletions src/settings/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ enum class BoolSetting
PLAYSPACE_showLogMatricesButton,
PLAYSPACE_simpleRecenter,
PLAYSPACE_adjustChaperone2,
PLAYSPACE_enableUncalMotion,

APPLICATION_disableVersionCheck,
APPLICATION_previousShutdownSafe,
APPLICATION_vsyncDisabled,
APPLICATION_crashRecoveryDisabled,
APPLICATION_enableDebug,
APPLICATION_enableExclusiveInput,
APPLICATION_crashRecoveryDisabled2,

AUDIO_pttEnabled,
AUDIO_pttShowNotification,
Expand Down
39 changes: 34 additions & 5 deletions src/tabcontrollers/MoveCenterTabController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,24 @@ void MoveCenterTabController::setEnableSeatedMotion( bool value, bool notify )

if ( notify )
{
emit enableSeatedMotionChanged( value );
emit enableUncalMotionChanged( value );
}
}

bool MoveCenterTabController::enableUncalMotion() const
{
return settings::getSetting(
settings::BoolSetting::PLAYSPACE_enableUncalMotion );
}

void MoveCenterTabController::setEnableUncalMotion( bool value, bool notify )
{
settings::setSetting( settings::BoolSetting::PLAYSPACE_enableUncalMotion,
value );

if ( notify )
{
emit enableUncalMotionChanged( value );
}
}

Expand Down Expand Up @@ -976,7 +993,7 @@ void MoveCenterTabController::incomingSeatedReset()

void MoveCenterTabController::reset()
{
if ( !m_chaperoneBasisAcquired )
if ( !m_chaperoneBasisAcquired && !enableUncalMotion() )
{
LOG( WARNING ) << "WARNING: Attempted reset offsets before chaperone "
"basis is acquired!";
Expand Down Expand Up @@ -1115,7 +1132,8 @@ void MoveCenterTabController::zeroOffsets()

// finished checking if out of bounds, proceed with normal zeroing offsets
if ( vr::VRChaperone()->GetCalibrationState()
== vr::ChaperoneCalibrationState_OK )
== vr::ChaperoneCalibrationState_OK
|| enableUncalMotion() )
{
m_oldOffsetX = 0.0f;
m_oldOffsetY = 0.0f;
Expand All @@ -1131,7 +1149,7 @@ void MoveCenterTabController::zeroOffsets()
emit rotationChanged( m_rotation );
updateChaperoneResetData();
m_pendingZeroOffsets = false;
if ( !m_chaperoneBasisAcquired )
if ( !m_chaperoneBasisAcquired && !enableUncalMotion() )
{
m_chaperoneBasisAcquired = true;
if ( !m_initComplete )
Expand Down Expand Up @@ -1962,6 +1980,14 @@ void MoveCenterTabController::resetOffsets( bool resetOffsetsJustPressed )
}
}

void MoveCenterTabController::applyOffsets( bool applyOffsetsJustPressed )
{
if ( applyOffsetsJustPressed )
{
zeroOffsets();
}
}

void MoveCenterTabController::snapTurnLeft( bool snapTurnLeftJustPressed )
{
if ( !snapTurnLeftJustPressed )
Expand Down Expand Up @@ -2933,6 +2959,7 @@ void MoveCenterTabController::eventLoopTick(
vr::VRChaperoneSetup()->RevertWorkingCopy();
}
setTrackingUniverse( int( universe ) );
// TODO set to allow.
return;
}

Expand All @@ -2958,7 +2985,9 @@ void MoveCenterTabController::eventLoopTick(
// if we were in room setup, but got this far in the loop, universe is no
// longer raw mode and we detect room setup exit and zeroOffsets() to apply
// new setup.
if ( m_pendingZeroOffsets || m_roomSetupModeDetected )

if ( m_pendingZeroOffsets
|| ( m_roomSetupModeDetected && !enableUncalMotion() ) )
{
zeroOffsets();
// m_roomSetupModeDetected is set to false in zeroOffsets() if it's
Expand Down
6 changes: 6 additions & 0 deletions src/tabcontrollers/MoveCenterTabController.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class MoveCenterTabController : public QObject
setEnableSeatedMotion NOTIFY enableSeatedMotionChanged )
Q_PROPERTY( bool simpleRecenter READ simpleRecenter WRITE setSimpleRecenter
NOTIFY simpleRecenterChanged )
Q_PROPERTY( bool enableUncalMotion READ enableUncalMotion WRITE
setEnableUncalMotion NOTIFY enableUncalMotionChanged )

private:
OverlayController* parent;
Expand Down Expand Up @@ -276,6 +278,7 @@ class MoveCenterTabController : public QObject
bool oldStyleMotion() const;
bool universeCenteredRotation() const;
bool enableSeatedMotion() const;
bool enableUncalMotion() const;
bool simpleRecenter() const;
bool isInitComplete() const;
double getHmdYawTotal();
Expand Down Expand Up @@ -306,6 +309,7 @@ class MoveCenterTabController : public QObject
void gravityReverseAction( bool gravityReverseHeld );
void heightToggleAction( bool heightToggleJustPressed );
void resetOffsets( bool resetOffsetsJustPressed );
void applyOffsets( bool applyOffsetsJustPressed );
void snapTurnLeft( bool snapTurnLeftJustPressed );
void snapTurnRight( bool snapTurnRightJustPressed );
void smoothTurnLeft( bool smoothTurnLeftActive );
Expand Down Expand Up @@ -356,6 +360,7 @@ public slots:
void setOldStyleMotion( bool value, bool notify = true );
void setUniverseCenteredRotation( bool value, bool notify = true );
void setEnableSeatedMotion( bool value, bool notify = true );
void setEnableUncalMotion( bool value, bool notify = true );
void setSimpleRecenter( bool value, bool notify = true );

void shutdown();
Expand Down Expand Up @@ -403,6 +408,7 @@ public slots:
void universeCenteredRotationChanged( bool value );
void enableSeatedMotionChanged( bool value );
void simpleRecenterChanged( bool value );
void enableUncalMotionChanged( bool value );

void offsetProfilesUpdated();
};
Expand Down