Added MyTextField and overhauled Playspace page.
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
import matzman666.advsettings 1.0
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
property int keyBoardUID: 0
|
||||||
|
id: myTextField
|
||||||
|
color: "#cccccc"
|
||||||
|
text: ""
|
||||||
|
font.pointSize: 20
|
||||||
|
background: Rectangle {
|
||||||
|
color: parent.activeFocus ? "#2c435d" : "#1b2939"
|
||||||
|
border.color: "#cccccc"
|
||||||
|
border.width: 2
|
||||||
|
}
|
||||||
|
onEditingFinished: {
|
||||||
|
if (OverlayController.desktopMode) {
|
||||||
|
myTextField.onInputEvent(text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onActiveFocusChanged: {
|
||||||
|
if (activeFocus && !OverlayController.desktopMode) {
|
||||||
|
OverlayController.showKeyboard(text, keyBoardUID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onInputEvent(input) {
|
||||||
|
text = input
|
||||||
|
}
|
||||||
|
Connections {
|
||||||
|
target: OverlayController
|
||||||
|
onKeyBoardInputSignal: {
|
||||||
|
if (userValue == keyBoardUID) {
|
||||||
|
myTextField.onInputEvent(input)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -61,15 +61,25 @@ MyStackViewPage {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
MoveCenterTabController.modOffsetX(-0.5)
|
MoveCenterTabController.modOffsetX(-0.5)
|
||||||
}
|
}
|
||||||
KeyNavigation.down: playSpaceMoveXPlusButton
|
|
||||||
focus : true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MyText {
|
MyTextField {
|
||||||
id: playSpaceMoveXText
|
id: playSpaceMoveXText
|
||||||
|
text: "0.00"
|
||||||
|
keyBoardUID: 101
|
||||||
|
Layout.preferredWidth: 100
|
||||||
|
Layout.leftMargin: 10
|
||||||
|
Layout.rightMargin: 10
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: "0.0"
|
function onInputEvent(input) {
|
||||||
Layout.preferredWidth: 120
|
var val = parseFloat(input)
|
||||||
|
if (!isNaN(val)) {
|
||||||
|
MoveCenterTabController.offsetX = val.toFixed(2)
|
||||||
|
text = MoveCenterTabController.offsetX.toFixed(2)
|
||||||
|
} else {
|
||||||
|
text = MoveCenterTabController.offsetX.toFixed(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyPushButton2 {
|
MyPushButton2 {
|
||||||
@@ -79,7 +89,6 @@ MyStackViewPage {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
MoveCenterTabController.modOffsetX(0.5)
|
MoveCenterTabController.modOffsetX(0.5)
|
||||||
}
|
}
|
||||||
KeyNavigation.up: playSpaceMoveXMinusButton
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MyText {
|
MyText {
|
||||||
@@ -95,11 +104,23 @@ MyStackViewPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyText {
|
MyTextField {
|
||||||
id: playSpaceMoveYText
|
id: playSpaceMoveYText
|
||||||
|
text: "0.00"
|
||||||
|
keyBoardUID: 102
|
||||||
|
Layout.preferredWidth: 100
|
||||||
|
Layout.leftMargin: 10
|
||||||
|
Layout.rightMargin: 10
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: "0.0"
|
function onInputEvent(input) {
|
||||||
Layout.preferredWidth: 120
|
var val = parseFloat(input)
|
||||||
|
if (!isNaN(val)) {
|
||||||
|
MoveCenterTabController.offsetY = val.toFixed(2)
|
||||||
|
text = MoveCenterTabController.offsetY.toFixed(2)
|
||||||
|
} else {
|
||||||
|
text = MoveCenterTabController.offsetY.toFixed(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyPushButton2 {
|
MyPushButton2 {
|
||||||
@@ -123,11 +144,23 @@ MyStackViewPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyText {
|
MyTextField {
|
||||||
id: playSpaceMoveZText
|
id: playSpaceMoveZText
|
||||||
|
text: "0.00"
|
||||||
|
keyBoardUID: 103
|
||||||
|
Layout.preferredWidth: 100
|
||||||
|
Layout.leftMargin: 10
|
||||||
|
Layout.rightMargin: 10
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: "0.0"
|
function onInputEvent(input) {
|
||||||
Layout.preferredWidth: 120
|
var val = parseFloat(input)
|
||||||
|
if (!isNaN(val)) {
|
||||||
|
MoveCenterTabController.offsetZ = val.toFixed(2)
|
||||||
|
text = MoveCenterTabController.offsetZ.toFixed(2)
|
||||||
|
} else {
|
||||||
|
text = MoveCenterTabController.offsetZ.toFixed(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyPushButton2 {
|
MyPushButton2 {
|
||||||
@@ -165,22 +198,24 @@ MyStackViewPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
||||||
MyPushButton2 {
|
MyPushButton2 {
|
||||||
id: playSpaceRotationMinusButton
|
id: playSpaceRotationMinusButton
|
||||||
Layout.preferredWidth: 40
|
Layout.preferredWidth: 40
|
||||||
text: "-"
|
text: "-"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
playspaceRotationSlider.value -= 45
|
var val = (MoveCenterTabController.rotation - 45) % 360
|
||||||
|
if (val < 0) {
|
||||||
|
val = 360 + val;
|
||||||
|
}
|
||||||
|
MoveCenterTabController.rotation = val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MySlider {
|
MySlider {
|
||||||
id: playspaceRotationSlider
|
id: playspaceRotationSlider
|
||||||
from: -360
|
from: 0
|
||||||
to: 360
|
to: 359
|
||||||
stepSize: 1
|
stepSize: 1
|
||||||
value: 0
|
value: 0
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -188,6 +223,10 @@ MyStackViewPage {
|
|||||||
var val = this.from + ( this.position * (this.to - this.from))
|
var val = this.from + ( this.position * (this.to - this.from))
|
||||||
playspaceRotationText.text = Math.round(val) + "°"
|
playspaceRotationText.text = Math.round(val) + "°"
|
||||||
}
|
}
|
||||||
|
onValueChanged: {
|
||||||
|
MoveCenterTabController.rotation = playspaceRotationSlider.value
|
||||||
|
playspaceRotationText.text = Math.round(playspaceRotationSlider.value) + "°"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyPushButton2 {
|
MyPushButton2 {
|
||||||
@@ -195,27 +234,34 @@ MyStackViewPage {
|
|||||||
Layout.preferredWidth: 40
|
Layout.preferredWidth: 40
|
||||||
text: "+"
|
text: "+"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
playspaceRotationSlider.value += 45
|
var val = (MoveCenterTabController.rotation + 45) % 360
|
||||||
|
if (val < 0) {
|
||||||
|
val = 360 + val;
|
||||||
|
}
|
||||||
|
MoveCenterTabController.rotation = val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyText {
|
MyTextField {
|
||||||
id: playspaceRotationText
|
id: playspaceRotationText
|
||||||
Layout.preferredWidth: 85
|
text: "0°"
|
||||||
horizontalAlignment: Text.AlignRight
|
keyBoardUID: 104
|
||||||
text: "-360°"
|
Layout.preferredWidth: 100
|
||||||
}
|
Layout.leftMargin: 10
|
||||||
}
|
Layout.rightMargin: 10
|
||||||
RowLayout {
|
horizontalAlignment: Text.AlignHCenter
|
||||||
Item {
|
function onInputEvent(input) {
|
||||||
Layout.fillWidth: true
|
var val = parseInt(input)
|
||||||
}
|
if (!isNaN(val)) {
|
||||||
MyPushButton {
|
val = val % 360
|
||||||
id: playspaceApplyButton
|
if (val < 0) {
|
||||||
text: "Apply"
|
val = 360 + val;
|
||||||
Layout.preferredWidth: 250
|
}
|
||||||
onClicked: {
|
MoveCenterTabController.rotation = val
|
||||||
MoveCenterTabController.rotation = playspaceRotationSlider.value
|
text = MoveCenterTabController.rotation + "°"
|
||||||
|
} else {
|
||||||
|
text = MoveCenterTabController.rotation + "°"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,6 +269,14 @@ MyStackViewPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MyToggleButton {
|
||||||
|
id: playspaceAdjustChaperoneToggle
|
||||||
|
text: "Adjust Chaperone"
|
||||||
|
onCheckedChanged: {
|
||||||
|
MoveCenterTabController.adjustChaperone = this.checked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item { Layout.fillHeight: true; Layout.fillWidth: true}
|
Item { Layout.fillHeight: true; Layout.fillWidth: true}
|
||||||
|
|
||||||
MyPushButton {
|
MyPushButton {
|
||||||
@@ -235,20 +289,19 @@ MyStackViewPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
playspaceAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone
|
||||||
playSpaceMoveXText.text = MoveCenterTabController.offsetX.toFixed(1)
|
playSpaceMoveXText.text = MoveCenterTabController.offsetX.toFixed(1)
|
||||||
playSpaceMoveYText.text = MoveCenterTabController.offsetY.toFixed(1)
|
playSpaceMoveYText.text = MoveCenterTabController.offsetY.toFixed(1)
|
||||||
playSpaceMoveZText.text = MoveCenterTabController.offsetZ.toFixed(1)
|
playSpaceMoveZText.text = MoveCenterTabController.offsetZ.toFixed(1)
|
||||||
playspaceRotationSlider.value = MoveCenterTabController.rotation
|
playspaceRotationSlider.value = MoveCenterTabController.rotation
|
||||||
if (MoveCenterTabController.trackingUniverse === 0) {
|
if (MoveCenterTabController.trackingUniverse === 0) {
|
||||||
playspaceModeText.text = "Sitting"
|
playspaceModeText.text = "Sitting"
|
||||||
playspaceApplyButton.enabled = false
|
|
||||||
playSpaceRotationPlusButton.enabled = false
|
playSpaceRotationPlusButton.enabled = false
|
||||||
playSpaceRotationMinusButton.enabled = false
|
playSpaceRotationMinusButton.enabled = false
|
||||||
playspaceRotationSlider.enabled = false
|
playspaceRotationSlider.enabled = false
|
||||||
playspaceRotationText.text = "-"
|
playspaceRotationText.text = "-"
|
||||||
} else if (MoveCenterTabController.trackingUniverse === 1) {
|
} else if (MoveCenterTabController.trackingUniverse === 1) {
|
||||||
playspaceModeText.text = "Standing"
|
playspaceModeText.text = "Standing"
|
||||||
playspaceApplyButton.enabled = true
|
|
||||||
playSpaceRotationPlusButton.enabled = true
|
playSpaceRotationPlusButton.enabled = true
|
||||||
playSpaceRotationMinusButton.enabled = true
|
playSpaceRotationMinusButton.enabled = true
|
||||||
playspaceRotationSlider.enabled = true
|
playspaceRotationSlider.enabled = true
|
||||||
@@ -261,17 +314,20 @@ MyStackViewPage {
|
|||||||
Connections {
|
Connections {
|
||||||
target: MoveCenterTabController
|
target: MoveCenterTabController
|
||||||
onOffsetXChanged: {
|
onOffsetXChanged: {
|
||||||
playSpaceMoveXText.text = MoveCenterTabController.offsetX.toFixed(1)
|
playSpaceMoveXText.text = MoveCenterTabController.offsetX.toFixed(2)
|
||||||
}
|
}
|
||||||
onOffsetYChanged: {
|
onOffsetYChanged: {
|
||||||
playSpaceMoveYText.text = MoveCenterTabController.offsetY.toFixed(1)
|
playSpaceMoveYText.text = MoveCenterTabController.offsetY.toFixed(2)
|
||||||
}
|
}
|
||||||
onOffsetZChanged: {
|
onOffsetZChanged: {
|
||||||
playSpaceMoveZText.text = MoveCenterTabController.offsetZ.toFixed(1)
|
playSpaceMoveZText.text = MoveCenterTabController.offsetZ.toFixed(2)
|
||||||
}
|
}
|
||||||
onRotationChanged: {
|
onRotationChanged: {
|
||||||
playspaceRotationSlider.value = MoveCenterTabController.rotation
|
playspaceRotationSlider.value = MoveCenterTabController.rotation
|
||||||
}
|
}
|
||||||
|
onAdjustChaperoneChanged: {
|
||||||
|
playspaceAdjustChaperoneToggle = value
|
||||||
|
}
|
||||||
onTrackingUniverseChanged: {
|
onTrackingUniverseChanged: {
|
||||||
if (MoveCenterTabController.trackingUniverse === 0) {
|
if (MoveCenterTabController.trackingUniverse === 0) {
|
||||||
playspaceModeText.text = "Sitting"
|
playspaceModeText.text = "Sitting"
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ namespace advsettings {
|
|||||||
|
|
||||||
class OverlayController : public QObject {
|
class OverlayController : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(bool desktopMode READ isDesktopMode)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr const char* applicationKey = "matzman666.AdvancedSettings";
|
static constexpr const char* applicationKey = "matzman666.AdvancedSettings";
|
||||||
@@ -93,6 +94,8 @@ public:
|
|||||||
void AddOffsetToCollisionBounds(unsigned axisId, float offset, bool commit = true);
|
void AddOffsetToCollisionBounds(unsigned axisId, float offset, bool commit = true);
|
||||||
void RotateCollisionBounds(float angle, bool commit = true); // around y axis
|
void RotateCollisionBounds(float angle, bool commit = true); // around y axis
|
||||||
|
|
||||||
|
bool isDesktopMode() { return desktopMode; };
|
||||||
|
|
||||||
Q_INVOKABLE QString getVersionString();
|
Q_INVOKABLE QString getVersionString();
|
||||||
Q_INVOKABLE QUrl getVRRuntimePathUrl();
|
Q_INVOKABLE QUrl getVRRuntimePathUrl();
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,13 @@ namespace advsettings {
|
|||||||
|
|
||||||
void MoveCenterTabController::initStage1() {
|
void MoveCenterTabController::initStage1() {
|
||||||
setTrackingUniverse(vr::VRCompositor()->GetTrackingSpace());
|
setTrackingUniverse(vr::VRCompositor()->GetTrackingSpace());
|
||||||
|
auto settings = OverlayController::appSettings();
|
||||||
|
settings->beginGroup("playspaceSettings");
|
||||||
|
auto value = settings->value("adjustChaperone", m_adjustChaperone);
|
||||||
|
settings->endGroup();
|
||||||
|
if (value.isValid() && !value.isNull()) {
|
||||||
|
m_adjustChaperone = value.toBool();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveCenterTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
void MoveCenterTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||||
@@ -35,10 +42,7 @@ float MoveCenterTabController::offsetX() const {
|
|||||||
|
|
||||||
void MoveCenterTabController::setOffsetX(float value, bool notify) {
|
void MoveCenterTabController::setOffsetX(float value, bool notify) {
|
||||||
if (m_offsetX != value) {
|
if (m_offsetX != value) {
|
||||||
m_offsetX = value;
|
modOffsetX(value - m_offsetX, notify);
|
||||||
if (notify) {
|
|
||||||
emit offsetXChanged(m_offsetX);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,10 +52,7 @@ float MoveCenterTabController::offsetY() const {
|
|||||||
|
|
||||||
void MoveCenterTabController::setOffsetY(float value, bool notify) {
|
void MoveCenterTabController::setOffsetY(float value, bool notify) {
|
||||||
if (m_offsetY != value) {
|
if (m_offsetY != value) {
|
||||||
m_offsetY = value;
|
modOffsetY(value - m_offsetY, notify);
|
||||||
if (notify) {
|
|
||||||
emit offsetYChanged(m_offsetY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,10 +62,7 @@ float MoveCenterTabController::offsetZ() const {
|
|||||||
|
|
||||||
void MoveCenterTabController::setOffsetZ(float value, bool notify) {
|
void MoveCenterTabController::setOffsetZ(float value, bool notify) {
|
||||||
if (m_offsetZ != value) {
|
if (m_offsetZ != value) {
|
||||||
m_offsetZ = value;
|
modOffsetZ(value - m_offsetZ, notify);
|
||||||
if (notify) {
|
|
||||||
emit offsetZChanged(m_offsetZ);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +73,7 @@ int MoveCenterTabController::rotation() const {
|
|||||||
void MoveCenterTabController::setRotation(int value, bool notify) {
|
void MoveCenterTabController::setRotation(int value, bool notify) {
|
||||||
if (m_rotation != value) {
|
if (m_rotation != value) {
|
||||||
float angle = (value - m_rotation) * 2 * M_PI / 360.0;
|
float angle = (value - m_rotation) * 2 * M_PI / 360.0;
|
||||||
parent->RotateUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, angle);
|
parent->RotateUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, angle, m_adjustChaperone);
|
||||||
m_rotation = value;
|
m_rotation = value;
|
||||||
if (notify) {
|
if (notify) {
|
||||||
emit rotationChanged(m_rotation);
|
emit rotationChanged(m_rotation);
|
||||||
@@ -83,46 +81,101 @@ void MoveCenterTabController::setRotation(int value, bool notify) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveCenterTabController::modOffsetX(float value) {
|
bool MoveCenterTabController::adjustChaperone() const {
|
||||||
|
return m_adjustChaperone;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MoveCenterTabController::setAdjustChaperone(bool value, bool notify) {
|
||||||
|
if (m_adjustChaperone != value) {
|
||||||
|
m_adjustChaperone = value;
|
||||||
|
if (m_trackingUniverse == vr::TrackingUniverseStanding) {
|
||||||
|
vr::VRChaperoneSetup()->RevertWorkingCopy();
|
||||||
|
if (m_adjustChaperone) {
|
||||||
|
if (m_offsetX != 0.0f) {
|
||||||
|
parent->AddOffsetToCollisionBounds(0, -m_offsetX, false);
|
||||||
|
}
|
||||||
|
if (m_offsetY != 0.0f) {
|
||||||
|
parent->AddOffsetToCollisionBounds(0, -m_offsetY, false);
|
||||||
|
}
|
||||||
|
if (m_offsetZ != 0.0f) {
|
||||||
|
parent->AddOffsetToCollisionBounds(0, -m_offsetZ, false);
|
||||||
|
}
|
||||||
|
if (m_rotation != 0) {
|
||||||
|
parent->RotateCollisionBounds(-m_rotation, false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (m_offsetX != 0.0f) {
|
||||||
|
parent->AddOffsetToCollisionBounds(0, m_offsetX, false);
|
||||||
|
}
|
||||||
|
if (m_offsetY != 0.0f) {
|
||||||
|
parent->AddOffsetToCollisionBounds(0, m_offsetY, false);
|
||||||
|
}
|
||||||
|
if (m_offsetZ != 0.0f) {
|
||||||
|
parent->AddOffsetToCollisionBounds(0, m_offsetZ, false);
|
||||||
|
}
|
||||||
|
if (m_rotation != 0) {
|
||||||
|
parent->RotateCollisionBounds(m_rotation, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
|
||||||
|
}
|
||||||
|
auto settings = OverlayController::appSettings();
|
||||||
|
settings->beginGroup("playspaceSettings");
|
||||||
|
settings->setValue("adjustChaperone", m_adjustChaperone);
|
||||||
|
settings->endGroup();
|
||||||
|
settings->sync();
|
||||||
|
if (notify) {
|
||||||
|
emit adjustChaperoneChanged(m_adjustChaperone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MoveCenterTabController::modOffsetX(float value, bool notify) {
|
||||||
if (m_rotation == 0) {
|
if (m_rotation == 0) {
|
||||||
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 0, value);
|
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 0, value, m_adjustChaperone);
|
||||||
} else {
|
} else {
|
||||||
auto angle = m_rotation * 2 * M_PI / 360.0;
|
auto angle = m_rotation * 2 * M_PI / 360.0;
|
||||||
vr::VRChaperoneSetup()->RevertWorkingCopy();
|
vr::VRChaperoneSetup()->RevertWorkingCopy();
|
||||||
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 0, value * std::cos(angle), true, false);
|
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 0, value * std::cos(angle), m_adjustChaperone, false);
|
||||||
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 2, value * std::sin(angle), true, false);
|
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 2, value * std::sin(angle), m_adjustChaperone, false);
|
||||||
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
|
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
|
||||||
}
|
}
|
||||||
m_offsetX += value;
|
m_offsetX += value;
|
||||||
emit offsetXChanged(m_offsetX);
|
if (notify) {
|
||||||
|
emit offsetXChanged(m_offsetX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveCenterTabController::modOffsetY(float value) {
|
void MoveCenterTabController::modOffsetY(float value, bool notify) {
|
||||||
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 1, value);
|
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 1, value, m_adjustChaperone);
|
||||||
m_offsetY += value;
|
m_offsetY += value;
|
||||||
emit offsetYChanged(m_offsetY);
|
if (notify) {
|
||||||
|
emit offsetYChanged(m_offsetY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveCenterTabController::modOffsetZ(float value) {
|
void MoveCenterTabController::modOffsetZ(float value, bool notify) {
|
||||||
if (m_rotation == 0) {
|
if (m_rotation == 0) {
|
||||||
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 2, value);
|
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 2, value, m_adjustChaperone);
|
||||||
} else {
|
} else {
|
||||||
auto angle = m_rotation * 2 * M_PI / 360.0;
|
auto angle = m_rotation * 2 * M_PI / 360.0;
|
||||||
vr::VRChaperoneSetup()->RevertWorkingCopy();
|
vr::VRChaperoneSetup()->RevertWorkingCopy();
|
||||||
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 2, value * std::cos(angle), true, false);
|
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 2, value * std::cos(angle), m_adjustChaperone, false);
|
||||||
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 0, -value * std::sin(angle), true, false);
|
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 0, -value * std::sin(angle), m_adjustChaperone, false);
|
||||||
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
|
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
|
||||||
}
|
}
|
||||||
m_offsetZ += value;
|
m_offsetZ += value;
|
||||||
emit offsetZChanged(m_offsetZ);
|
if (notify) {
|
||||||
|
emit offsetZChanged(m_offsetZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveCenterTabController::reset() {
|
void MoveCenterTabController::reset() {
|
||||||
vr::VRChaperoneSetup()->RevertWorkingCopy();
|
vr::VRChaperoneSetup()->RevertWorkingCopy();
|
||||||
parent->RotateUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, -m_rotation * 2 * M_PI / 360.0);
|
parent->RotateUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, -m_rotation * 2 * M_PI / 360.0, m_adjustChaperone, false);
|
||||||
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 0, -m_offsetX, true, false);
|
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 0, -m_offsetX, m_adjustChaperone, false);
|
||||||
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 1, -m_offsetY, true, false);
|
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 1, -m_offsetY, m_adjustChaperone, false);
|
||||||
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 2, -m_offsetZ, true, false);
|
parent->AddOffsetToUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, 2, -m_offsetZ, m_adjustChaperone, false);
|
||||||
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
|
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
|
||||||
m_offsetX = 0.0f;
|
m_offsetX = 0.0f;
|
||||||
m_offsetY = 0.0f;
|
m_offsetY = 0.0f;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class MoveCenterTabController : public QObject {
|
|||||||
Q_PROPERTY(float offsetY READ offsetY WRITE setOffsetY NOTIFY offsetYChanged)
|
Q_PROPERTY(float offsetY READ offsetY WRITE setOffsetY NOTIFY offsetYChanged)
|
||||||
Q_PROPERTY(float offsetZ READ offsetZ WRITE setOffsetZ NOTIFY offsetZChanged)
|
Q_PROPERTY(float offsetZ READ offsetZ WRITE setOffsetZ NOTIFY offsetZChanged)
|
||||||
Q_PROPERTY(int rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
|
Q_PROPERTY(int rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
|
||||||
|
Q_PROPERTY(bool adjustChaperone READ adjustChaperone WRITE setAdjustChaperone NOTIFY adjustChaperoneChanged)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OverlayController* parent;
|
OverlayController* parent;
|
||||||
@@ -29,6 +30,7 @@ private:
|
|||||||
float m_offsetY = 0.0f;
|
float m_offsetY = 0.0f;
|
||||||
float m_offsetZ = 0.0f;
|
float m_offsetZ = 0.0f;
|
||||||
int m_rotation = 0;
|
int m_rotation = 0;
|
||||||
|
bool m_adjustChaperone = true;
|
||||||
|
|
||||||
unsigned settingsUpdateCounter = 0;
|
unsigned settingsUpdateCounter = 0;
|
||||||
|
|
||||||
@@ -42,6 +44,7 @@ public:
|
|||||||
float offsetY() const;
|
float offsetY() const;
|
||||||
float offsetZ() const;
|
float offsetZ() const;
|
||||||
int rotation() const;
|
int rotation() const;
|
||||||
|
bool adjustChaperone() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
int trackingUniverse() const;
|
int trackingUniverse() const;
|
||||||
@@ -53,9 +56,11 @@ public slots:
|
|||||||
|
|
||||||
void setRotation(int value, bool notify = true);
|
void setRotation(int value, bool notify = true);
|
||||||
|
|
||||||
void modOffsetX(float value);
|
void setAdjustChaperone(bool value, bool notify = true);
|
||||||
void modOffsetY(float value);
|
|
||||||
void modOffsetZ(float value);
|
void modOffsetX(float value, bool notify = true);
|
||||||
|
void modOffsetY(float value, bool notify = true);
|
||||||
|
void modOffsetZ(float value, bool notify = true);
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -64,6 +69,7 @@ signals:
|
|||||||
void offsetYChanged(float value);
|
void offsetYChanged(float value);
|
||||||
void offsetZChanged(float value);
|
void offsetZChanged(float value);
|
||||||
void rotationChanged(int value);
|
void rotationChanged(int value);
|
||||||
|
void adjustChaperoneChanged(bool value);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace advsettings
|
} // namespace advsettings
|
||||||
|
|||||||
Reference in New Issue
Block a user