From 10d045b11b0dfe78eda1dcb82260dfe3dcf0503f Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 8 Nov 2018 17:16:34 -0800 Subject: [PATCH 1/4] fix infinate loading if entity server is not running --- interface/src/Application.cpp | 1 + interface/src/octree/SafeLanding.cpp | 15 ++++++++++++++- interface/src/octree/SafeLanding.h | 1 + scripts/system/interstitialPage.js | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 75a9f598f7..a9d75e745c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5705,6 +5705,7 @@ void Application::update(float deltaTime) { quint64 now = usecTimestampNow(); if (isServerlessMode() || _octreeProcessor.isLoadSequenceComplete()) { bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); + if (gpuTextureMemSizeStable() || !enableInterstitial) { // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway _lastPhysicsCheckTime = now; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index db381d5350..224ef064b6 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -11,6 +11,7 @@ #include "SafeLanding.h" +#include #include #include "EntityTreeRenderer.h" @@ -19,6 +20,8 @@ #include "Application.h" const int SafeLanding::SEQUENCE_MODULO = std::numeric_limits::max() + 1; +const quint64 MAX_ELAPSED_TIME = 1000; // msec +const quint64 MICRO_TO_MILI_SECONDS = 1000; namespace { template bool lessThanWraparound(int a, int b) { @@ -107,7 +110,9 @@ void SafeLanding::noteReceivedsequenceNumber(int sequenceNumber) { } bool SafeLanding::isLoadSequenceComplete() { - if (isEntityLoadingComplete() && isSequenceNumbersComplete()) { + quint64 elapsedTime = (usecTimestampNow() - _startTime) / MICRO_TO_MILI_SECONDS; + if ((isEntityLoadingComplete() && isSequenceNumbersComplete()) || + (elapsedTime >= MAX_ELAPSED_TIME && isEntityServerNotRunning() && _sequenceNumbers.empty())) { Locker lock(_lock); _initialStart = INVALID_SEQUENCE; _initialEnd = INVALID_SEQUENCE; @@ -119,6 +124,14 @@ bool SafeLanding::isLoadSequenceComplete() { return !_trackingEntities; } +bool SafeLanding::isEntityServerNotRunning() { + auto nodeList = DependencyManager::get(); + const auto& domainHandler = nodeList->getDomainHandler(); + auto entityServer = nodeList->soloNodeOfType(NodeType::EntityServer); + + return (domainHandler.isConnected() && !entityServer); +} + float SafeLanding::loadingProgressPercentage() { Locker lock(_lock); static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15; diff --git a/interface/src/octree/SafeLanding.h b/interface/src/octree/SafeLanding.h index 51357b60ff..157fda53aa 100644 --- a/interface/src/octree/SafeLanding.h +++ b/interface/src/octree/SafeLanding.h @@ -40,6 +40,7 @@ private: bool isSequenceNumbersComplete(); void debugDumpSequenceIDs() const; bool isEntityLoadingComplete(); + bool isEntityServerNotRunning(); std::mutex _lock; using Locker = std::lock_guard; diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index b7c5809b3a..9a67964801 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -15,7 +15,7 @@ (function() { Script.include("/~/system/libraries/Xform.js"); Script.include("/~/system/libraries/globals.js"); - var DEBUG = false; + var DEBUG = true; var TOTAL_LOADING_PROGRESS = 3.7; var EPSILON = 0.05; var TEXTURE_EPSILON = 0.01; From 1a95ee2b31fcb3b0dcb77d758ce17d9d4d9fb14a Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 9 Nov 2018 09:27:55 -0800 Subject: [PATCH 2/4] making requested changes --- interface/src/octree/SafeLanding.cpp | 4 ++-- scripts/system/interstitialPage.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 224ef064b6..ff32e03006 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -13,6 +13,7 @@ #include #include +#include #include "EntityTreeRenderer.h" #include "RenderableModelEntityItem.h" @@ -21,7 +22,6 @@ const int SafeLanding::SEQUENCE_MODULO = std::numeric_limits::max() + 1; const quint64 MAX_ELAPSED_TIME = 1000; // msec -const quint64 MICRO_TO_MILI_SECONDS = 1000; namespace { template bool lessThanWraparound(int a, int b) { @@ -110,7 +110,7 @@ void SafeLanding::noteReceivedsequenceNumber(int sequenceNumber) { } bool SafeLanding::isLoadSequenceComplete() { - quint64 elapsedTime = (usecTimestampNow() - _startTime) / MICRO_TO_MILI_SECONDS; + quint64 elapsedTime = (usecTimestampNow() - _startTime) / USECS_PER_MSEC; if ((isEntityLoadingComplete() && isSequenceNumbersComplete()) || (elapsedTime >= MAX_ELAPSED_TIME && isEntityServerNotRunning() && _sequenceNumbers.empty())) { Locker lock(_lock); diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 9a67964801..cd8869d805 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -15,7 +15,7 @@ (function() { Script.include("/~/system/libraries/Xform.js"); Script.include("/~/system/libraries/globals.js"); - var DEBUG = true; + var DEBUG = false; var TOTAL_LOADING_PROGRESS = 3.7; var EPSILON = 0.05; var TEXTURE_EPSILON = 0.01; @@ -197,7 +197,7 @@ var loadingBarProgress = Overlays.addOverlay("image3d", { name: "Loading-Bar-Progress", - localPosition: { x: 0.0, y: -0.86, z: 0.0 }, + localPosition: { x: 0.0, y: -0.91, z: 0.0 }, url: LOADING_BAR_PROGRESS, alpha: 1, dimensions: { x: TOTAL_LOADING_PROGRESS, y: 0.3}, @@ -482,7 +482,7 @@ var end = 0; var xLocalPosition = (progressPercentage * (end - start)) + start; var properties = { - localPosition: { x: xLocalPosition, y: -0.93, z: 0.0 }, + localPosition: { x: xLocalPosition, y: -0.91, z: 0.0 }, dimensions: { x: progress, y: 0.3 From 812373cdabe1f8aa81fd3f427bbc58b6326c84c9 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 9 Nov 2018 10:37:21 -0800 Subject: [PATCH 3/4] fixing loading bar visual --- scripts/system/interstitialPage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index cd8869d805..e4dc778985 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -274,6 +274,7 @@ previousCameraMode = Camera.mode; Camera.mode = "first person"; updateProgressBar(0.0); + scaleInterstitialPage(MyAvatar.sensorToWorldScale); timer = Script.setTimeout(update, 2000); } } @@ -482,7 +483,7 @@ var end = 0; var xLocalPosition = (progressPercentage * (end - start)) + start; var properties = { - localPosition: { x: xLocalPosition, y: -0.91, z: 0.0 }, + localPosition: { x: xLocalPosition, y: (HMD.active ? -0.93 : -0.91), z: 0.0 }, dimensions: { x: progress, y: 0.3 From 20ad05726efd0d86dac24f924f36d741b76cd014 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 13 Nov 2018 15:13:30 -0800 Subject: [PATCH 4/4] entity server timout --- .../qml/hifi/tablet/TabletAddressDialog.qml | 2 +- interface/src/Application.cpp | 26 ++++++++++++++++++- interface/src/Application.h | 4 +++ interface/src/octree/SafeLanding.cpp | 15 +---------- interface/src/octree/SafeLanding.h | 1 - 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index b8972378ad..ab0a98a8c5 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -56,7 +56,7 @@ StackView { Qt.callLater(function() { addressBarDialog.keyboardEnabled = HMD.active; addressLine.forceActiveFocus(); - addressBarDialog.raised = true; + addressBarDialog.keyboardRaised = true; }) } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index a9d75e745c..47a73cee57 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -371,6 +371,8 @@ static const QString INFO_HELP_PATH = "html/tabletHelp.html"; static const unsigned int THROTTLED_SIM_FRAMERATE = 15; static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SIM_FRAMERATE; +static const int ENTITY_SERVER_ADDED_TIMEOUT = 5000; +static const int ENTITY_SERVER_CONNECTION_TIMEOUT = 5000; static const uint32_t INVALID_FRAME = UINT32_MAX; @@ -1224,6 +1226,18 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo getOverlays().deleteOverlay(getTabletScreenID()); getOverlays().deleteOverlay(getTabletHomeButtonID()); getOverlays().deleteOverlay(getTabletFrameID()); + _failedToConnectToEntityServer = false; + }); + + _entityServerConnectionTimer.setSingleShot(true); + connect(&_entityServerConnectionTimer, &QTimer::timeout, this, &Application::setFailedToConnectToEntityServer); + + connect(&domainHandler, &DomainHandler::connectedToDomain, this, [this]() { + if (!isServerlessMode()) { + _entityServerConnectionTimer.setInterval(ENTITY_SERVER_ADDED_TIMEOUT); + _entityServerConnectionTimer.start(); + _failedToConnectToEntityServer = false; + } }); connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &Application::domainConnectionRefused); @@ -6630,7 +6644,13 @@ void Application::resettingDomain() { } void Application::nodeAdded(SharedNodePointer node) const { - // nothing to do here + if (node->getType() == NodeType::EntityServer) { + if (!_failedToConnectToEntityServer) { + _entityServerConnectionTimer.stop(); + _entityServerConnectionTimer.setInterval(ENTITY_SERVER_CONNECTION_TIMEOUT); + _entityServerConnectionTimer.start(); + } + } } void Application::nodeActivated(SharedNodePointer node) { @@ -6658,6 +6678,10 @@ void Application::nodeActivated(SharedNodePointer node) { if (node->getType() == NodeType::EntityServer) { _queryExpiry = SteadyClock::now(); _octreeQuery.incrementConnectionID(); + + if (!_failedToConnectToEntityServer) { + _entityServerConnectionTimer.stop(); + } } if (node->getType() == NodeType::AudioMixer && !isInterstitialMode()) { diff --git a/interface/src/Application.h b/interface/src/Application.h index 14e30b8006..053cb158e0 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -307,6 +307,7 @@ public: bool isServerlessMode() const; bool isInterstitialMode() const { return _interstitialMode; } + bool failedToConnectToEntityServer() const { return _failedToConnectToEntityServer; } void replaceDomainContent(const QString& url); @@ -460,6 +461,7 @@ private slots: void loadSettings(); void saveSettings() const; + void setFailedToConnectToEntityServer() { _failedToConnectToEntityServer = true; } bool acceptSnapshot(const QString& urlString); bool askToSetAvatarUrl(const QString& url); @@ -710,6 +712,7 @@ private: bool _isForeground = true; // starts out assumed to be in foreground bool _isGLInitialized { false }; bool _physicsEnabled { false }; + bool _failedToConnectToEntityServer { false }; bool _reticleClickPressed { false }; @@ -756,6 +759,7 @@ private: QStringList _addAssetToWorldInfoMessages; // Info message QTimer _addAssetToWorldInfoTimer; QTimer _addAssetToWorldErrorTimer; + mutable QTimer _entityServerConnectionTimer; FileScriptingInterface* _fileDownload; AudioInjectorPointer _snapshotSoundInjector; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index ff32e03006..9efad22d09 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -11,9 +11,7 @@ #include "SafeLanding.h" -#include #include -#include #include "EntityTreeRenderer.h" #include "RenderableModelEntityItem.h" @@ -21,7 +19,6 @@ #include "Application.h" const int SafeLanding::SEQUENCE_MODULO = std::numeric_limits::max() + 1; -const quint64 MAX_ELAPSED_TIME = 1000; // msec namespace { template bool lessThanWraparound(int a, int b) { @@ -110,9 +107,7 @@ void SafeLanding::noteReceivedsequenceNumber(int sequenceNumber) { } bool SafeLanding::isLoadSequenceComplete() { - quint64 elapsedTime = (usecTimestampNow() - _startTime) / USECS_PER_MSEC; - if ((isEntityLoadingComplete() && isSequenceNumbersComplete()) || - (elapsedTime >= MAX_ELAPSED_TIME && isEntityServerNotRunning() && _sequenceNumbers.empty())) { + if ((isEntityLoadingComplete() && isSequenceNumbersComplete()) || qApp->failedToConnectToEntityServer()) { Locker lock(_lock); _initialStart = INVALID_SEQUENCE; _initialEnd = INVALID_SEQUENCE; @@ -124,14 +119,6 @@ bool SafeLanding::isLoadSequenceComplete() { return !_trackingEntities; } -bool SafeLanding::isEntityServerNotRunning() { - auto nodeList = DependencyManager::get(); - const auto& domainHandler = nodeList->getDomainHandler(); - auto entityServer = nodeList->soloNodeOfType(NodeType::EntityServer); - - return (domainHandler.isConnected() && !entityServer); -} - float SafeLanding::loadingProgressPercentage() { Locker lock(_lock); static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15; diff --git a/interface/src/octree/SafeLanding.h b/interface/src/octree/SafeLanding.h index 157fda53aa..51357b60ff 100644 --- a/interface/src/octree/SafeLanding.h +++ b/interface/src/octree/SafeLanding.h @@ -40,7 +40,6 @@ private: bool isSequenceNumbersComplete(); void debugDumpSequenceIDs() const; bool isEntityLoadingComplete(); - bool isEntityServerNotRunning(); std::mutex _lock; using Locker = std::lock_guard;