From 1d058dffcf32b9705732676f5ff40f49d0d8db67 Mon Sep 17 00:00:00 2001 From: Kung-vr Date: Tue, 29 Jan 2019 01:11:47 +0900 Subject: [PATCH] Terminolgy Change: "Playspace" -> "Room" Valve's official terminology are "Room Setup" and "Tracking Universe". Changed our usage of "Playspace" to "Room" for clarity with the upcoming Room-Turn feature and existing Room-Drag feature when compared to nomenclature for other tools that exits out there. Also slight clean up in readability of movecentertab's action functions. --- src/ivrinput/ivrinput.cpp | 65 +- src/ivrinput/ivrinput.h | 66 +- src/overlaycontroller.cpp | 30 +- src/package_files/action_manifest.json | 66 +- src/res/qml/FixFloorPage.qml | 8 +- src/res/qml/PlayspacePage.qml | 136 ++-- src/res/qml/RootPage.qml | 4 +- src/tabcontrollers/FixFloorTabController.cpp | 2 +- .../MoveCenterTabController.cpp | 650 ++++++++---------- src/tabcontrollers/MoveCenterTabController.h | 52 +- .../StatisticsTabController.cpp | 5 +- 11 files changed, 472 insertions(+), 612 deletions(-) diff --git a/src/ivrinput/ivrinput.cpp b/src/ivrinput/ivrinput.cpp index 00896d5..d793dd3 100644 --- a/src/ivrinput/ivrinput.cpp +++ b/src/ivrinput/ivrinput.cpp @@ -130,26 +130,25 @@ SteamIVRInput::SteamIVRInput() m_pausePlayTrack( input_strings::k_actionPausePlayTrack, ActionType::Digital ), m_stopTrack( input_strings::k_actionStopTrack, ActionType::Digital ), - m_leftHandPlayspaceRotate( input_strings::k_actionLeftHandPlayspaceRotate, - ActionType::Digital ), - m_rightHandPlayspaceRotate( - input_strings::k_actionRightHandPlayspaceRotate, + m_leftHandRoomTurn( input_strings::k_actionLeftHandRoomTurn, + ActionType::Digital ), + m_rightHandRoomTurn( input_strings::k_actionRightHandRoomTurn, + ActionType::Digital ), + m_leftHandRoomDrag( input_strings::k_actionLeftHandRoomDrag, + ActionType::Digital ), + m_rightHandRoomDrag( input_strings::k_actionRightHandRoomDrag, + ActionType::Digital ), + m_optionalOverrideLeftHandRoomTurn( + input_strings::k_actionOptionalOverrideLeftHandRoomTurn, ActionType::Digital ), - m_leftHandPlayspaceMove( input_strings::k_actionLeftHandPlayspaceMove, - ActionType::Digital ), - m_rightHandPlayspaceMove( input_strings::k_actionRightHandPlayspaceMove, - ActionType::Digital ), - m_optionalOverrideLeftHandPlayspaceRotate( - input_strings::k_actionOptionalOverrideLeftHandPlayspaceRotate, + m_optionalOverrideRightHandRoomTurn( + input_strings::k_actionOptionalOverrideRightHandRoomTurn, ActionType::Digital ), - m_optionalOverrideRightHandPlayspaceRotate( - input_strings::k_actionOptionalOverrideRightHandPlayspaceRotate, + m_optionalOverrideLeftHandRoomDrag( + input_strings::k_actionOptionalOverrideLeftHandRoomDrag, ActionType::Digital ), - m_optionalOverrideLeftHandPlayspaceMove( - input_strings::k_actionOptionalOverrideLeftHandPlayspaceMove, - ActionType::Digital ), - m_optionalOverrideRightHandPlayspaceMove( - input_strings::k_actionOptionalOverrideRightHandPlayspaceMove, + m_optionalOverrideRightHandRoomDrag( + input_strings::k_actionOptionalOverrideRightHandRoomDrag, ActionType::Digital ) { m_activeActionSet.ulActionSet = m_mainSet.handle(); @@ -200,47 +199,47 @@ bool SteamIVRInput::stopSong() return isDigitalActionActivatedOnce( m_stopTrack ); } -bool SteamIVRInput::leftHandPlayspaceRotate() +bool SteamIVRInput::leftHandRoomTurn() { - return isDigitalActionActivatedConstant( m_leftHandPlayspaceRotate ); + return isDigitalActionActivatedConstant( m_leftHandRoomTurn ); } -bool SteamIVRInput::rightHandPlayspaceRotate() +bool SteamIVRInput::rightHandRoomTurn() { - return isDigitalActionActivatedConstant( m_rightHandPlayspaceRotate ); + return isDigitalActionActivatedConstant( m_rightHandRoomTurn ); } -bool SteamIVRInput::leftHandPlayspaceMove() +bool SteamIVRInput::leftHandRoomDrag() { - return isDigitalActionActivatedConstant( m_leftHandPlayspaceMove ); + return isDigitalActionActivatedConstant( m_leftHandRoomDrag ); } -bool SteamIVRInput::rightHandPlayspaceMove() +bool SteamIVRInput::rightHandRoomDrag() { - return isDigitalActionActivatedConstant( m_rightHandPlayspaceMove ); + return isDigitalActionActivatedConstant( m_rightHandRoomDrag ); } -bool SteamIVRInput::optionalOverrideLeftHandPlayspaceRotate() +bool SteamIVRInput::optionalOverrideLeftHandRoomTurn() { return isDigitalActionActivatedConstant( - m_optionalOverrideLeftHandPlayspaceRotate ); + m_optionalOverrideLeftHandRoomTurn ); } -bool SteamIVRInput::optionalOverrideRightHandPlayspaceRotate() +bool SteamIVRInput::optionalOverrideRightHandRoomTurn() { return isDigitalActionActivatedConstant( - m_optionalOverrideRightHandPlayspaceRotate ); + m_optionalOverrideRightHandRoomTurn ); } -bool SteamIVRInput::optionalOverrideLeftHandPlayspaceMove() +bool SteamIVRInput::optionalOverrideLeftHandRoomDrag() { return isDigitalActionActivatedConstant( - m_optionalOverrideLeftHandPlayspaceMove ); + m_optionalOverrideLeftHandRoomDrag ); } -bool SteamIVRInput::optionalOverrideRightHandPlayspaceMove() +bool SteamIVRInput::optionalOverrideRightHandRoomDrag() { return isDigitalActionActivatedConstant( - m_optionalOverrideRightHandPlayspaceMove ); + m_optionalOverrideRightHandRoomDrag ); } /*! diff --git a/src/ivrinput/ivrinput.h b/src/ivrinput/ivrinput.h index c12fa3d..d212a83 100644 --- a/src/ivrinput/ivrinput.h +++ b/src/ivrinput/ivrinput.h @@ -40,14 +40,14 @@ public: bool previousSong(); bool pausePlaySong(); bool stopSong(); - bool leftHandPlayspaceRotate(); - bool rightHandPlayspaceRotate(); - bool leftHandPlayspaceMove(); - bool rightHandPlayspaceMove(); - bool optionalOverrideLeftHandPlayspaceRotate(); - bool optionalOverrideRightHandPlayspaceRotate(); - bool optionalOverrideLeftHandPlayspaceMove(); - bool optionalOverrideRightHandPlayspaceMove(); + bool leftHandRoomTurn(); + bool rightHandRoomTurn(); + bool leftHandRoomDrag(); + bool rightHandRoomDrag(); + bool optionalOverrideLeftHandRoomTurn(); + bool optionalOverrideRightHandRoomTurn(); + bool optionalOverrideLeftHandRoomDrag(); + bool optionalOverrideRightHandRoomDrag(); // Destructor. There are no terminating calls for the IVRInput API, so it // is left blank. @@ -78,15 +78,15 @@ private: Action m_pausePlayTrack; Action m_stopTrack; - // Playspace bindings - Action m_leftHandPlayspaceRotate; - Action m_rightHandPlayspaceRotate; - Action m_leftHandPlayspaceMove; - Action m_rightHandPlayspaceMove; - Action m_optionalOverrideLeftHandPlayspaceRotate; - Action m_optionalOverrideRightHandPlayspaceRotate; - Action m_optionalOverrideLeftHandPlayspaceMove; - Action m_optionalOverrideRightHandPlayspaceMove; + // Room bindings + Action m_leftHandRoomTurn; + Action m_rightHandRoomTurn; + Action m_leftHandRoomDrag; + Action m_rightHandRoomDrag; + Action m_optionalOverrideLeftHandRoomTurn; + Action m_optionalOverrideRightHandRoomTurn; + Action m_optionalOverrideLeftHandRoomDrag; + Action m_optionalOverrideRightHandRoomDrag; }; /*! @@ -101,22 +101,22 @@ namespace input_strings constexpr auto k_actionPausePlayTrack = "/actions/main/in/PausePlayTrack"; constexpr auto k_actionStopTrack = "/actions/main/in/StopTrack"; - constexpr auto k_actionLeftHandPlayspaceRotate - = "/actions/main/in/LeftHandPlayspaceRotate"; - constexpr auto k_actionRightHandPlayspaceRotate - = "/actions/main/in/RightHandPlayspaceRotate"; - constexpr auto k_actionLeftHandPlayspaceMove - = "/actions/main/in/LeftHandPlayspaceMove"; - constexpr auto k_actionRightHandPlayspaceMove - = "/actions/main/in/RightHandPlayspaceMove"; - constexpr auto k_actionOptionalOverrideLeftHandPlayspaceRotate - = "/actions/main/in/OptionalOverrideLeftHandPlayspaceRotate"; - constexpr auto k_actionOptionalOverrideRightHandPlayspaceRotate - = "/actions/main/in/OptionalOverrideRightHandPlayspaceRotate"; - constexpr auto k_actionOptionalOverrideLeftHandPlayspaceMove - = "/actions/main/in/OptionalOverrideLeftHandPlayspaceMove"; - constexpr auto k_actionOptionalOverrideRightHandPlayspaceMove - = "/actions/main/in/OptionalOverrideRightHandPlayspaceMove"; + constexpr auto k_actionLeftHandRoomTurn + = "/actions/main/in/LeftHandRoomTurn"; + constexpr auto k_actionRightHandRoomTurn + = "/actions/main/in/RightHandRoomTurn"; + constexpr auto k_actionLeftHandRoomDrag + = "/actions/main/in/LeftHandRoomDrag"; + constexpr auto k_actionRightHandRoomDrag + = "/actions/main/in/RightHandRoomDrag"; + constexpr auto k_actionOptionalOverrideLeftHandRoomTurn + = "/actions/main/in/OptionalOverrideLeftHandRoomTurn"; + constexpr auto k_actionOptionalOverrideRightHandRoomTurn + = "/actions/main/in/OptionalOverrideRightHandRoomTurn"; + constexpr auto k_actionOptionalOverrideLeftHandRoomDrag + = "/actions/main/in/OptionalOverrideLeftHandRoomDrag"; + constexpr auto k_actionOptionalOverrideRightHandRoomDrag + = "/actions/main/in/OptionalOverrideRightHandRoomDrag"; constexpr auto k_setMain = "/actions/main"; diff --git a/src/overlaycontroller.cpp b/src/overlaycontroller.cpp index 053fced..dd46514 100644 --- a/src/overlaycontroller.cpp +++ b/src/overlaycontroller.cpp @@ -503,24 +503,22 @@ void OverlayController::processInputBindings() // reorder these. Override actions must always come after normal because // active priority is set based on which action is "newest" // normal actions: - m_moveCenterTabController.leftHandPlayspaceMove( - m_actions.leftHandPlayspaceMove() ); - m_moveCenterTabController.rightHandPlayspaceMove( - m_actions.rightHandPlayspaceMove() ); - m_moveCenterTabController.leftHandPlayspaceRotate( - m_actions.leftHandPlayspaceRotate() ); - m_moveCenterTabController.rightHandPlayspaceRotate( - m_actions.rightHandPlayspaceRotate() ); + m_moveCenterTabController.leftHandRoomDrag( m_actions.leftHandRoomDrag() ); + m_moveCenterTabController.rightHandRoomDrag( + m_actions.rightHandRoomDrag() ); + m_moveCenterTabController.leftHandRoomTurn( m_actions.leftHandRoomTurn() ); + m_moveCenterTabController.rightHandRoomTurn( + m_actions.rightHandRoomTurn() ); // override actions: - m_moveCenterTabController.optionalOverrideLeftHandPlayspaceMove( - m_actions.optionalOverrideLeftHandPlayspaceMove() ); - m_moveCenterTabController.optionalOverrideRightHandPlayspaceMove( - m_actions.optionalOverrideRightHandPlayspaceMove() ); - m_moveCenterTabController.optionalOverrideLeftHandPlayspaceRotate( - m_actions.optionalOverrideLeftHandPlayspaceRotate() ); - m_moveCenterTabController.optionalOverrideRightHandPlayspaceRotate( - m_actions.optionalOverrideRightHandPlayspaceRotate() ); + m_moveCenterTabController.optionalOverrideLeftHandRoomDrag( + m_actions.optionalOverrideLeftHandRoomDrag() ); + m_moveCenterTabController.optionalOverrideRightHandRoomDrag( + m_actions.optionalOverrideRightHandRoomDrag() ); + m_moveCenterTabController.optionalOverrideLeftHandRoomTurn( + m_actions.optionalOverrideLeftHandRoomTurn() ); + m_moveCenterTabController.optionalOverrideRightHandRoomTurn( + m_actions.optionalOverrideRightHandRoomTurn() ); } // vsync implementation: diff --git a/src/package_files/action_manifest.json b/src/package_files/action_manifest.json index 951d463..a3e13ff 100644 --- a/src/package_files/action_manifest.json +++ b/src/package_files/action_manifest.json @@ -27,42 +27,42 @@ "type": "boolean" }, { - "name": "/actions/main/in/LeftHandPlayspaceRotate", - "requirement": "optional", - "type": "boolean" - }, - { - "name": "/actions/main/in/RightHandPlayspaceRotate", + "name": "/actions/main/in/LeftHandRoomTurn", "requirement": "optional", "type": "boolean" }, { - "name": "/actions/main/in/LeftHandPlayspaceMove", - "requirement": "optional", - "type": "boolean" - }, - { - "name": "/actions/main/in/RightHandPlayspaceMove", - "requirement": "optional", - "type": "boolean" - }, - { - "name": "/actions/main/in/OptionalOverrideLeftHandPlayspaceRotate", - "requirement": "optional", - "type": "boolean" - }, - { - "name": "/actions/main/in/OptionalOverrideRightHandPlayspaceRotate", + "name": "/actions/main/in/RightHandRoomTurn", "requirement": "optional", "type": "boolean" }, { - "name": "/actions/main/in/OptionalOverrideLeftHandPlayspaceMove", + "name": "/actions/main/in/LeftHandRoomDrag", "requirement": "optional", "type": "boolean" }, - { - "name": "/actions/main/in/OptionalOverrideRightHandPlayspaceMove", + { + "name": "/actions/main/in/RightHandRoomDrag", + "requirement": "optional", + "type": "boolean" + }, + { + "name": "/actions/main/in/OptionalOverrideLeftHandRoomTurn", + "requirement": "optional", + "type": "boolean" + }, + { + "name": "/actions/main/in/OptionalOverrideRightHandRoomTurn", + "requirement": "optional", + "type": "boolean" + }, + { + "name": "/actions/main/in/OptionalOverrideLeftHandRoomDrag", + "requirement": "optional", + "type": "boolean" + }, + { + "name": "/actions/main/in/OptionalOverrideRightHandRoomDrag", "requirement": "optional", "type": "boolean" } @@ -83,14 +83,14 @@ "/actions/main/in/PreviousTrack" : "Play Previous Track", "/actions/main/in/PausePlayTrack" : "Pause/Play Track", "/actions/main/in/StopTrack" : "Stop Track", - "/actions/main/in/LeftHandPlayspaceRotate" : "Left Hand Playspace Rotate", - "/actions/main/in/RightHandPlayspaceRotate" : "Right Hand Playspace Rotate", - "/actions/main/in/LeftHandPlayspaceMove" : "Left Hand Playspace Move", - "/actions/main/in/RightHandPlayspaceMove" : "Right Hand Playspace Move", - "/actions/main/in/OptionalOverrideLeftHandPlayspaceRotate" : "Optional Override Left Hand Playspace Rotate", - "/actions/main/in/OptionalOverrideRightHandPlayspaceRotate" : "Optional Override Right Hand Playspace Rotate", - "/actions/main/in/OptionalOverrideLeftHandPlayspaceMove" : "Optional Override Left Hand Playspace Move", - "/actions/main/in/OptionalOverrideRightHandPlayspaceMove" : "Optional Override Right Hand Playspace Move" + "/actions/main/in/LeftHandRoomTurn" : "Left Hand Room Turn", + "/actions/main/in/RightHandRoomTurn" : "Right Hand Room Turn", + "/actions/main/in/LeftHandRoomDrag" : "Left Hand Room Drag", + "/actions/main/in/RightHandRoomDrag" : "Right Hand Room Drag", + "/actions/main/in/OptionalOverrideLeftHandRoomTurn" : "Optional Override Left Hand Room Turn", + "/actions/main/in/OptionalOverrideRightHandRoomTurn" : "Optional Override Right Hand Room Turn", + "/actions/main/in/OptionalOverrideLeftHandRoomDrag" : "Optional Override Left Hand Room Drag", + "/actions/main/in/OptionalOverrideRightHandRoomDrag" : "Optional Override Right Hand Room Drag" } ] } \ No newline at end of file diff --git a/src/res/qml/FixFloorPage.qml b/src/res/qml/FixFloorPage.qml index 1cb4dc7..aa1704f 100644 --- a/src/res/qml/FixFloorPage.qml +++ b/src/res/qml/FixFloorPage.qml @@ -6,7 +6,7 @@ import matzman666.advsettings 1.0 MyStackViewPage { - headerText: "Playspace Fix" + headerText: "Room Fix" content: ColumnLayout { spacing: 18 @@ -57,7 +57,7 @@ MyStackViewPage { MyPushButton { id: recenterButton Layout.fillWidth: true - text: "Recenter Playspace" + text: "Recenter Room" Layout.preferredHeight: 100 onClicked: { FixFloorTabController.recenterClicked() @@ -75,9 +75,9 @@ MyStackViewPage { } MyPushButton { - id: zeroPlayspaceButton + id: zeroRoomButton Layout.fillWidth: true - text: "Zero Playspace Tab Offsets" + text: "Apply Room Settings Offsets as Center" Layout.preferredHeight: 100 onClicked: { MoveCenterTabController.zeroOffsets() diff --git a/src/res/qml/PlayspacePage.qml b/src/res/qml/PlayspacePage.qml index 1e7a666..bd58685 100644 --- a/src/res/qml/PlayspacePage.qml +++ b/src/res/qml/PlayspacePage.qml @@ -6,7 +6,7 @@ import matzman666.advsettings 1.0 MyStackViewPage { - headerText: "Play Space Settings" + headerText: "Room Settings" content: ColumnLayout { spacing: 18 @@ -17,7 +17,7 @@ MyStackViewPage { Layout.preferredWidth: 230 } MyText { - id: playspaceModeText + id: roomModeText font.bold: true text: "Standing" } @@ -28,7 +28,7 @@ MyStackViewPage { label: MyText { leftPadding: 10 - text: "Move Play Space" + text: "Move Room" bottomPadding: -10 } background: Rectangle { @@ -60,7 +60,7 @@ MyStackViewPage { } MyPushButton2 { - id: playSpaceMoveXMinusButton + id: roomMoveXMinusButton Layout.preferredWidth: 40 text: "-" onClicked: { @@ -69,7 +69,7 @@ MyStackViewPage { } MyTextField { - id: playSpaceMoveXText + id: roomMoveXText text: "0.00" keyBoardUID: 101 Layout.preferredWidth: 140 @@ -88,7 +88,7 @@ MyStackViewPage { } MyPushButton2 { - id: playSpaceMoveXPlusButton + id: roomMoveXPlusButton Layout.preferredWidth: 40 text: "+" onClicked: { @@ -126,7 +126,7 @@ MyStackViewPage { } MyTextField { - id: playSpaceMoveYText + id: roomMoveYText text: "0.00" keyBoardUID: 102 Layout.preferredWidth: 140 @@ -180,7 +180,7 @@ MyStackViewPage { } MyTextField { - id: playSpaceMoveZText + id: roomMoveZText text: "0.00" keyBoardUID: 103 Layout.preferredWidth: 140 @@ -223,7 +223,7 @@ MyStackViewPage { label: MyText { leftPadding: 10 - text: "Rotate Play Space" + text: "Rotate Room" bottomPadding: -10 } background: Rectangle { @@ -245,7 +245,7 @@ MyStackViewPage { ColumnLayout { RowLayout { MyPushButton2 { - id: playSpaceRotationMinusButton + id: roomRotationMinusButton Layout.preferredWidth: 40 text: "-" onClicked: { @@ -258,7 +258,7 @@ MyStackViewPage { } MySlider { - id: playspaceRotationSlider + id: roomRotationSlider from: -180 to: 180 stepSize: 0.01 @@ -269,13 +269,13 @@ MyStackViewPage { MoveCenterTabController.tempRotation = Math.round(val * 100) } onValueChanged: { - MoveCenterTabController.tempRotation = Math.round(playspaceRotationSlider.value * 100) - //playspaceRotationText.text = Math.round(playspaceRotationSlider.value) + "°" + MoveCenterTabController.tempRotation = Math.round(roomRotationSlider.value * 100) + //roomRotationText.text = Math.round(roomRotationSlider.value) + "°" } } MyPushButton2 { - id: playSpaceRotationPlusButton + id: roomRotationPlusButton Layout.preferredWidth: 40 text: "+" onClicked: { @@ -288,7 +288,7 @@ MyStackViewPage { } MyTextField { - id: playspaceRotationText + id: roomRotationText text: "0°" keyBoardUID: 104 Layout.preferredWidth: 150 @@ -306,7 +306,7 @@ MyStackViewPage { } } MyPushButton { - id: playSpaceRotationApplyButton + id: roomRotationApplyButton Layout.preferredWidth: 145 text:"Apply" onClicked: { @@ -316,15 +316,15 @@ MyStackViewPage { } MyToggleButton { - id: playspaceRotateHandToggle - text: "Virtual Move Shortcut Controls Rotation" + id: roomRotateHandToggle + text: "Enable Room-Turn Binding" onCheckedChanged: { MoveCenterTabController.rotateHand = this.checked } } MyText { - text: "Note: TurnSignal will ignore turning during virtual move rotation." + text: "Note: TurnSignal will ignore turning during Room-Turn rotation." font.pointSize: 15.0 } } @@ -336,7 +336,7 @@ MyStackViewPage { label: MyText { leftPadding: 10 - text: "Virtual Move Shortcut" + text: "Room Drag Binding" bottomPadding: -10 } background: Rectangle { @@ -346,11 +346,11 @@ MyStackViewPage { } ColumnLayout { RowLayout { - anchors.fill: parent + Layout.fillWidth: true MyToggleButton { id: moveShortcutLeft - text: "Left Menu Button" + text: "Enable Left Hand" onCheckedChanged: { MoveCenterTabController.moveShortcutLeft = this.checked } @@ -358,29 +358,21 @@ MyStackViewPage { MyToggleButton { id: moveShortcutRight - text: "Right Menu Button" + text: "Enable Right Hand" onCheckedChanged: { MoveCenterTabController.moveShortcutRight = this.checked } } - - MyToggleButton { - id: requireDoubleClick - text: "Require double click" - onCheckedChanged: { - MoveCenterTabController.requireDoubleClick = this.checked - } - } } } } ColumnLayout { RowLayout { - anchors.fill: parent + Layout.fillWidth: true MyPushButton { - id: playspaceResetButton + id: roomResetButton Layout.preferredWidth: 250 text: "Reset" onClicked: { @@ -389,7 +381,7 @@ MyStackViewPage { } MyToggleButton { - id: playspaceAdjustChaperoneToggle + id: roomAdjustChaperoneToggle text: "Adjust Chaperone" onCheckedChanged: { MoveCenterTabController.adjustChaperone = this.checked @@ -404,68 +396,64 @@ MyStackViewPage { Item { Layout.fillHeight: true; Layout.fillWidth: true} Component.onCompleted: { - playspaceAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone - playspaceRotateHandToggle.checked = MoveCenterTabController.rotateHand - playSpaceMoveXText.text = MoveCenterTabController.offsetX.toFixed(2) - playSpaceMoveYText.text = MoveCenterTabController.offsetY.toFixed(2) - playSpaceMoveZText.text = MoveCenterTabController.offsetZ.toFixed(2) - playspaceRotationSlider.value = MoveCenterTabController.rotation + roomAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone + roomRotateHandToggle.checked = MoveCenterTabController.rotateHand + roomMoveXText.text = MoveCenterTabController.offsetX.toFixed(2) + roomMoveYText.text = MoveCenterTabController.offsetY.toFixed(2) + roomMoveZText.text = MoveCenterTabController.offsetZ.toFixed(2) + roomRotationSlider.value = MoveCenterTabController.rotation moveShortcutRight.checked = MoveCenterTabController.moveShortcutRight moveShortcutLeft.checked = MoveCenterTabController.moveShortcutLeft lockXToggle.checked = MoveCenterTabController.lockXToggle lockYToggle.checked = MoveCenterTabController.lockYToggle lockZToggle.checked = MoveCenterTabController.lockZToggle - requireDoubleClick.checked = MoveCenterTabController.requireDoubleClick if (MoveCenterTabController.trackingUniverse === 0) { - playspaceModeText.text = "Sitting" - playSpaceRotationPlusButton.enabled = false - playSpaceRotationMinusButton.enabled = false - playspaceRotationSlider.enabled = false - playspaceRotationText.text = "-" + roomModeText.text = "Sitting" + roomRotationPlusButton.enabled = false + roomRotationMinusButton.enabled = false + roomRotationSlider.enabled = false + roomRotationText.text = "-" } else if (MoveCenterTabController.trackingUniverse === 1) { - playspaceModeText.text = "Standing" - playSpaceRotationPlusButton.enabled = true - playSpaceRotationMinusButton.enabled = true - playspaceRotationSlider.enabled = true - playspaceRotationText.text = "0°" + roomModeText.text = "Standing" + roomRotationPlusButton.enabled = true + roomRotationMinusButton.enabled = true + roomRotationSlider.enabled = true + roomRotationText.text = "0°" } else { - playspaceModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")" + roomModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")" } } Connections { target: MoveCenterTabController onOffsetXChanged: { - playSpaceMoveXText.text = MoveCenterTabController.offsetX.toFixed(2) + roomMoveXText.text = MoveCenterTabController.offsetX.toFixed(2) } onOffsetYChanged: { - playSpaceMoveYText.text = MoveCenterTabController.offsetY.toFixed(2) + roomMoveYText.text = MoveCenterTabController.offsetY.toFixed(2) } onOffsetZChanged: { - playSpaceMoveZText.text = MoveCenterTabController.offsetZ.toFixed(2) + roomMoveZText.text = MoveCenterTabController.offsetZ.toFixed(2) } onRotationChanged: { - playspaceRotationSlider.value = ( MoveCenterTabController.rotation / 100 ) + roomRotationSlider.value = ( MoveCenterTabController.rotation / 100 ) } onTempRotationChanged: { - playspaceRotationSlider.value = ( MoveCenterTabController.tempRotation / 100 ) - playspaceRotationText.text = ( MoveCenterTabController.tempRotation / 100 ) + "°" + roomRotationSlider.value = ( MoveCenterTabController.tempRotation / 100 ) + roomRotationText.text = ( MoveCenterTabController.tempRotation / 100 ) + "°" } onAdjustChaperoneChanged: { - playspaceAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone + roomAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone } onRotateHandChanged: { - playspaceRotateHandToggle.checked = MoveCenterTabController.rotateHand + roomRotateHandToggle.checked = MoveCenterTabController.rotateHand } onMoveShortcutRightChanged: { moveShortcutRight.checked = MoveCenterTabController.moveShortcutRight } onMoveShortcutLeftChanged: { moveShortcutLeft.checked = MoveCenterTabController.moveShortcutLeft - } - onRequireDoubleClickChanged: { - requireDoubleClick.checked = MoveCenterTabController.requireDoubleClick } onLockXToggleChanged: { lockXToggle.checked = MoveCenterTabController.lockXToggle @@ -478,19 +466,19 @@ MyStackViewPage { } onTrackingUniverseChanged: { if (MoveCenterTabController.trackingUniverse === 0) { - playspaceModeText.text = "Sitting" - playSpaceRotationPlusButton.enabled = false - playSpaceRotationMinusButton.enabled = false - playspaceRotationSlider.enabled = false - playspaceRotationText.text = "-" + roomModeText.text = "Sitting" + roomRotationPlusButton.enabled = false + roomRotationMinusButton.enabled = false + roomRotationSlider.enabled = false + roomRotationText.text = "-" } else if (MoveCenterTabController.trackingUniverse === 1) { - playspaceModeText.text = "Standing" - playSpaceRotationPlusButton.enabled = true - playSpaceRotationMinusButton.enabled = true - playspaceRotationSlider.enabled = true - playspaceRotationText.text = "0°" + roomModeText.text = "Standing" + roomRotationPlusButton.enabled = true + roomRotationMinusButton.enabled = true + roomRotationSlider.enabled = true + roomRotationText.text = "0°" } else { - playspaceModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")" + roomModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")" } } } diff --git a/src/res/qml/RootPage.qml b/src/res/qml/RootPage.qml index de9dec7..1a02e6b 100644 --- a/src/res/qml/RootPage.qml +++ b/src/res/qml/RootPage.qml @@ -48,7 +48,7 @@ MyStackViewPage { MyPushButton { id: playSpaceButton activationSoundEnabled: false - text: "Play Space" + text: "Room Settings" Layout.fillWidth: true onClicked: { MyResources.playFocusChangedSound() @@ -59,7 +59,7 @@ MyStackViewPage { MyPushButton { id: fixFloorButton activationSoundEnabled: false - text: "Playspace Fix" + text: "Room Fix" Layout.fillWidth: true onClicked: { MyResources.playFocusChangedSound() diff --git a/src/tabcontrollers/FixFloorTabController.cpp b/src/tabcontrollers/FixFloorTabController.cpp index c9ff7dd..bc254e6 100644 --- a/src/tabcontrollers/FixFloorTabController.cpp +++ b/src/tabcontrollers/FixFloorTabController.cpp @@ -145,7 +145,7 @@ void FixFloorTabController::eventLoopTick( floorOffsetZ = tempOffsetZ; LOG( INFO ) - << "Fix Floor and adjust playspace center: Floor Offset = [" + << "Fix Floor and adjust room center: Floor Offset = [" << floorOffsetX << ", " << floorOffsetY << ", " << floorOffsetZ << "]"; float offset[3] = { 0, 0, 0 }; diff --git a/src/tabcontrollers/MoveCenterTabController.cpp b/src/tabcontrollers/MoveCenterTabController.cpp index 7f150b7..8f39121 100644 --- a/src/tabcontrollers/MoveCenterTabController.cpp +++ b/src/tabcontrollers/MoveCenterTabController.cpp @@ -34,25 +34,22 @@ void MoveCenterTabController::initStage1() { m_adjustChaperone = value.toBool(); } - value = settings->value( "rotateHand", m_rotateHand ); + value = settings->value( "rotateHand", m_settingsHandTurningEnabled ); if ( value.isValid() && !value.isNull() ) { - m_rotateHand = value.toBool(); + m_settingsHandTurningEnabled = value.toBool(); } - value = settings->value( "moveShortcutRight", m_moveShortcutRightEnabled ); + value = settings->value( "moveShortcutRight", + m_settingsRightHandDragEnabled ); if ( value.isValid() && !value.isNull() ) { - m_moveShortcutRightEnabled = value.toBool(); + m_settingsRightHandDragEnabled = value.toBool(); } - value = settings->value( "moveShortcutLeft", m_moveShortcutLeftEnabled ); + value + = settings->value( "moveShortcutLeft", m_settingsLeftHandDragEnabled ); if ( value.isValid() && !value.isNull() ) { - m_moveShortcutLeftEnabled = value.toBool(); - } - value = settings->value( "requireDoubleClick", m_requireDoubleClick ); - if ( value.isValid() && !value.isNull() ) - { - m_requireDoubleClick = value.toBool(); + m_settingsLeftHandDragEnabled = value.toBool(); } value = settings->value( "lockXToggle", m_lockXToggle ); if ( value.isValid() && !value.isNull() ) @@ -292,77 +289,58 @@ void MoveCenterTabController::setAdjustChaperone( bool value, bool notify ) bool MoveCenterTabController::rotateHand() const { - return m_rotateHand; + return m_settingsHandTurningEnabled; } void MoveCenterTabController::setRotateHand( bool value, bool notify ) { - m_rotateHand = value; + m_settingsHandTurningEnabled = value; auto settings = OverlayController::appSettings(); settings->beginGroup( "playspaceSettings" ); - settings->setValue( "rotateHand", m_rotateHand ); + settings->setValue( "rotateHand", m_settingsHandTurningEnabled ); settings->endGroup(); settings->sync(); if ( notify ) { - emit rotateHandChanged( m_rotateHand ); + emit rotateHandChanged( m_settingsHandTurningEnabled ); } } bool MoveCenterTabController::moveShortcutRight() const { - return m_moveShortcutRightEnabled; + return m_settingsRightHandDragEnabled; } void MoveCenterTabController::setMoveShortcutRight( bool value, bool notify ) { - m_moveShortcutRightEnabled = value; + m_settingsRightHandDragEnabled = value; auto settings = OverlayController::appSettings(); settings->beginGroup( "playspaceSettings" ); - settings->setValue( "moveShortcutRight", m_moveShortcutRightEnabled ); + settings->setValue( "moveShortcutRight", m_settingsRightHandDragEnabled ); settings->endGroup(); settings->sync(); if ( notify ) { - emit moveShortcutRightChanged( m_moveShortcutRightEnabled ); + emit moveShortcutRightChanged( m_settingsRightHandDragEnabled ); } } bool MoveCenterTabController::moveShortcutLeft() const { - return m_moveShortcutLeftEnabled; + return m_settingsLeftHandDragEnabled; } void MoveCenterTabController::setMoveShortcutLeft( bool value, bool notify ) { - m_moveShortcutLeftEnabled = value; + m_settingsLeftHandDragEnabled = value; auto settings = OverlayController::appSettings(); settings->beginGroup( "playspaceSettings" ); - settings->setValue( "moveShortcutLeft", m_moveShortcutLeftEnabled ); + settings->setValue( "moveShortcutLeft", m_settingsLeftHandDragEnabled ); settings->endGroup(); settings->sync(); if ( notify ) { - emit moveShortcutLeftChanged( m_moveShortcutLeftEnabled ); - } -} - -bool MoveCenterTabController::requireDoubleClick() const -{ - return m_requireDoubleClick; -} - -void MoveCenterTabController::setRequireDoubleClick( bool value, bool notify ) -{ - m_requireDoubleClick = value; - auto settings = OverlayController::appSettings(); - settings->beginGroup( "playspaceSettings" ); - settings->setValue( "requireDoubleClick", m_requireDoubleClick ); - settings->endGroup(); - settings->sync(); - if ( notify ) - { - emit requireDoubleClickChanged( m_requireDoubleClick ); + emit moveShortcutLeftChanged( m_settingsLeftHandDragEnabled ); } } @@ -532,445 +510,353 @@ void MoveCenterTabController::resetHmdYawTotal() m_hmdYawTotal = 0.0; } -// START of move bindings: +// START of drag bindings: -void MoveCenterTabController::leftHandPlayspaceMove( bool leftHandMoveActive ) +void MoveCenterTabController::leftHandRoomDrag( bool leftHandDragActive ) { - if ( m_moveShortcutLeftEnabled ) + if ( !m_settingsLeftHandDragEnabled ) { - // cancel if other hand is active in override - if ( !m_overrideRightHandMovePressed ) - { - // detect new press - if ( leftHandMoveActive && !m_leftHandMovePressed ) - { - m_activeMoveHand = vr::TrackedControllerRole_LeftHand; - } - // detect new release - else if ( !leftHandMoveActive && m_leftHandMovePressed ) - { - // check overrides - // pass back to right hand? - if ( m_overrideRightHandMovePressed ) - { - m_activeMoveHand = vr::TrackedControllerRole_RightHand; - } - // override of left hand still active? - else if ( m_overrideLeftHandMovePressed ) - { - m_activeMoveHand = vr::TrackedControllerRole_LeftHand; - } - // check non-override right hand action - if ( m_rightHandMovePressed ) - { - m_activeMoveHand = vr::TrackedControllerRole_RightHand; - } - // nothing else is pressed, deactivate move - else - { - m_activeMoveHand = vr::TrackedControllerRole_Invalid; - } - } - } - m_leftHandMovePressed = leftHandMoveActive; + return; } -} - -void MoveCenterTabController::rightHandPlayspaceMove( bool rightHandMoveActive ) -{ - if ( m_moveShortcutRightEnabled ) - { - // cancel if other hand is active in override - if ( !m_overrideLeftHandMovePressed ) - { - // detect new press - if ( rightHandMoveActive && !m_rightHandMovePressed ) - { - m_activeMoveHand = vr::TrackedControllerRole_RightHand; - } - // detect new release - else if ( !rightHandMoveActive && m_rightHandMovePressed ) - { - // check overrides - // pass back to left hand? - if ( m_overrideLeftHandMovePressed ) - { - m_activeMoveHand = vr::TrackedControllerRole_LeftHand; - } - // override of right hand still active? - else if ( m_overrideRightHandMovePressed ) - { - m_activeMoveHand = vr::TrackedControllerRole_RightHand; - } - // check non-override left hand action - if ( m_leftHandMovePressed ) - { - m_activeMoveHand = vr::TrackedControllerRole_LeftHand; - } - // nothing else is pressed, deactivate move - else - { - m_activeMoveHand = vr::TrackedControllerRole_Invalid; - } - } - } - m_rightHandMovePressed = rightHandMoveActive; - } -} - -void MoveCenterTabController::optionalOverrideLeftHandPlayspaceMove( - bool overrideLeftHandMoveActive ) -{ - if ( m_moveShortcutLeftEnabled ) + // cancel if other hand is active in override + if ( !m_overrideRightHandDragPressed ) { // detect new press - if ( overrideLeftHandMoveActive && !m_overrideLeftHandMovePressed ) + if ( leftHandDragActive && !m_leftHandDragPressed ) { - m_activeMoveHand = vr::TrackedControllerRole_LeftHand; - // stop any active rotate because we're in override mode - m_activeRotateHand = vr::TrackedControllerRole_Invalid; + m_activeDragHand = vr::TrackedControllerRole_LeftHand; } // detect new release - else if ( !overrideLeftHandMoveActive && m_overrideLeftHandMovePressed ) + else if ( !leftHandDragActive && m_leftHandDragPressed ) { - // check if we should pass back to other hand - // give priority to override action - if ( m_overrideRightHandMovePressed ) + // check overrides + // pass back to right hand? + if ( m_overrideRightHandDragPressed ) { - m_activeMoveHand = vr::TrackedControllerRole_RightHand; + m_activeDragHand = vr::TrackedControllerRole_RightHand; } - // otherwise check normal action - else if ( m_rightHandMovePressed ) + // override of left hand still active? + else if ( m_overrideLeftHandDragPressed ) { - m_activeMoveHand = vr::TrackedControllerRole_RightHand; + m_activeDragHand = vr::TrackedControllerRole_LeftHand; } - // check if we should fall back to non-override left hand - else if ( m_leftHandMovePressed ) + // check non-override right hand action + if ( m_rightHandDragPressed ) { - m_activeMoveHand = vr::TrackedControllerRole_LeftHand; + m_activeDragHand = vr::TrackedControllerRole_RightHand; } // nothing else is pressed, deactivate move else { - m_activeMoveHand = vr::TrackedControllerRole_Invalid; + m_activeDragHand = vr::TrackedControllerRole_Invalid; } } - m_overrideLeftHandMovePressed = overrideLeftHandMoveActive; } + m_leftHandDragPressed = leftHandDragActive; } -void MoveCenterTabController::optionalOverrideRightHandPlayspaceMove( - bool overrideRightHandMoveActive ) +void MoveCenterTabController::rightHandRoomDrag( bool rightHandDragActive ) { - if ( m_moveShortcutRightEnabled ) + if ( !m_settingsRightHandDragEnabled ) + { + return; + } + // cancel if other hand is active in override + if ( !m_overrideLeftHandDragPressed ) { // detect new press - if ( overrideRightHandMoveActive && !m_overrideRightHandMovePressed ) + if ( rightHandDragActive && !m_rightHandDragPressed ) { - m_activeMoveHand = vr::TrackedControllerRole_RightHand; - // stop any active rotate because we're in override mode - m_activeRotateHand = vr::TrackedControllerRole_Invalid; + m_activeDragHand = vr::TrackedControllerRole_RightHand; } // detect new release - else if ( !overrideRightHandMoveActive - && m_overrideRightHandMovePressed ) + else if ( !rightHandDragActive && m_rightHandDragPressed ) { - // check if we should pass back to other hand - // give priority to override action - if ( m_overrideLeftHandMovePressed ) + // check overrides + // pass back to left hand? + if ( m_overrideLeftHandDragPressed ) { - m_activeMoveHand = vr::TrackedControllerRole_LeftHand; + m_activeDragHand = vr::TrackedControllerRole_LeftHand; } - // otherwise check normal action - else if ( m_leftHandMovePressed ) + // override of right hand still active? + else if ( m_overrideRightHandDragPressed ) { - m_activeMoveHand = vr::TrackedControllerRole_LeftHand; + m_activeDragHand = vr::TrackedControllerRole_RightHand; } - // check if we should fall back to non-override left hand - else if ( m_rightHandMovePressed ) + // check non-override left hand action + if ( m_leftHandDragPressed ) { - m_activeMoveHand = vr::TrackedControllerRole_RightHand; + m_activeDragHand = vr::TrackedControllerRole_LeftHand; } // nothing else is pressed, deactivate move else { - m_activeMoveHand = vr::TrackedControllerRole_Invalid; + m_activeDragHand = vr::TrackedControllerRole_Invalid; } } - m_overrideRightHandMovePressed = overrideRightHandMoveActive; } + m_rightHandDragPressed = rightHandDragActive; } -// END of move bindings - -// START of rotate bindgins - -void MoveCenterTabController::leftHandPlayspaceRotate( - bool leftHandRotateActive ) +void MoveCenterTabController::optionalOverrideLeftHandRoomDrag( + bool overrideLeftHandDragActive ) { - if ( m_rotateHand ) + if ( !m_settingsLeftHandDragEnabled ) { - // cancel if other hand is active in override - if ( !m_overrideRightHandRotatePressed ) - { - // detect new press - if ( leftHandRotateActive && !m_leftHandRotatePressed ) - { - m_activeRotateHand = vr::TrackedControllerRole_LeftHand; - } - // detect new release - else if ( !leftHandRotateActive && m_leftHandRotatePressed ) - { - // check overrides - // pass back to right hand? - if ( m_overrideRightHandRotatePressed ) - { - m_activeRotateHand = vr::TrackedControllerRole_RightHand; - } - // override of left hand still active? - else if ( m_overrideLeftHandRotatePressed ) - { - m_activeRotateHand = vr::TrackedControllerRole_LeftHand; - } - // check non-override right hand action - if ( m_rightHandRotatePressed ) - { - m_activeRotateHand = vr::TrackedControllerRole_RightHand; - } - // nothing else is pressed, deactivate rotate - else - { - m_activeRotateHand = vr::TrackedControllerRole_Invalid; - } - } - } - m_leftHandRotatePressed = leftHandRotateActive; + return; } -} - -void MoveCenterTabController::rightHandPlayspaceRotate( - bool rightHandRotateActive ) -{ - if ( m_rotateHand ) + // detect new press + if ( overrideLeftHandDragActive && !m_overrideLeftHandDragPressed ) { - // cancel if other hand is active in override - if ( !m_overrideLeftHandRotatePressed ) - { - // detect new press - if ( rightHandRotateActive && !m_rightHandRotatePressed ) - { - m_activeRotateHand = vr::TrackedControllerRole_RightHand; - } - // detect new release - else if ( !rightHandRotateActive && m_rightHandRotatePressed ) - { - // check overrides - // pass back to left hand? - if ( m_overrideLeftHandRotatePressed ) - { - m_activeRotateHand = vr::TrackedControllerRole_LeftHand; - } - // override of right hand still active? - else if ( m_overrideRightHandRotatePressed ) - { - m_activeRotateHand = vr::TrackedControllerRole_RightHand; - } - // check non-override left hand action - if ( m_leftHandRotatePressed ) - { - m_activeRotateHand = vr::TrackedControllerRole_LeftHand; - } - // nothing else is pressed, deactivate rotate - else - { - m_activeRotateHand = vr::TrackedControllerRole_Invalid; - } - } - } - m_rightHandRotatePressed = rightHandRotateActive; + m_activeDragHand = vr::TrackedControllerRole_LeftHand; + // stop any active rotate because we're in override mode + m_activeTurnHand = vr::TrackedControllerRole_Invalid; } + // detect new release + else if ( !overrideLeftHandDragActive && m_overrideLeftHandDragPressed ) + { + // check if we should pass back to other hand + // give priority to override action + if ( m_overrideRightHandDragPressed ) + { + m_activeDragHand = vr::TrackedControllerRole_RightHand; + } + // otherwise check normal action + else if ( m_rightHandDragPressed ) + { + m_activeDragHand = vr::TrackedControllerRole_RightHand; + } + // check if we should fall back to non-override left hand + else if ( m_leftHandDragPressed ) + { + m_activeDragHand = vr::TrackedControllerRole_LeftHand; + } + // nothing else is pressed, deactivate move + else + { + m_activeDragHand = vr::TrackedControllerRole_Invalid; + } + } + m_overrideLeftHandDragPressed = overrideLeftHandDragActive; } -void MoveCenterTabController::optionalOverrideLeftHandPlayspaceRotate( - bool overrideLeftHandRotateActive ) +void MoveCenterTabController::optionalOverrideRightHandRoomDrag( + bool overrideRightHandDragActive ) { - if ( m_rotateHand ) + if ( !m_settingsRightHandDragEnabled ) + { + return; + } + // detect new press + if ( overrideRightHandDragActive && !m_overrideRightHandDragPressed ) + { + m_activeDragHand = vr::TrackedControllerRole_RightHand; + // stop any active rotate because we're in override mode + m_activeTurnHand = vr::TrackedControllerRole_Invalid; + } + // detect new release + else if ( !overrideRightHandDragActive && m_overrideRightHandDragPressed ) + { + // check if we should pass back to other hand + // give priority to override action + if ( m_overrideLeftHandDragPressed ) + { + m_activeDragHand = vr::TrackedControllerRole_LeftHand; + } + // otherwise check normal action + else if ( m_leftHandDragPressed ) + { + m_activeDragHand = vr::TrackedControllerRole_LeftHand; + } + // check if we should fall back to non-override left hand + else if ( m_rightHandDragPressed ) + { + m_activeDragHand = vr::TrackedControllerRole_RightHand; + } + // nothing else is pressed, deactivate move + else + { + m_activeDragHand = vr::TrackedControllerRole_Invalid; + } + } + m_overrideRightHandDragPressed = overrideRightHandDragActive; +} + +// END of drag bindings + +// START of turn bindgins + +void MoveCenterTabController::leftHandRoomTurn( bool leftHandTurnActive ) +{ + if ( !m_settingsHandTurningEnabled ) + { + return; + } + // cancel if other hand is active in override + if ( !m_overrideRightHandTurnPressed ) { // detect new press - if ( overrideLeftHandRotateActive && !m_overrideLeftHandRotatePressed ) + if ( leftHandTurnActive && !m_leftHandTurnPressed ) { - m_activeRotateHand = vr::TrackedControllerRole_LeftHand; - // stop any active move because we're in override mode - m_activeMoveHand = vr::TrackedControllerRole_Invalid; + m_activeTurnHand = vr::TrackedControllerRole_LeftHand; } // detect new release - else if ( !overrideLeftHandRotateActive - && m_overrideLeftHandRotatePressed ) + else if ( !leftHandTurnActive && m_leftHandTurnPressed ) { - // check if we should pass back to other hand - // give priority to override action - if ( m_overrideRightHandRotatePressed ) + // check overrides + // pass back to right hand? + if ( m_overrideRightHandTurnPressed ) { - m_activeRotateHand = vr::TrackedControllerRole_RightHand; + m_activeTurnHand = vr::TrackedControllerRole_RightHand; } - // otherwise check normal action - else if ( m_rightHandRotatePressed ) + // override of left hand still active? + else if ( m_overrideLeftHandTurnPressed ) { - m_activeRotateHand = vr::TrackedControllerRole_RightHand; + m_activeTurnHand = vr::TrackedControllerRole_LeftHand; } - // check if we should fall back to non-override left hand - else if ( m_leftHandRotatePressed ) + // check non-override right hand action + if ( m_rightHandTurnPressed ) { - m_activeRotateHand = vr::TrackedControllerRole_LeftHand; + m_activeTurnHand = vr::TrackedControllerRole_RightHand; } // nothing else is pressed, deactivate rotate else { - m_activeRotateHand = vr::TrackedControllerRole_Invalid; + m_activeTurnHand = vr::TrackedControllerRole_Invalid; } } - m_overrideLeftHandRotatePressed = overrideLeftHandRotateActive; } + m_leftHandTurnPressed = leftHandTurnActive; } -void MoveCenterTabController::optionalOverrideRightHandPlayspaceRotate( - bool overrideRightHandRotateActive ) +void MoveCenterTabController::rightHandRoomTurn( bool rightHandTurnActive ) { - if ( m_rotateHand ) + if ( !m_settingsHandTurningEnabled ) + { + return; + } + // cancel if other hand is active in override + if ( !m_overrideLeftHandTurnPressed ) { // detect new press - if ( overrideRightHandRotateActive - && !m_overrideRightHandRotatePressed ) + if ( rightHandTurnActive && !m_rightHandTurnPressed ) { - m_activeRotateHand = vr::TrackedControllerRole_RightHand; - // stop any active move because we're in override mode - m_activeMoveHand = vr::TrackedControllerRole_Invalid; + m_activeTurnHand = vr::TrackedControllerRole_RightHand; } // detect new release - else if ( !overrideRightHandRotateActive - && m_overrideRightHandRotatePressed ) + else if ( !rightHandTurnActive && m_rightHandTurnPressed ) { - // check if we should pass back to other hand - // give priority to override action - if ( m_overrideLeftHandRotatePressed ) + // check overrides + // pass back to left hand? + if ( m_overrideLeftHandTurnPressed ) { - m_activeRotateHand = vr::TrackedControllerRole_LeftHand; + m_activeTurnHand = vr::TrackedControllerRole_LeftHand; } - // otherwise check normal action - else if ( m_leftHandRotatePressed ) + // override of right hand still active? + else if ( m_overrideRightHandTurnPressed ) { - m_activeRotateHand = vr::TrackedControllerRole_LeftHand; + m_activeTurnHand = vr::TrackedControllerRole_RightHand; } - // check if we should fall back to non-override left hand - else if ( m_rightHandRotatePressed ) + // check non-override left hand action + if ( m_leftHandTurnPressed ) { - m_activeRotateHand = vr::TrackedControllerRole_RightHand; + m_activeTurnHand = vr::TrackedControllerRole_LeftHand; } // nothing else is pressed, deactivate rotate else { - m_activeRotateHand = vr::TrackedControllerRole_Invalid; + m_activeTurnHand = vr::TrackedControllerRole_Invalid; } } - m_overrideRightHandRotatePressed = overrideRightHandRotateActive; } + m_rightHandTurnPressed = rightHandTurnActive; } -// END of rotate bindings. - -/* -bool isMoveShortCutPressed( vr::ETrackedControllerRole hand ) +void MoveCenterTabController::optionalOverrideLeftHandRoomTurn( + bool overrideLeftHandTurnActive ) { - auto handId - = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole( hand ); - if ( handId == vr::k_unTrackedDeviceIndexInvalid - || handId >= vr::k_unMaxTrackedDeviceCount ) + if ( !m_settingsHandTurningEnabled ) { - return false; + return; } - - vr::VRControllerState_t state; - if ( vr::VRSystem()->GetControllerState( - handId, &state, sizeof( vr::VRControllerState_t ) ) ) + // detect new press + if ( overrideLeftHandTurnActive && !m_overrideLeftHandTurnPressed ) { - return state.ulButtonPressed - & vr::ButtonMaskFromId( vr::k_EButton_ApplicationMenu ); + m_activeTurnHand = vr::TrackedControllerRole_LeftHand; + // stop any active move because we're in override mode + m_activeDragHand = vr::TrackedControllerRole_Invalid; } - - return false; + // detect new release + else if ( !overrideLeftHandTurnActive && m_overrideLeftHandTurnPressed ) + { + // check if we should pass back to other hand + // give priority to override action + if ( m_overrideRightHandTurnPressed ) + { + m_activeTurnHand = vr::TrackedControllerRole_RightHand; + } + // otherwise check normal action + else if ( m_rightHandTurnPressed ) + { + m_activeTurnHand = vr::TrackedControllerRole_RightHand; + } + // check if we should fall back to non-override left hand + else if ( m_leftHandTurnPressed ) + { + m_activeTurnHand = vr::TrackedControllerRole_LeftHand; + } + // nothing else is pressed, deactivate rotate + else + { + m_activeTurnHand = vr::TrackedControllerRole_Invalid; + } + } + m_overrideLeftHandTurnPressed = overrideLeftHandTurnActive; } -*/ -/* -vr::ETrackedControllerRole MoveCenterTabController::getMoveShortcutHand() +void MoveCenterTabController::optionalOverrideRightHandRoomTurn( + bool overrideRightHandTurnActive ) { - auto activeHand = m_activeMoveController; - - bool rightPressed - = m_moveShortcutRightEnabled - && isMoveShortCutPressed( vr::TrackedControllerRole_RightHand ); - bool leftPressed - = m_moveShortcutLeftEnabled - && isMoveShortCutPressed( vr::TrackedControllerRole_LeftHand ); - bool checkDoubleClick = m_requireDoubleClick - && activeHand == vr::TrackedControllerRole_Invalid; - - auto now = clock::now(); - // if we start pressing the shortcut on a controller we set the active one - // to it - if ( rightPressed && !m_moveShortcutRightPressed ) + if ( !m_settingsHandTurningEnabled ) { - auto elapsed - = duration_cast( now - lastMoveButtonClick[0] ) - .count(); - if ( !checkDoubleClick || elapsed < 250 ) + return; + } + // detect new press + if ( overrideRightHandTurnActive && !m_overrideRightHandTurnPressed ) + { + m_activeTurnHand = vr::TrackedControllerRole_RightHand; + // stop any active move because we're in override mode + m_activeDragHand = vr::TrackedControllerRole_Invalid; + } + // detect new release + else if ( !overrideRightHandTurnActive && m_overrideRightHandTurnPressed ) + { + // check if we should pass back to other hand + // give priority to override action + if ( m_overrideLeftHandTurnPressed ) { - activeHand = vr::TrackedControllerRole_RightHand; + m_activeTurnHand = vr::TrackedControllerRole_LeftHand; } - lastMoveButtonClick[0] = now; - } - if ( leftPressed && !m_moveShortcutLeftPressed ) - { - auto elapsed - = duration_cast( now - lastMoveButtonClick[1] ) - .count(); - if ( !checkDoubleClick || elapsed < 250 ) + // otherwise check normal action + else if ( m_leftHandTurnPressed ) { - activeHand = vr::TrackedControllerRole_LeftHand; + m_activeTurnHand = vr::TrackedControllerRole_LeftHand; } - lastMoveButtonClick[1] = now; - } - - // if we let down of a shortcut we set the active hand to any remaining - // pressed down hand - if ( !rightPressed && m_moveShortcutRightPressed ) - { - activeHand = leftPressed ? vr::TrackedControllerRole_LeftHand - : vr::TrackedControllerRole_Invalid; - } - if ( !leftPressed && m_moveShortcutLeftPressed ) - { - activeHand = rightPressed ? vr::TrackedControllerRole_RightHand - : vr::TrackedControllerRole_Invalid; - } - - if ( !leftPressed && !rightPressed ) - { - activeHand = vr::TrackedControllerRole_Invalid; - if ( m_activeMoveController != vr::TrackedControllerRole_Invalid ) + // check if we should fall back to non-override left hand + else if ( m_rightHandTurnPressed ) { - // grace period while switching hands - lastMoveButtonClick[0] = lastMoveButtonClick[1] = now; + m_activeTurnHand = vr::TrackedControllerRole_RightHand; + } + // nothing else is pressed, deactivate rotate + else + { + m_activeTurnHand = vr::TrackedControllerRole_Invalid; } } - - m_activeMoveController = activeHand; - m_moveShortcutRightPressed = rightPressed; - m_moveShortcutLeftPressed = leftPressed; - - return activeHand; + m_overrideRightHandTurnPressed = overrideRightHandTurnActive; } -*/ + +// END of turn bindings. void MoveCenterTabController::eventLoopTick( vr::ETrackingUniverseOrigin universe, @@ -1080,12 +966,12 @@ void MoveCenterTabController::eventLoopTick( } */ auto moveHandId = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole( - m_activeMoveHand ); + m_activeDragHand ); auto rotateHandId = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole( - m_activeRotateHand ); + m_activeTurnHand ); // START of hand move - if ( m_activeMoveHand == vr::TrackedControllerRole_Invalid + if ( m_activeDragHand == vr::TrackedControllerRole_Invalid || moveHandId == vr::k_unTrackedDeviceIndexInvalid || moveHandId >= vr::k_unMaxTrackedDeviceCount ) { @@ -1095,7 +981,7 @@ void MoveCenterTabController::eventLoopTick( emit offsetYChanged( m_offsetY ); emit offsetZChanged( m_offsetZ ); } - m_lastMoveHand = m_activeMoveHand; + m_lastMoveHand = m_activeDragHand; } else { @@ -1103,7 +989,7 @@ void MoveCenterTabController::eventLoopTick( if ( !movePose->bPoseIsValid || !movePose->bDeviceIsConnected || movePose->eTrackingResult != vr::TrackingResult_Running_OK ) { - m_lastMoveHand = m_activeMoveHand; + m_lastMoveHand = m_activeDragHand; } else { @@ -1119,7 +1005,7 @@ void MoveCenterTabController::eventLoopTick( static_cast( relativeControllerPosition[2] ) + m_offsetZ, }; - if ( m_lastMoveHand == m_activeMoveHand ) + if ( m_lastMoveHand == m_activeDragHand ) { double diff[3] = { absoluteControllerPosition[0] - m_lastControllerPosition[0], @@ -1177,13 +1063,13 @@ void MoveCenterTabController::eventLoopTick( m_lastControllerPosition[0] = absoluteControllerPosition[0]; m_lastControllerPosition[1] = absoluteControllerPosition[1]; m_lastControllerPosition[2] = absoluteControllerPosition[2]; - m_lastMoveHand = m_activeMoveHand; + m_lastMoveHand = m_activeDragHand; } } // END of hand move // START of hand rotation - if ( m_activeRotateHand == vr::TrackedControllerRole_Invalid + if ( m_activeTurnHand == vr::TrackedControllerRole_Invalid || rotateHandId == vr::k_unTrackedDeviceIndexInvalid || rotateHandId >= vr::k_unMaxTrackedDeviceCount ) { @@ -1193,7 +1079,7 @@ void MoveCenterTabController::eventLoopTick( // (-1000.0) lastHandQuaternion.w = -1000.0; } - m_lastRotateHand = m_activeRotateHand; + m_lastRotateHand = m_activeTurnHand; } else { @@ -1201,7 +1087,7 @@ void MoveCenterTabController::eventLoopTick( if ( !rotatePose->bPoseIsValid || !rotatePose->bDeviceIsConnected || rotatePose->eTrackingResult != vr::TrackingResult_Running_OK ) { - m_lastRotateHand = m_activeRotateHand; + m_lastRotateHand = m_activeTurnHand; } else { @@ -1224,7 +1110,7 @@ void MoveCenterTabController::eventLoopTick( // Convert pose matrix to quaternion handQuaternion = utils::getQuaternion( handMatrixAbsolute ); - if ( m_lastRotateHand == m_activeRotateHand ) + if ( m_lastRotateHand == m_activeTurnHand ) { // Get rotation change of hand. // Checking if set to -1000.0 placeholder for invalid hand. @@ -1271,7 +1157,7 @@ void MoveCenterTabController::eventLoopTick( } } lastHandQuaternion = handQuaternion; - m_lastRotateHand = m_activeRotateHand; + m_lastRotateHand = m_activeTurnHand; } } // END of hand rotation } diff --git a/src/tabcontrollers/MoveCenterTabController.h b/src/tabcontrollers/MoveCenterTabController.h index e0651c0..46edebc 100644 --- a/src/tabcontrollers/MoveCenterTabController.h +++ b/src/tabcontrollers/MoveCenterTabController.h @@ -33,8 +33,6 @@ class MoveCenterTabController : public QObject setMoveShortcutRight NOTIFY moveShortcutRightChanged ) Q_PROPERTY( bool moveShortcutLeft READ moveShortcutLeft WRITE setMoveShortcutLeft NOTIFY moveShortcutLeftChanged ) - Q_PROPERTY( bool requireDoubleClick READ requireDoubleClick WRITE - setRequireDoubleClick NOTIFY requireDoubleClickChanged ) Q_PROPERTY( bool lockXToggle READ lockXToggle WRITE setLockX NOTIFY requireLockXChanged ) Q_PROPERTY( bool lockYToggle READ lockYToggle WRITE setLockY NOTIFY @@ -55,14 +53,13 @@ private: int m_rotation = 0; int m_tempRotation = 0; bool m_adjustChaperone = true; - bool m_rotateHand = false; + bool m_settingsHandTurningEnabled = false; bool m_moveShortcutRightPressed = false; bool m_moveShortcutLeftPressed = false; vr::TrackedDeviceIndex_t m_activeMoveController; float m_lastControllerPosition[3]; - bool m_moveShortcutRightEnabled = false; - bool m_moveShortcutLeftEnabled = false; - bool m_requireDoubleClick = false; + bool m_settingsRightHandDragEnabled = false; + bool m_settingsLeftHandDragEnabled = false; bool m_lockXToggle = false; bool m_lockYToggle = false; bool m_lockZToggle = false; @@ -74,22 +71,22 @@ private: vr::HmdQuaternion_t lastHmdQuaternion = { -1000.0, 0.0, 0.0, 0.0 }; vr::HmdQuaternion_t hmdQuaternion; double m_hmdYawTotal = 0.0; - vr::ETrackedControllerRole m_activeMoveHand + vr::ETrackedControllerRole m_activeDragHand = vr::TrackedControllerRole_Invalid; vr::ETrackedControllerRole m_lastMoveHand = vr::TrackedControllerRole_Invalid; - vr::ETrackedControllerRole m_activeRotateHand + vr::ETrackedControllerRole m_activeTurnHand = vr::TrackedControllerRole_Invalid; vr::ETrackedControllerRole m_lastRotateHand = vr::TrackedControllerRole_Invalid; - bool m_leftHandMovePressed = false; - bool m_rightHandMovePressed = false; - bool m_overrideLeftHandMovePressed = false; - bool m_overrideRightHandMovePressed = false; - bool m_leftHandRotatePressed = false; - bool m_rightHandRotatePressed = false; - bool m_overrideLeftHandRotatePressed = false; - bool m_overrideRightHandRotatePressed = false; + bool m_leftHandDragPressed = false; + bool m_rightHandDragPressed = false; + bool m_overrideLeftHandDragPressed = false; + bool m_overrideRightHandDragPressed = false; + bool m_leftHandTurnPressed = false; + bool m_rightHandTurnPressed = false; + bool m_overrideLeftHandTurnPressed = false; + bool m_overrideRightHandTurnPressed = false; unsigned settingsUpdateCounter = 0; @@ -111,7 +108,6 @@ public: bool rotateHand() const; bool moveShortcutRight() const; bool moveShortcutLeft() const; - bool requireDoubleClick() const; bool lockXToggle() const; bool lockYToggle() const; bool lockZToggle() const; @@ -119,18 +115,14 @@ public: void resetHmdYawTotal(); // actions: - void leftHandPlayspaceMove( bool leftHandMoveActive ); - void rightHandPlayspaceMove( bool rightHandMoveActive ); - void optionalOverrideLeftHandPlayspaceMove( - bool overrideLeftHandMoveActive ); - void optionalOverrideRightHandPlayspaceMove( - bool overrideRightHandMoveActive ); - void leftHandPlayspaceRotate( bool leftHandRotateActive ); - void rightHandPlayspaceRotate( bool rightHandRotateActive ); - void optionalOverrideLeftHandPlayspaceRotate( - bool overrideLeftHandRotateActive ); - void optionalOverrideRightHandPlayspaceRotate( - bool overrideRightHandRotateActive ); + void leftHandRoomDrag( bool leftHandDragActive ); + void rightHandRoomDrag( bool rightHandDragActive ); + void optionalOverrideLeftHandRoomDrag( bool overrideLeftHandDragActive ); + void optionalOverrideRightHandRoomDrag( bool overrideRightHandDragActive ); + void leftHandRoomTurn( bool leftHandTurnActive ); + void rightHandRoomTurn( bool rightHandTurnActive ); + void optionalOverrideLeftHandRoomTurn( bool overrideLeftHandTurnActive ); + void optionalOverrideRightHandRoomTurn( bool overrideRightHandTurnActive ); public slots: int trackingUniverse() const; @@ -150,7 +142,6 @@ public slots: void setMoveShortcutRight( bool value, bool notify = true ); void setMoveShortcutLeft( bool value, bool notify = true ); - void setRequireDoubleClick( bool value, bool notify = true ); void modOffsetX( float value, bool notify = true ); void modOffsetY( float value, bool notify = true ); @@ -174,7 +165,6 @@ signals: void rotateHandChanged( bool value ); void moveShortcutRightChanged( bool value ); void moveShortcutLeftChanged( bool value ); - void requireDoubleClickChanged( bool value ); void requireLockXChanged( bool value ); void requireLockYChanged( bool value ); void requireLockZChanged( bool value ); diff --git a/src/tabcontrollers/StatisticsTabController.cpp b/src/tabcontrollers/StatisticsTabController.cpp index ecf2592..e97aeb0 100644 --- a/src/tabcontrollers/StatisticsTabController.cpp +++ b/src/tabcontrollers/StatisticsTabController.cpp @@ -78,9 +78,8 @@ void StatisticsTabController::eventLoopTick( } // HMD Rotation // - double playspaceHmdYawTotal - = parent->m_moveCenterTabController.getHmdYawTotal(); - m_hmdRotation = static_cast( playspaceHmdYawTotal / ( 2.0 * M_PI ) ); + double roomHmdYawTotal = parent->m_moveCenterTabController.getHmdYawTotal(); + m_hmdRotation = static_cast( roomHmdYawTotal / ( 2.0 * M_PI ) ); if ( lastPosTimer <= 0 ) {