Exclusive Input + Documentation Changes (#514)
* added input block code * added exclusive Input action * test ready exclusive * working test state * clean-up and add setting * removed auto saved file * added code to set required key * fixed qml connection issues * updated readme * updated documentation * updated version string * updated for better directory navigation * removed un-used code
This commit is contained in:
+89
-32
@@ -429,8 +429,9 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
|
||||
<< thumbiconFilename << "\"";
|
||||
}
|
||||
|
||||
// Too many render calls in too short time overwhelm Qt and an assertion
|
||||
// gets thrown. Therefore we use an timer to delay render calls
|
||||
// Too many render calls in too short time overwhelm Qt and an
|
||||
// assertion gets thrown. Therefore we use an timer to delay render
|
||||
// calls
|
||||
m_pRenderTimer.reset( new QTimer() );
|
||||
m_pRenderTimer->setSingleShot( true );
|
||||
m_pRenderTimer->setInterval( 5 );
|
||||
@@ -520,8 +521,8 @@ void OverlayController::renderOverlay()
|
||||
if ( unTexture != 0 )
|
||||
{
|
||||
#if defined _WIN64 || defined _LP64
|
||||
// To avoid any compiler warning because of cast to a larger pointer
|
||||
// type (warning C4312 on VC)
|
||||
// To avoid any compiler warning because of cast to a larger
|
||||
// pointer type (warning C4312 on VC)
|
||||
vr::Texture_t texture = { reinterpret_cast<void*>(
|
||||
static_cast<uint64_t>( unTexture ) ),
|
||||
vr::TextureType_OpenGL,
|
||||
@@ -584,9 +585,9 @@ void OverlayController::processMediaKeyBindings()
|
||||
|
||||
void OverlayController::processMotionBindings()
|
||||
{
|
||||
// Execution order for moveCenterTabController actions is important. Don't
|
||||
// reorder these. Override actions must always come after normal because
|
||||
// active priority is set based on which action is "newest"
|
||||
// Execution order for moveCenterTabController actions is important.
|
||||
// Don't reorder these. Override actions must always come after normal
|
||||
// because active priority is set based on which action is "newest"
|
||||
// normal actions:
|
||||
m_moveCenterTabController.leftHandSpaceDrag(
|
||||
m_actions.leftHandSpaceDrag() );
|
||||
@@ -653,8 +654,8 @@ void OverlayController::processPushToTalkBindings()
|
||||
m_audioTabController.setMicMuted( true );
|
||||
return;
|
||||
}
|
||||
// strictly speaking this is not the most elegant solution, but should
|
||||
// work well enough.
|
||||
// strictly speaking this is not the most elegant solution, but
|
||||
// should work well enough.
|
||||
else if ( !pushToTalkEnabled )
|
||||
{
|
||||
m_audioTabController.setMicMuted( false );
|
||||
@@ -736,6 +737,17 @@ void OverlayController::processKeyboardBindings()
|
||||
m_keyPressTwoState = false;
|
||||
}
|
||||
}
|
||||
|
||||
void OverlayController::processExclusiveInputBinding()
|
||||
{
|
||||
if ( m_actions.exclusiveInputToggle() && exclusiveInputEnabled() )
|
||||
{
|
||||
m_exclusiveState = !m_exclusiveState;
|
||||
m_actions.systemActionSetOnlyEnabled( !m_exclusiveState );
|
||||
m_actions.actionSetPriorityToggle( m_exclusiveState );
|
||||
}
|
||||
}
|
||||
|
||||
void OverlayController::processRotationBindings()
|
||||
{
|
||||
if ( m_actions.autoTurnToggle() )
|
||||
@@ -745,11 +757,13 @@ void OverlayController::processRotationBindings()
|
||||
}
|
||||
}
|
||||
/*!
|
||||
Checks if an action has been activated and dispatches the related action if it
|
||||
has been.
|
||||
Checks if an action has been activated and dispatches the related action if
|
||||
it has been.
|
||||
*/
|
||||
void OverlayController::processInputBindings()
|
||||
{
|
||||
processExclusiveInputBinding();
|
||||
|
||||
processMediaKeyBindings();
|
||||
|
||||
processMotionBindings();
|
||||
@@ -763,6 +777,47 @@ void OverlayController::processInputBindings()
|
||||
processRotationBindings();
|
||||
}
|
||||
|
||||
bool OverlayController::exclusiveInputEnabled() const
|
||||
{
|
||||
return settings::getSetting(
|
||||
settings::BoolSetting::APPLICATION_enableExclusiveInput );
|
||||
}
|
||||
|
||||
void OverlayController::setExclusiveInputEnabled( bool value, bool notify )
|
||||
{
|
||||
settings::setSetting(
|
||||
settings::BoolSetting::APPLICATION_enableExclusiveInput, value );
|
||||
// Note: These Calls technically modify data that could be accessed
|
||||
// elsewhere and cause threading issues. Since this should only be
|
||||
// accessible in dashboard, and input is disabled while dashboard is up,
|
||||
// there should be no reason to lock it. If it becomes an issue this needs
|
||||
// to be locked with a mutex or similiar against the
|
||||
// processexclusivebindings
|
||||
if ( value )
|
||||
{
|
||||
// Re-Enable Required SteamVR key every toggle just in case.
|
||||
ovr_settings_wrapper::setBool(
|
||||
vr::k_pch_SteamVR_Section,
|
||||
vr::k_pch_SteamVR_AllowGlobalActionSetPriority,
|
||||
value );
|
||||
|
||||
// To setup Exclusive Input OVRAS actions should be off besides System
|
||||
// (+haptics) which are always on.
|
||||
m_actions.systemActionSetOnlyEnabled( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Enable All Action Sets
|
||||
m_actions.systemActionSetOnlyEnabled( false );
|
||||
// Remove All priority
|
||||
m_actions.actionSetPriorityToggle( false );
|
||||
}
|
||||
if ( notify )
|
||||
{
|
||||
emit exclusiveInputEnabledChanged( value );
|
||||
}
|
||||
}
|
||||
|
||||
bool OverlayController::crashRecoveryDisabled() const
|
||||
{
|
||||
return settings::getSetting(
|
||||
@@ -908,8 +963,8 @@ void OverlayController::setCustomTickRateMs( int value, bool notify )
|
||||
|
||||
// vsync implementation:
|
||||
// this function triggers every 1ms
|
||||
// this function should remain lightweight and only check if it's time to run
|
||||
// mainEventLoop() or not.
|
||||
// this function should remain lightweight and only check if it's time to
|
||||
// run mainEventLoop() or not.
|
||||
void OverlayController::OnTimeoutPumpEvents()
|
||||
{
|
||||
if ( vsyncDisabled() )
|
||||
@@ -937,21 +992,22 @@ void OverlayController::OnTimeoutPumpEvents()
|
||||
if ( m_currentFrame > m_lastFrame )
|
||||
{
|
||||
// If the frame has advanced since last check, it's time for our
|
||||
// main event loop. (this function should trigger about every 11ms
|
||||
// assuming 90fps compositor)
|
||||
// main event loop. (this function should trigger about every
|
||||
// 11ms assuming 90fps compositor)
|
||||
mainEventLoop();
|
||||
updateRate.incrementCounter();
|
||||
|
||||
// wait for the next frame after executing our main event loop once.
|
||||
// wait for the next frame after executing our main event loop
|
||||
// once.
|
||||
m_lastFrame = m_currentFrame;
|
||||
m_vsyncTooLateCounter = 0;
|
||||
}
|
||||
else if ( m_vsyncTooLateCounter >= k_nonVsyncTickRate )
|
||||
{
|
||||
mainEventLoop();
|
||||
// m_lastFrame = m_currentFrame + 1 skips the next vsync frame in
|
||||
// case it was just about to trigger, to prevent double updates
|
||||
// faster than 11ms.
|
||||
// m_lastFrame = m_currentFrame + 1 skips the next vsync frame
|
||||
// in case it was just about to trigger, to prevent double
|
||||
// updates faster than 11ms.
|
||||
m_lastFrame = m_currentFrame + 1;
|
||||
m_vsyncTooLateCounter = 0;
|
||||
}
|
||||
@@ -1352,11 +1408,12 @@ void OverlayController::AddOffsetToCollisionBounds( unsigned axisId,
|
||||
void OverlayController::AddOffsetToCollisionBounds( float offset[3],
|
||||
bool commit )
|
||||
{
|
||||
// Apparently Valve sanity-checks the y-coordinates of the collision bounds
|
||||
// (and only the y-coordinates) I can move the bounds on the xz-plane, I can
|
||||
// make the "ceiling" of the chaperone cage lower/higher, but when I dare to
|
||||
// set one single lower corner to something non-zero, every corner gets its
|
||||
// y-coordinates reset to the defaults.
|
||||
// Apparently Valve sanity-checks the y-coordinates of the collision
|
||||
// bounds (and only the y-coordinates) I can move the bounds on the
|
||||
// xz-plane, I can make the "ceiling" of the chaperone cage
|
||||
// lower/higher, but when I dare to set one single lower corner to
|
||||
// something non-zero, every corner gets its y-coordinates reset to the
|
||||
// defaults.
|
||||
if ( commit )
|
||||
{
|
||||
vr::VRChaperoneSetup()->HideWorkingSetPreview();
|
||||
@@ -1377,10 +1434,10 @@ void OverlayController::AddOffsetToCollisionBounds( float offset[3],
|
||||
{
|
||||
collisionBounds[b].vCorners[c].v[0] += offset[0];
|
||||
|
||||
// keep the lower corners on the ground so it doesn't reset all
|
||||
// y cooridinates. this causes the caperone to "grow" up instead
|
||||
// of not moving up at all. note that Valve still forces a
|
||||
// minimum height so we can't go into the ground
|
||||
// keep the lower corners on the ground so it doesn't reset
|
||||
// all y cooridinates. this causes the caperone to "grow" up
|
||||
// instead of not moving up at all. note that Valve still
|
||||
// forces a minimum height so we can't go into the ground
|
||||
if ( collisionBounds[b].vCorners[c].v[1] != 0 )
|
||||
{
|
||||
collisionBounds[b].vCorners[c].v[1] += offset[1];
|
||||
@@ -1563,8 +1620,8 @@ void OverlayController::OnNetworkReply( QNetworkReply* reply )
|
||||
.toString();
|
||||
|
||||
// this is a little convoluted to ensure if our local version is
|
||||
// somehow higher than remote, it doesn't detect an update from just
|
||||
// higher remote "minor" or "patch" values.
|
||||
// somehow higher than remote, it doesn't detect an update from
|
||||
// just higher remote "minor" or "patch" values.
|
||||
if ( ( m_remoteVersionMajor > m_localVersionMajor )
|
||||
|| ( m_remoteVersionMajor == m_localVersionMajor
|
||||
&& m_remoteVersionMinor > m_localVersionMinor )
|
||||
@@ -1598,8 +1655,8 @@ void OverlayController::OnNetworkReply( QNetworkReply* reply )
|
||||
setVersionCheckText( m_optionalMessage );
|
||||
}
|
||||
setNewVersionDetected( false );
|
||||
LOG( INFO )
|
||||
<< "Version Check: Installed version is latest release.";
|
||||
LOG( INFO ) << "Version Check: Installed version is latest "
|
||||
"release.";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user