Option to gently fade chaperone to disabled below a certain height (#622)

* Option to fade out chaperone when HMD goes below a configured height

Useful for setups in which you have a seat just outside your VR space,
or like to sit in the middle of your space for any amount of time. Will
fade out the boundaries to 0% opacity over 5 seconds, 5 seconds after
you sit down. Standing back up to the configured height will make them
pop back in immediately.

Can be found under Chaperone -> Additional Settings.

* Update format.sh to require clang-format v10

* Use fade distance instead of opacity, opacity inconsistently applied

* Bugfixes (#624)

* stop crashing on HMD Init Errors, as well as bypass force quit on all steamvr Init Errors

* add qtc clang to gitignore

* add app volume adjustment

* adjust app volume placement in menu

* fix type error

* increment version

* fix version number

---------

Co-authored-by: ykeara <ykeara1@gmail.com>
This commit is contained in:
Chelsea Jaggi
2023-05-17 14:21:59 -05:00
committed by GitHub
co-authored by ykeara
parent 65b5aace06
commit 1cfd9ff104
14 changed files with 340 additions and 14 deletions
+71
View File
@@ -18,6 +18,73 @@ MyStackViewPage {
ColumnLayout {
spacing: 18
RowLayout{
MyText {
text: "Application Volume:"
Layout.rightMargin: 12
}
MyPushButton2 {
text: "-"
Layout.preferredWidth: 40
onClicked: {
volumeSlider.value -= 0.05
}
}
MySlider {
id: volumeSlider
from: 0.0
to: 1.0
stepSize: 0.01
value: 0.7
Layout.fillWidth: true
onPositionChanged: {
var val = (this.value * 100)
volumeText.text = Math.round(val) + "%"
}
onValueChanged: {
OverlayController.setSoundVolume(value, false)
}
}
MyPushButton2 {
text: "+"
Layout.preferredWidth: 40
onClicked: {
volumeSlider.value += 0.05
}
}
MyTextField {
id: volumeText
text: "70%"
keyBoardUID: 503
Layout.preferredWidth: 100
Layout.leftMargin: 10
horizontalAlignment: Text.AlignHCenter
function onInputEvent(input) {
var val = parseFloat(input)
if (!isNaN(val)) {
if (val < 0) {
val = 0
} else if (val > 100.0) {
val = 100.0
}
var v = (val/100).toFixed(0)
if (v <= volumeSlider.to) {
chaperoneVisibilitySlider.value = v
} else {
ChaperoneTabController.setBoundsVisibility(v, false)
}
}
text = Math.round(ChaperoneTabController.boundsVisibility * 100) + "%"
}
}
}
MyToggleButton {
id: settingsAutoStartToggle
text: "Autostart"
@@ -295,6 +362,7 @@ MyStackViewPage {
seatedOldExternalWarning.visible = MoveCenterTabController.allowExternalEdits && MoveCenterTabController.oldStyleMotion
reloadChaperoneProfiles()
volumeSlider.value = OverlayController.soundVolume
}
Connections {
@@ -357,6 +425,9 @@ MyStackViewPage {
onAutoApplyChaperoneEnabledChanged: {
autoApplyChaperoneToggleButton.checked = OverlayController.autoApplyChaperoneEnabled
}
onSoundVolumeChanged:{
volumeSlider.value = OverlayController.soundVolume
}
}
Connections{
target: ChaperoneTabController
+28 -1
View File
@@ -244,6 +244,7 @@ MyStackViewPage {
}
MyPushButton2 {
id: chaperoneVisibilityMinus
text: "-"
Layout.preferredWidth: 40
onClicked: {
@@ -268,6 +269,7 @@ MyStackViewPage {
}
MyPushButton2 {
id: chaperoneVisibilityPlus
text: "+"
Layout.preferredWidth: 40
onClicked: {
@@ -561,7 +563,13 @@ MyStackViewPage {
chaperonePlaySpaceToggle.checked = ChaperoneTabController.playSpaceMarker
chaperoneForceBoundsToggle.checked = ChaperoneTabController.forceBounds
chaperoneDisableChaperone.checked = ChaperoneTabController.disableChaperone
if(chaperoneDisableChaperone.checked){
var dim = ChaperoneTabController.chaperoneDimHeight
if(dim > 0.0){
chaperoneDisableChaperone.enabled = false;
}else{
chaperoneDisableChaperone.enabled = true;
}
if(dim > 0.0 || chaperoneDisableChaperone.checked){
chaperoneFadeDistanceMinus.enabled = false;
chaperoneFadeDistancePlus.enabled = false;
chaperoneFadeDistanceSlider.enabled = false;
@@ -597,7 +605,26 @@ MyStackViewPage {
}
chaperoneHeightText.text = h
}
onChaperoneDimHeightChanged: {
var dim = ChaperoneTabController.chaperoneDimHeight
if(dim > 0.0){
chaperoneDisableChaperone.enabled = false;
}else{
chaperoneDisableChaperone.enabled = true;
}
if(dim > 0.0 || chaperoneDisableChaperone.checked){
chaperoneFadeDistanceMinus.enabled = false;
chaperoneFadeDistancePlus.enabled = false;
chaperoneFadeDistanceSlider.enabled = false;
chaperoneFadeDistanceText.enabled = false;
}else{
chaperoneFadeDistanceMinus.enabled = true;
chaperoneFadeDistancePlus.enabled = true;
chaperoneFadeDistanceSlider.enabled = true;
chaperoneFadeDistanceText.enabled = true;
}
}
onCenterMarkerNewChanged: {
chaperoneCenterMarkerToggle.checked = ChaperoneTabController.centerMarkerNew
}
@@ -28,9 +28,100 @@ MyStackViewPage {
Layout.fillHeight: true
}
GridLayout {
columns: 5
MyText {
text: "Disable chaperone below height: "
Layout.preferredWidth: 400
}
MyPushButton2 {
id: dimHeightMinusButton
Layout.preferredWidth: 40
text: "-"
onClicked: {
var val = ChaperoneTabController.chaperoneDimHeight - 0.1
if (val <= 0.0) {
val = 0.0;
}
ChaperoneTabController.chaperoneDimHeight = val.toFixed(2)
}
}
MySlider {
id: dimHeightSlider
from: 0
to: 2.0
stepSize: 0.01
value: 0.0
Layout.fillWidth: true
onPositionChanged: {
var val = this.from + ( this.position * (this.to - this.from))
dimHeightText.text = val.toFixed(2)
}
onValueChanged: {
var val = dimHeightSlider.value.toFixed(2)
if (val < 0.01) {
val = 0.00
}
ChaperoneTabController.chaperoneDimHeight = val
dimHeightText.text = val
}
}
MyPushButton2 {
id: dimHeightPlusButton
Layout.preferredWidth: 40
text: "+"
onClicked: {
var val = ChaperoneTabController.chaperoneDimHeight + 0.1
if (val > 2.0) {
val = 2.0;
}
ChaperoneTabController.chaperoneDimHeight = val.toFixed(2)
}
}
MyTextField {
id: dimHeightText
text: "0.00"
keyBoardUID: 802
Layout.preferredWidth: 100
Layout.leftMargin: 10
horizontalAlignment: Text.AlignHCenter
function onInputEvent(input) {
var val = parseFloat(input)
if (!isNaN(val)) {
if (val <= 0.0) {
val = 0.0
}
val = val.toFixed(2)
ChaperoneTabController.chaperoneDimHeight = val
text = val
} else {
text = ChaperoneTabController.chaperoneDimHeight.toFixed(2)
}
}
}
}
Component.onCompleted: {
var d = ChaperoneTabController.chaperoneDimHeight.toFixed(2)
dimHeightSlider.value = d
dimHeightText.text = d
}
Connections {
target: ChaperoneTabController
onChaperoneDimHeightChanged: {
var d = ChaperoneTabController.chaperoneDimHeight.toFixed(2)
if (d <= dimHeightSlider.to && Math.abs(dimHeightSlider.value - d) > 0.0008) {
dimHeightSlider.value = d
}
dimHeightText.text = d
}
}
}
}