diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 1bd6af2eba..e2c4df22db 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3534,6 +3534,7 @@ void Application::setIsInterstitialMode(bool interstitialMode) { if (enableInterstitial) { if (_interstitialMode != interstitialMode) { _interstitialMode = interstitialMode; + emit interstitialModeChanged(_interstitialMode); DependencyManager::get()->setAudioPaused(_interstitialMode); DependencyManager::get()->setMyAvatarDataPacketsPaused(_interstitialMode); diff --git a/interface/src/Application.h b/interface/src/Application.h index c75c2e9efc..a706c38f58 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -335,6 +335,8 @@ signals: void uploadRequest(QString path); + void interstitialModeChanged(bool isInInterstitialMode); + void loginDialogPoppedUp(); public slots: diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index 75f17def20..0f3d859093 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -54,6 +54,9 @@ WindowScriptingInterface::WindowScriptingInterface() { }); connect(qApp->getWindow(), &MainWindow::windowGeometryChanged, this, &WindowScriptingInterface::onWindowGeometryChanged); + connect(qApp, &Application::interstitialModeChanged, [this] (bool interstitialMode) { + emit interstitialModeChanged(interstitialMode); + }); } WindowScriptingInterface::~WindowScriptingInterface() { diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index f6a5a5ef74..ef3dfcef4b 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -619,6 +619,14 @@ signals: */ void redirectErrorStateChanged(bool isInErrorState); + /**jsdoc + * Triggered when interstitial mode changes. + * @function Window.interstitialModeChanged + * @param {bool} interstitialMode - The mode of the interstitial is changed to. + * @returns {Signal} + */ + void interstitialModeChanged(bool interstitialMode); + /**jsdoc * Triggered when a still snapshot has been taken by calling {@link Window.takeSnapshot|takeSnapshot} with * includeAnimated = false or {@link Window.takeSecondaryCameraSnapshot|takeSecondaryCameraSnapshot}. diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 19e603b4ab..4f73d8e598 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -14,6 +14,7 @@ (function() { Script.include("/~/system/libraries/Xform.js"); + Script.include("/~/system/libraries/globals.js"); var DEBUG = false; var MIN_LOADING_PROGRESS = 3.6; var TOTAL_LOADING_PROGRESS = 3.8; @@ -379,6 +380,12 @@ var currentProgress = 0.1; function updateOverlays(physicsEnabled) { + + if (isInterstitialOverlaysVisible !== !physicsEnabled && !physicsEnabled === true) { + // visible changed to true. + isInterstitialOverlaysVisible = !physicsEnabled; + } + var properties = { visible: !physicsEnabled }; @@ -425,6 +432,11 @@ if (physicsEnabled) { Camera.mode = previousCameraMode; } + + if (isInterstitialOverlaysVisible !== !physicsEnabled && !physicsEnabled === false) { + // visible changed to false. + isInterstitialOverlaysVisible = !physicsEnabled; + } } function scaleInterstitialPage(sensorToWorldScale) { diff --git a/scripts/system/libraries/globals.js b/scripts/system/libraries/globals.js index 0c382314c9..b51a905e0a 100644 --- a/scripts/system/libraries/globals.js +++ b/scripts/system/libraries/globals.js @@ -9,3 +9,5 @@ // HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; + +isInterstitialOverlaysVisible = false; diff --git a/scripts/system/progress.js b/scripts/system/progress.js index db09d40608..b373612790 100644 --- a/scripts/system/progress.js +++ b/scripts/system/progress.js @@ -14,11 +14,11 @@ // (function () { // BEGIN LOCAL_SCOPE - function debug() { //print.apply(null, arguments); } + Script.include("/~/system/libraries/globals.js"); var rawProgress = 100, // % raw value. displayProgress = 100, // % smoothed value to display. alpha = 0.0, @@ -83,7 +83,9 @@ // The initial delay cooldown keeps us from tracking progress before the allotted time // has passed. INITIAL_DELAY_COOLDOWN_TIME = 1000, - initialDelayCooldown = 0; + initialDelayCooldown = 0, + + isInInterstitialMode = false; function fade() { @@ -265,7 +267,7 @@ // Update state if (!visible) { // Not visible because no recent downloads - if (displayProgress < 100 || gpuTextures > 0) { // Have started downloading so fade in + if ((displayProgress < 100 || gpuTextures > 0) && !isInInterstitialMode && !isInterstitialOverlaysVisible) { // Have started downloading so fade in visible = true; alphaDelta = ALPHA_DELTA_IN; fadeTimer = Script.setInterval(fade, FADE_INTERVAL); @@ -305,10 +307,13 @@ } else { x = x * BAR_HMD_REPEAT; } + if (isInInterstitialMode || isInterstitialOverlaysVisible) { + visible = false; + } // Update progress bar Overlays.editOverlay(barDesktop.overlay, { - visible: !isHMD, + visible: !isHMD && visible, bounds: { x: barDesktop.repeat - x, y: windowHeight - barDesktop.height, @@ -318,7 +323,7 @@ }); Overlays.editOverlay(barHMD.overlay, { - visible: isHMD, + visible: isHMD && visible, bounds: { x: BAR_HMD_REPEAT - x, y: windowHeight - BAR_HMD_HEIGHT, @@ -328,11 +333,11 @@ }); Overlays.editOverlay(textDesktop.overlay, { - visible: !isHMD + visible: !isHMD && visible }); Overlays.editOverlay(textHMD.overlay, { - visible: isHMD + visible: isHMD && visible }); // Update 2D overlays to maintain positions at bottom middle of window @@ -344,6 +349,10 @@ } } + function interstitialModeChanged(inMode) { + isInInterstitialMode = inMode; + } + function setUp() { var is4k = Window.innerWidth > 3000; @@ -369,6 +378,7 @@ } setUp(); + Window.interstitialModeChanged.connect(interstitialModeChanged); GlobalServices.downloadInfoChanged.connect(onDownloadInfoChanged); GlobalServices.updateDownloadInfo(); Script.setInterval(update, 1000 / 60);