fixed persistant ui element when switching from HMD to Desktop. not a complete fix but sufficient for M1

This commit is contained in:
Preston Bezos 2019-06-11 16:29:32 -07:00
parent e213fd6b5e
commit b32a715496
3 changed files with 51 additions and 4 deletions

40
diff.patch Normal file
View file

@ -0,0 +1,40 @@
diff --git a/scripts/simplifiedUI/ui/simplifiedUI.js b/scripts/simplifiedUI/ui/simplifiedUI.js
index cdf6a9591a..4116eb4314 100644
--- a/scripts/simplifiedUI/ui/simplifiedUI.js
+++ b/scripts/simplifiedUI/ui/simplifiedUI.js
@@ -457,9 +457,16 @@ function onGeometryChanged(rect) {
}
}
-function ensureFirstPersonCameraInHMD(isHMDMode) {
+function onDisplayModeChanged(isHMDMode) {
+ print("TEST 2");
if (isHMDMode) {
Camera.setModeString("first person");
+ } else {
+ //setTimeout(function () {
+ toolbar.writeProperty("visible", false);
+ print("TEST");
+ //}, 10000);
+
}
}
@@ -505,7 +512,7 @@ function startup() {
updateOutputDeviceMutedOverlay(isOutputMuted());
Audio.mutedDesktopChanged.connect(onDesktopInputDeviceMutedChanged);
Window.geometryChanged.connect(onGeometryChanged);
- HMD.displayModeChanged.connect(ensureFirstPersonCameraInHMD);
+ HMD.displayModeChanged.connect(onDisplayModeChanged);
Audio.avatarGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Audio.localInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Audio.serverInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
@@ -559,7 +566,7 @@ function shutdown() {
Audio.mutedDesktopChanged.disconnect(onDesktopInputDeviceMutedChanged);
Window.geometryChanged.disconnect(onGeometryChanged);
- HMD.displayModeChanged.disconnect(ensureFirstPersonCameraInHMD);
+ HMD.displayModeChanged.disconnect(onDisplayModeChanged);
Audio.avatarGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Audio.localInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Audio.serverInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);

View file

@ -978,7 +978,7 @@ Setting::Handle<int> sessionRunTime{ "sessionRunTime", 0 };
const float DEFAULT_HMD_TABLET_SCALE_PERCENT = 60.0f;
const float DEFAULT_DESKTOP_TABLET_SCALE_PERCENT = 75.0f;
const bool DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR = true;
const bool DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR = false;
const bool DEFAULT_HMD_TABLET_BECOMES_TOOLBAR = false;
const bool DEFAULT_PREFER_STYLUS_OVER_LASER = false;
const bool DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS = false;
@ -9301,6 +9301,7 @@ void Application::updateSystemTabletMode() {
if (isHMDMode()) {
DependencyManager::get<TabletScriptingInterface>()->setToolbarMode(getHmdTabletBecomesToolbarSetting());
} else {
//_desktopTabletBecomesToolbarSetting.set(false);
DependencyManager::get<TabletScriptingInterface>()->setToolbarMode(getDesktopTabletBecomesToolbarSetting());
}
}

View file

@ -457,9 +457,15 @@ function onGeometryChanged(rect) {
}
}
function ensureFirstPersonCameraInHMD(isHMDMode) {
function onDisplayModeChanged(isHMDMode) {
if (isHMDMode) {
Camera.setModeString("first person");
} else {
//works for now, but not a permanent fix by any means.
Script.setTimeout(function () {
var toolbar = Toolbars.getToolbar(TOOLBAR_NAME);
toolbar.writeProperty("visible", false);
}, 700);
}
}
@ -505,7 +511,7 @@ function startup() {
updateOutputDeviceMutedOverlay(isOutputMuted());
Audio.mutedDesktopChanged.connect(onDesktopInputDeviceMutedChanged);
Window.geometryChanged.connect(onGeometryChanged);
HMD.displayModeChanged.connect(ensureFirstPersonCameraInHMD);
HMD.displayModeChanged.connect(onDisplayModeChanged);
Audio.avatarGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Audio.localInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Audio.serverInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
@ -559,7 +565,7 @@ function shutdown() {
Audio.mutedDesktopChanged.disconnect(onDesktopInputDeviceMutedChanged);
Window.geometryChanged.disconnect(onGeometryChanged);
HMD.displayModeChanged.disconnect(ensureFirstPersonCameraInHMD);
HMD.displayModeChanged.disconnect(onDisplayModeChanged);
Audio.avatarGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Audio.localInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Audio.serverInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);