From 4ce942b0f2ec13801d01a819609df0c35390ec63 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 19 Sep 2018 13:00:56 -0700 Subject: [PATCH 01/48] updating spawn location/floor in redirect --- interface/resources/serverless/redirect.json | 52 +++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/interface/resources/serverless/redirect.json b/interface/resources/serverless/redirect.json index 64cb4d8a3f..97cd75c8cd 100644 --- a/interface/resources/serverless/redirect.json +++ b/interface/resources/serverless/redirect.json @@ -2,7 +2,7 @@ "DataVersion": 0, "Paths": { - "/": "/4,1.4,4/0,0.49544,0,0.868645" + "/": "/5.77,1.4,4.96/0,0.49544,0,0.868645" }, "Entities": [ { @@ -96,6 +96,53 @@ "userData": "{\"grabbableKey\":{\"grabbable\":false}}", "visible": false }, + { + "clientOnly": false, + "color": { + "blue": 0, + "green": 0, + "red": 0 + }, + "created": "2018-09-05T00:40:03Z", + "dimensions": { + "blue": 6.9401350021362305, + "green": 0.04553089290857315, + "red": 7.004304885864258, + "x": 7.004304885864258, + "y": 0.04553089290857315, + "z": 6.9401350021362305 + }, + "id": "{33440bf8-f9ce-4d52-9b29-1b321e226982}", + "lastEdited": 1536107948774796, + "lastEditedBy": "{4eecd88f-ef9b-4a83-bb9a-7f7496209c6b}", + "locked": true, + "modelURL": "http://hifi-content.s3.amazonaws.com/alexia/LoadingScreens/floor.fbx", + "name": "floorModel", + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 3.6175529956817627, + "green": 0, + "red": 4.102385997772217, + "x": 4.102385997772217, + "y": 0, + "z": 3.6175529956817627 + }, + "queryAACube": { + "scale": 9.860417366027832, + "x": -0.8278226852416992, + "y": -4.930208683013916, + "z": -1.3126556873321533 + }, + "rotation": { + "w": 0.8660253882408142, + "x": -1.5922749298624694e-05, + "y": 0.5, + "z": -4.572480611386709e-05 + }, + "shapeType": "simple-hull", + "type": "Model", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}" + }, { "clientOnly": false, "color": { @@ -140,7 +187,8 @@ }, "shape": "Cube", "type": "Box", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" + "userData": "{\"grabbableKey\":{\"grabbable\":false}}", + "visible": false }, { "clientOnly": false, From d3368146ce1a34f11b2eb48d27820f5931979970 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 21 Sep 2018 11:42:26 -0700 Subject: [PATCH 02/48] saving work --- interface/src/Application.cpp | 106 ++++++------------ interface/src/Application.h | 8 +- interface/src/octree/SafeLanding.cpp | 4 + .../utilities/render/textureMonitor.qml | 2 +- scripts/system/interstitialPage.js | 46 +++++++- 5 files changed, 84 insertions(+), 82 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 46cebc1661..0947a85a17 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -122,6 +122,7 @@ #include #include #include +#include #include #include #include @@ -5346,8 +5347,8 @@ void Application::resetPhysicsReadyInformation() { // collision information of nearby entities to make running bullet be safe. _fullSceneReceivedCounter = 0; _fullSceneCounterAtLastPhysicsCheck = 0; - _nearbyEntitiesCountAtLastPhysicsCheck = 0; - _nearbyEntitiesStabilityCount = 0; + _gpuTextureMemSizeStabilityCount = 0; + _gpuTextureMemSizeAtLastCheck = 0; _physicsEnabled = false; _octreeProcessor.startEntitySequence(); } @@ -5586,18 +5587,20 @@ void Application::update(float deltaTime) { // for nearby entities before starting bullet up. quint64 now = usecTimestampNow(); if (isServerlessMode() || _octreeProcessor.isLoadSequenceComplete()) { - // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway - _lastPhysicsCheckTime = now; - _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; - _lastQueriedViews.clear(); // Force new view. + if (gpuTextureMemSizeStable()) { + // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway + _lastPhysicsCheckTime = now; + _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; + _lastQueriedViews.clear(); // Force new view. - // process octree stats packets are sent in between full sends of a scene (this isn't currently true). - // We keep physics disabled until we've received a full scene and everything near the avatar in that - // scene is ready to compute its collision shape. - if (getMyAvatar()->isReadyForPhysics()) { - _physicsEnabled = true; - setIsInterstitialMode(false); - getMyAvatar()->updateMotionBehaviorFromMenu(); + // process octree stats packets are sent in between full sends of a scene (this isn't currently true). + // We keep physics disabled until we've received a full scene and everything near the avatar in that + // scene is ready to compute its collision shape. + if (getMyAvatar()->isReadyForPhysics()) { + _physicsEnabled = true; + setIsInterstitialMode(false); + getMyAvatar()->updateMotionBehaviorFromMenu(); + } } } } else if (domainLoadingInProgress) { @@ -6234,9 +6237,14 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) { const bool isModifiedQuery = !_physicsEnabled; if (isModifiedQuery) { // Create modified view that is a simple sphere. + ConicalViewFrustum sphericalView; + ConicalViewFrustum farView; + + farView.set(_viewFrustum); + sphericalView.setSimpleRadius(INITIAL_QUERY_RADIUS); - _octreeQuery.setConicalViews({ sphericalView }); + _octreeQuery.setConicalViews({ sphericalView, farView }); _octreeQuery.setOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE); static constexpr float MIN_LOD_ADJUST = -20.0f; _octreeQuery.setBoundaryLevelAdjust(MIN_LOD_ADJUST); @@ -6548,69 +6556,23 @@ void Application::trackIncomingOctreePacket(ReceivedMessage& message, SharedNode } } -bool Application::nearbyEntitiesAreReadyForPhysics() { - // this is used to avoid the following scenario: - // A table has some items sitting on top of it. The items are at rest, meaning they aren't active in bullet. - // Someone logs in close to the table. They receive information about the items on the table before they - // receive information about the table. The items are very close to the avatar's capsule, so they become - // activated in bullet. This causes them to fall to the floor, because the table's shape isn't yet in bullet. - EntityTreePointer entityTree = getEntities()->getTree(); - if (!entityTree) { - return false; - } +bool Application::gpuTextureMemSizeStable() { + auto renderConfig = qApp->getRenderEngine()->getConfiguration(); + auto renderStats = renderConfig->getConfig("Stats"); - // We don't want to use EntityTree::findEntities(AABox, ...) method because that scan will snarf parented entities - // whose bounding boxes cannot be computed (it is too loose for our purposes here). Instead we manufacture - // custom filters and use the general-purpose EntityTree::findEntities(filter, ...) - QVector entities; - AABox avatarBox(getMyAvatar()->getWorldPosition() - glm::vec3(PHYSICS_READY_RANGE), glm::vec3(2 * PHYSICS_READY_RANGE)); - // create two functions that use avatarBox (entityScan and elementScan), the second calls the first - std::function entityScan = [=](EntityItemPointer& entity) { - if (entity->shouldBePhysical()) { - bool success = false; - AABox entityBox = entity->getAABox(success); - // important: bail for entities that cannot supply a valid AABox - return success && avatarBox.touches(entityBox); - } - return false; - }; - std::function elementScan = [&](const OctreeElementPointer& element, void* unused) { - if (element->getAACube().touches(avatarBox)) { - EntityTreeElementPointer entityTreeElement = std::static_pointer_cast(element); - entityTreeElement->getEntities(entityScan, entities); - return true; - } - return false; - }; + quint64 textureResourceGPUMemSize = renderStats->textureResourceGPUMemSize; + quint64 texturePopulatedGPUMemSize = renderStats->textureResourcePopulatedGPUMemSize; - entityTree->withReadLock([&] { - // Pass the second function to the general-purpose EntityTree::findEntities() - // which will traverse the tree, apply the two filter functions (to element, then to entities) - // as it traverses. The end result will be a list of entities that match. - entityTree->findEntities(elementScan, entities); - }); - - uint32_t nearbyCount = entities.size(); - if (nearbyCount == _nearbyEntitiesCountAtLastPhysicsCheck) { - _nearbyEntitiesStabilityCount++; + if (_gpuTextureMemSizeAtLastCheck == textureResourceGPUMemSize) { + _gpuTextureMemSizeStabilityCount++; } else { - _nearbyEntitiesStabilityCount = 0; + _gpuTextureMemSizeStabilityCount = 0; } - _nearbyEntitiesCountAtLastPhysicsCheck = nearbyCount; + _gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize; - const uint32_t MINIMUM_NEARBY_ENTITIES_STABILITY_COUNT = 3; - if (_nearbyEntitiesStabilityCount >= MINIMUM_NEARBY_ENTITIES_STABILITY_COUNT) { - // We've seen the same number of nearby entities for several stats packets in a row. assume we've got all - // the local entities. - bool result = true; - foreach (EntityItemPointer entity, entities) { - if (entity->shouldBePhysical() && !entity->isReadyToComputeShape()) { - HIFI_FCDEBUG(interfaceapp(), "Physics disabled until entity loads: " << entity->getID() << entity->getName()); - // don't break here because we want all the relevant entities to start their downloads - result = false; - } - } - return result; + const uint32_t MINIMUM_GPU_TEXTURE_MEM_SIZE_STABILITY_COUNT = 10; + if (_gpuTextureMemSizeStabilityCount >= MINIMUM_GPU_TEXTURE_MEM_SIZE_STABILITY_COUNT) { + return (textureResourceGPUMemSize == texturePopulatedGPUMemSize); } return false; } diff --git a/interface/src/Application.h b/interface/src/Application.h index 3bebc60480..4a15c4fa61 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -528,7 +528,7 @@ private: bool importFromZIP(const QString& filePath); bool importImage(const QString& urlString); - bool nearbyEntitiesAreReadyForPhysics(); + bool gpuTextureMemSizeStable(); int processOctreeStats(ReceivedMessage& message, SharedNodePointer sendingNode); void trackIncomingOctreePacket(ReceivedMessage& message, SharedNodePointer sendingNode, bool wasStatsPacket); @@ -725,8 +725,10 @@ private: std::atomic _fullSceneReceivedCounter { 0 }; // how many times have we received a full-scene octree stats packet uint32_t _fullSceneCounterAtLastPhysicsCheck { 0 }; // _fullSceneReceivedCounter last time we checked physics ready - uint32_t _nearbyEntitiesCountAtLastPhysicsCheck { 0 }; // how many in-range entities last time we checked physics ready - uint32_t _nearbyEntitiesStabilityCount { 0 }; // how many times has _nearbyEntitiesCountAtLastPhysicsCheck been the same + + quint64 _gpuTextureMemSizeStabilityCount { 0 }; + quint64 _gpuTextureMemSizeAtLastCheck { 0 }; + quint64 _lastPhysicsCheckTime { usecTimestampNow() }; // when did we last check to see if physics was ready bool _keyboardDeviceHasFocus { true }; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 5d4ebe9853..7c6ea3b015 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -171,6 +171,9 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; + + qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID(); + Settings settings; bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool(); @@ -188,6 +191,7 @@ bool SafeLanding::isEntityLoadingComplete() { entityMapIter++; } } + qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; return _trackedEntities.empty(); } diff --git a/scripts/developer/utilities/render/textureMonitor.qml b/scripts/developer/utilities/render/textureMonitor.qml index 97cc577ff9..b01a390fa8 100644 --- a/scripts/developer/utilities/render/textureMonitor.qml +++ b/scripts/developer/utilities/render/textureMonitor.qml @@ -75,4 +75,4 @@ Item { } } -} \ No newline at end of file +} diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 57726f397b..6c2db91010 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -14,7 +14,7 @@ (function() { Script.include("/~/system/libraries/Xform.js"); - var DEBUG = false; + var DEBUG = true; var MIN_LOADING_PROGRESS = 3.6; var TOTAL_LOADING_PROGRESS = 3.8; var EPSILON = 0.01; @@ -186,6 +186,8 @@ var currentDomain = "no domain"; var timer = null; var target = 0; + var textureMemSizeStabilityCount = 0; + var textureMemSizeAtLastCheck = 0; var connectionToDomainFailed = false; @@ -228,6 +230,8 @@ updateOverlays(false); startAudio(); target = 0; + textureMemSizeStabilityCount = 0; + textureMemSizeAtLastCheck = 0; currentProgress = 0.1; connectionToDomainFailed = false; previousCameraMode = Camera.mode; @@ -348,10 +352,11 @@ Overlays.editOverlay(loadingBarPlacard, properties); Overlays.editOverlay(loadingBarProgress, loadingBarProperties); - - Menu.setIsOptionChecked("Show Overlays", physicsEnabled); - if (!HMD.active) { - toolbar.writeProperty("visible", physicsEnabled); + if (!DEBUG) { + Menu.setIsOptionChecked("Show Overlays", physicsEnabled); + if (!HMD.active) { + toolbar.writeProperty("visible", physicsEnabled); + } } resetValues(); @@ -374,6 +379,7 @@ } function update() { + var renderStats = Render.getConfig("Stats"); var physicsEnabled = Window.isPhysicsEnabled(); var thisInterval = Date.now(); var deltaTime = (thisInterval - lastInterval); @@ -381,11 +387,39 @@ var domainLoadingProgressPercentage = Window.domainLoadingProgress(); - var progress = MIN_LOADING_PROGRESS * domainLoadingProgressPercentage; + var progress = ((TOTAL_LOADING_PROGRESS * 0.4) * domainLoadingProgressPercentage); if (progress >= target) { target = progress; } + if (currentProgress >= (TOTAL_LOADING_PROGRESS * 0.4)) { + var textureResourceGPUMemSize = renderStats.textureResourceGPUMemSize; + var texturePopulatedGPUMemSize = renderStats.textureResourcePopulatedGPUMemSize; + + if (textureMemSizeAtLastCheck === textureResourceGPUMemSize) { + textureMemSizeStabilityCount++; + } else { + textureMemSizeStabilityCount = 0; + } + + textureMemSizeAtLastCheck = textureResourceGPUMemSize; + + if (textureMemSizeStabilityCount >= 15) { + + if (textureResourceGPUMemSize > 0) { + print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); + var gpuPercantage = (TOTAL_LOADING_PROGRESS * 0.6) * (texturePopulatedGPUMemSize / textureResourceGPUMemSize); + print("---> gpu: " + gpuPercantage); + print("----> current: " + progress); + var totalProgress = progress + gpuPercantage; + print("------> totalProgress: " + totalProgress + "\n"); + if (totalProgress >= target) { + target = totalProgress; + } + } + } + } + if ((physicsEnabled && (currentProgress < TOTAL_LOADING_PROGRESS))) { target = TOTAL_LOADING_PROGRESS; } From 57ae8ff8a14fb7dc1538e57c93fe3314a3822fe5 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 24 Sep 2018 16:09:53 -0700 Subject: [PATCH 03/48] update interstitial page stability count and loading bar --- interface/src/Application.cpp | 3 +- interface/src/Application.h | 4 ++ interface/src/octree/SafeLanding.cpp | 40 ++++++++++++++----- interface/src/octree/SafeLanding.h | 3 ++ .../scripting/WindowScriptingInterface.cpp | 4 ++ .../src/scripting/WindowScriptingInterface.h | 2 + scripts/system/interstitialPage.js | 6 +-- 7 files changed, 45 insertions(+), 17 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 0947a85a17..ac21af6d44 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6570,8 +6570,7 @@ bool Application::gpuTextureMemSizeStable() { } _gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize; - const uint32_t MINIMUM_GPU_TEXTURE_MEM_SIZE_STABILITY_COUNT = 10; - if (_gpuTextureMemSizeStabilityCount >= MINIMUM_GPU_TEXTURE_MEM_SIZE_STABILITY_COUNT) { + if (_gpuTextureMemSizeStabilityCount >= _minimumGPUTextureMemSizeStabilityCount) { return (textureResourceGPUMemSize == texturePopulatedGPUMemSize); } return false; diff --git a/interface/src/Application.h b/interface/src/Application.h index 4a15c4fa61..b4df36704a 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -233,6 +233,8 @@ public: float getSettingConstrainToolbarPosition() { return _constrainToolbarPosition.get(); } void setSettingConstrainToolbarPosition(bool setting); + Q_INVOKABLE void setMinimumGPUTextureMemStabilityCount(int stabilityCount) { _minimumGPUTextureMemSizeStabilityCount = stabilityCount; } + NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; } virtual controller::ScriptingInterface* getControllerScriptingInterface() { return _controllerScriptingInterface; } @@ -585,6 +587,8 @@ private: QElapsedTimer _lastTimeUpdated; QElapsedTimer _lastTimeRendered; + int _minimumGPUTextureMemSizeStabilityCount { 15 }; + ShapeManager _shapeManager; PhysicalEntitySimulationPointer _entitySimulation; PhysicsEnginePointer _physicsEngine; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 7c6ea3b015..ba6e1dac8a 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -10,6 +10,9 @@ // #include "SafeLanding.h" + +#include + #include "EntityTreeRenderer.h" #include "ModelEntityItem.h" #include "InterfaceLogging.h" @@ -39,6 +42,7 @@ void SafeLanding::startEntitySequence(QSharedPointer entityT _entityTree = entityTree; _trackedEntities.clear(); _trackingEntities = true; + _maxTrackedEntityCount = 0; connect(std::const_pointer_cast(_entityTree).get(), &EntityTree::addingEntity, this, &SafeLanding::addTrackedEntity); connect(std::const_pointer_cast(_entityTree).get(), @@ -47,6 +51,7 @@ void SafeLanding::startEntitySequence(QSharedPointer entityT _sequenceNumbers.clear(); _initialStart = INVALID_SEQUENCE; _initialEnd = INVALID_SEQUENCE; + _startTime = usecTimestampNow(); EntityTreeRenderer::setEntityLoadingPriorityFunction(&ElevatedPriority); } } @@ -55,6 +60,7 @@ void SafeLanding::stopEntitySequence() { Locker lock(_lock); _trackingEntities = false; _maxTrackedEntityCount = 0; + _trackedEntityStabilityCount = 0; _initialStart = INVALID_SEQUENCE; _initialEnd = INVALID_SEQUENCE; _trackedEntities.clear(); @@ -66,13 +72,14 @@ void SafeLanding::addTrackedEntity(const EntityItemID& entityID) { Locker lock(_lock); EntityItemPointer entity = _entityTree->findEntityByID(entityID); - if (entity) { + if (entity && entity->getCreated() < _startTime) { _trackedEntities.emplace(entityID, entity); int trackedEntityCount = (int)_trackedEntities.size(); if (trackedEntityCount > _maxTrackedEntityCount) { _maxTrackedEntityCount = trackedEntityCount; + _trackedEntityStabilityCount = 0; } qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName(); } @@ -116,11 +123,19 @@ bool SafeLanding::isLoadSequenceComplete() { float SafeLanding::loadingProgressPercentage() { Locker lock(_lock); + + static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15; + + float percentage = 0.0f; if (_maxTrackedEntityCount > 0) { - return ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount); + percentage = ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount); } - return 0.0f; + if (_trackedEntityStabilityCount < MINIMUM_TRACKED_ENTITY_STABILITY_COUNT) { + percentage *= 0.20f; + } + + return percentage; } bool SafeLanding::isSequenceNumbersComplete() { @@ -166,19 +181,18 @@ bool SafeLanding::isEntityLoadingComplete() { auto entityTree = qApp->getEntities(); auto entityMapIter = _trackedEntities.begin(); + Settings settings; + bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool(); + while (entityMapIter != _trackedEntities.end()) { auto entity = entityMapIter->second; bool isVisuallyReady = true; - - qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID(); - - Settings settings; - bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool(); - if (enableInterstitial) { isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); + + qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID() << isVisuallyReady; } if (isEntityPhysicsReady(entity) && isVisuallyReady) { @@ -191,7 +205,13 @@ bool SafeLanding::isEntityLoadingComplete() { entityMapIter++; } } - qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; + + if (enableInterstitial) { + _trackedEntityStabilityCount++; + qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; + } + + return _trackedEntities.empty(); } diff --git a/interface/src/octree/SafeLanding.h b/interface/src/octree/SafeLanding.h index 317e4587c7..51357b60ff 100644 --- a/interface/src/octree/SafeLanding.h +++ b/interface/src/octree/SafeLanding.h @@ -52,6 +52,9 @@ private: int _initialStart { INVALID_SEQUENCE }; int _initialEnd { INVALID_SEQUENCE }; int _maxTrackedEntityCount { 0 }; + int _trackedEntityStabilityCount { 0 }; + + quint64 _startTime { 0 }; struct SequenceLessThan { bool operator()(const int& a, const int& b) const; diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index e3ae65aee1..543dfe4933 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -389,6 +389,10 @@ void WindowScriptingInterface::showAssetServer(const QString& upload) { QMetaObject::invokeMethod(qApp, "showAssetServerWidget", Qt::QueuedConnection, Q_ARG(QString, upload)); } +void WindowScriptingInterface::setMinimumGPUTextureMemSizeStabilityCount(int stabilityCount) { + QMetaObject::invokeMethod(qApp, " setMinimumGPUTextureMemStabilityCount", Qt::QueuedConnection, Q_ARG(int, stabilityCount)); +} + QString WindowScriptingInterface::checkVersion() { return QCoreApplication::applicationVersion(); } diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index 3827406729..bf93e73ea9 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -570,6 +570,8 @@ public slots: float domainLoadingProgress(); + void setMinimumGPUTextureMemSizeStabilityCount(int stabilityCount); + private slots: void onWindowGeometryChanged(const QRect& geometry); void onMessageBoxSelected(int button); diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index f5cd8293be..b8b9385a4d 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -14,7 +14,7 @@ (function() { Script.include("/~/system/libraries/Xform.js"); - var DEBUG = true; + var DEBUG = false; var MIN_LOADING_PROGRESS = 3.6; var TOTAL_LOADING_PROGRESS = 3.8; var EPSILON = 0.01; @@ -385,7 +385,6 @@ lastInterval = thisInterval; var domainLoadingProgressPercentage = Window.domainLoadingProgress(); - var progress = ((TOTAL_LOADING_PROGRESS * 0.4) * domainLoadingProgressPercentage); if (progress >= target) { target = progress; @@ -408,10 +407,7 @@ if (textureResourceGPUMemSize > 0) { print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); var gpuPercantage = (TOTAL_LOADING_PROGRESS * 0.6) * (texturePopulatedGPUMemSize / textureResourceGPUMemSize); - print("---> gpu: " + gpuPercantage); - print("----> current: " + progress); var totalProgress = progress + gpuPercantage; - print("------> totalProgress: " + totalProgress + "\n"); if (totalProgress >= target) { target = totalProgress; } From 26b6967ba6830e3eb5eb4041a9ce1c1b6674218d Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Tue, 25 Sep 2018 18:16:18 -0700 Subject: [PATCH 04/48] adding overlays to redirect domain --- interface/resources/serverless/redirect.json | 1098 ++++-------------- libraries/networking/src/DomainHandler.cpp | 1 + scripts/defaultScripts.js | 1 + scripts/system/interstitialPage.js | 18 +- scripts/system/redirectOverlays.js | 144 +++ 5 files changed, 408 insertions(+), 854 deletions(-) create mode 100644 scripts/system/redirectOverlays.js diff --git a/interface/resources/serverless/redirect.json b/interface/resources/serverless/redirect.json index 97cd75c8cd..b40b3867b3 100644 --- a/interface/resources/serverless/redirect.json +++ b/interface/resources/serverless/redirect.json @@ -5,50 +5,6 @@ "/": "/5.77,1.4,4.96/0,0.49544,0,0.868645" }, "Entities": [ - { - "clientOnly": false, - "collidesWith": "static,dynamic,kinematic,otherAvatar,", - "collisionMask": 23, - "created": "2018-09-05T18:13:00Z", - "dimensions": { - "blue": 1.159199833869934, - "green": 2.8062009811401367, - "red": 1.6216505765914917, - "x": 1.6216505765914917, - "y": 2.8062009811401367, - "z": 1.159199833869934 - }, - "id": "{d0ed60b8-9174-4c56-8e78-2c5399329ae0}", - "lastEdited": 1536171372916208, - "lastEditedBy": "{151cb20e-715a-4c80-aa0d-5b58b1c8a0c9}", - "locked": true, - "name": "Try Again Zone", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue":4.015342712402344, - "green":1.649999976158142, - "red":2.00921893119812, - "x":2.00921893119812, - "y":1.649999976158142, - "z":4.015342712402344 - }, - "queryAACube": { - "scale": 3.4421300888061523, - "x": 1.6001315116882324, - "y": -0.07100248336791992, - "z": 0.14220571517944336 - }, - "rotation": { - "w": 0.9914448857307434, - "x": 0, - "y": -0.13052619993686676, - "z": 0 - }, - "script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/zoneTryAgainEntityScript.js", - "shapeType": "box", - "type": "Zone", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, { "clientOnly": false, "color": { @@ -56,7 +12,7 @@ "green": 0, "red": 255 }, - "created": "2018-09-05T00:40:03Z", + "created": "2018-09-25T18:44:28Z", "dimensions": { "blue": 8.645400047302246, "green": 0.20000000298023224, @@ -65,23 +21,23 @@ "y": 0.20000000298023224, "z": 8.645400047302246 }, - "id": "{e44fb546-b34a-4966-9b11-73556f800d21}", - "lastEdited": 1536107948776951, - "lastEditedBy": "{ce82d352-3002-44ae-9b76-66492989a1db}", + "id": "{eac57ccf-1e81-4d74-80f1-f17f23fc2f2c}", + "lastEdited": 1537901430334573, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", "locked": true, "name": "ceiling", "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", "position": { "blue": 4.846520900726318, "green": 2.912982940673828, - "red": 5.739595890045166, - "x": 5.739595890045166, + "red": 6.00444221496582, + "x": 6.00444221496582, "y": 2.912982940673828, "z": 4.846520900726318 }, "queryAACube": { "scale": 21.812576293945312, - "x": -5.16669225692749, + "x": -4.901845932006836, "y": -7.993305206298828, "z": -6.059767246246338 }, @@ -103,7 +59,189 @@ "green": 0, "red": 0 }, - "created": "2018-09-05T00:40:03Z", + "created": "2018-09-25T18:44:28Z", + "dimensions": { + "blue": 11.117486953735352, + "green": 3.580313205718994, + "red": 0.20000000298023224, + "x": 0.20000000298023224, + "y": 3.580313205718994, + "z": 11.117486953735352 + }, + "id": "{54609e9e-f729-46fc-ac06-78d44ee6b6fe}", + "lastEdited": 1537901430334887, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", + "locked": true, + "name": "backWall", + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 5.268576622009277, + "green": 1.0066027641296387, + "red": 6.358620643615723, + "x": 6.358620643615723, + "y": 1.0066027641296387, + "z": 5.268576622009277 + }, + "queryAACube": { + "scale": 11.681488037109375, + "x": 0.5178766250610352, + "y": -4.834141254425049, + "z": -0.5721673965454102 + }, + "rotation": { + "w": 0.9662165641784668, + "x": -4.57763671875e-05, + "y": -0.2576791048049927, + "z": 1.52587890625e-05 + }, + "shape": "Cube", + "type": "Box", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}", + "visible": false + }, + { + "clientOnly": false, + "color": { + "blue": 0, + "green": 0, + "red": 0 + }, + "created": "2018-09-25T18:44:28Z", + "dimensions": { + "blue": 11.117486953735352, + "green": 3.580313205718994, + "red": 0.20000000298023224, + "x": 0.20000000298023224, + "y": 3.580313205718994, + "z": 11.117486953735352 + }, + "id": "{c9352a54-b2cd-4c0f-a898-7e79c01404d0}", + "lastEdited": 1537901430334652, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", + "locked": true, + "name": "frontWall", + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 2.662257671356201, + "green": 1.0063786506652832, + "red": 1.7517199516296387, + "x": 1.7517199516296387, + "y": 1.0063786506652832, + "z": 2.662257671356201 + }, + "queryAACube": { + "scale": 11.681488037109375, + "x": -4.089024066925049, + "y": -4.834365367889404, + "z": -3.1784863471984863 + }, + "rotation": { + "w": 0.9666743278503418, + "x": -4.57763671875e-05, + "y": -0.2560006380081177, + "z": 1.52587890625e-05 + }, + "shape": "Cube", + "type": "Box", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}", + "visible": false + }, + { + "clientOnly": false, + "color": { + "blue": 0, + "green": 0, + "red": 0 + }, + "created": "2018-09-25T18:44:28Z", + "dimensions": { + "blue": 11.117486953735352, + "green": 3.580313205718994, + "red": 0.20000000298023224, + "x": 0.20000000298023224, + "y": 3.580313205718994, + "z": 11.117486953735352 + }, + "id": "{c4b7a530-ec5b-47fc-be60-eed22f96799d}", + "lastEdited": 1537901430334730, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", + "locked": true, + "name": "rightWall", + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 0, + "green": 1.0061144828796387, + "red": 5.229935646057129, + "x": 5.229935646057129, + "y": 1.0061144828796387, + "z": 0 + }, + "queryAACube": { + "scale": 11.681488037109375, + "x": -0.6108083724975586, + "y": -4.834629535675049, + "z": -5.8407440185546875 + }, + "rotation": { + "w": 0.8637980222702026, + "x": -4.57763671875e-05, + "y": 0.5038070678710938, + "z": -1.52587890625e-05 + }, + "shape": "Cube", + "type": "Box", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}", + "visible": false + }, + { + "clientOnly": false, + "created": "2018-09-25T18:44:28Z", + "dimensions": { + "blue": 14.40000057220459, + "green": 14.40000057220459, + "red": 14.40000057220459, + "x": 14.40000057220459, + "y": 14.40000057220459, + "z": 14.40000057220459 + }, + "id": "{351ddd1e-79b3-4be7-8784-aca29bd65193}", + "lastEdited": 1537901430334210, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", + "locked": true, + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 2.3440732955932617, + "green": 1.6162219047546387, + "red": 2.1396677494049072, + "x": 2.1396677494049072, + "y": 1.6162219047546387, + "z": 2.3440732955932617 + }, + "queryAACube": { + "scale": 24.9415340423584, + "x": -10.331099510192871, + "y": -10.854545593261719, + "z": -10.126693725585938 + }, + "rotation": { + "w": 0.8697794675827026, + "x": -1.52587890625e-05, + "y": 0.4933699369430542, + "z": -4.57763671875e-05 + }, + "shapeType": "box", + "skyboxMode": "enabled", + "type": "Zone", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}" + }, + { + "clientOnly": false, + "color": { + "blue": 0, + "green": 0, + "red": 0 + }, + "created": "2018-09-25T18:44:28Z", "dimensions": { "blue": 6.9401350021362305, "green": 0.04553089290857315, @@ -112,9 +250,51 @@ "y": 0.04553089290857315, "z": 6.9401350021362305 }, - "id": "{33440bf8-f9ce-4d52-9b29-1b321e226982}", - "lastEdited": 1536107948774796, - "lastEditedBy": "{4eecd88f-ef9b-4a83-bb9a-7f7496209c6b}", + "id": "{81c13ed1-1873-4f21-adea-5112a0fdacd1}", + "lastEdited": 1537901430334808, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", + "locked": true, + "name": "floor", + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 3.6175529956817627, + "green": 0, + "red": 4.367232322692871, + "x": 4.367232322692871, + "y": 0, + "z": 3.6175529956817627 + }, + "queryAACube": { + "scale": 9.860417366027832, + "x": -0.5629763603210449, + "y": -4.930208683013916, + "z": -1.3126556873321533 + }, + "rotation": { + "w": 0.8660253882408142, + "x": -1.5922749298624694e-05, + "y": 0.5, + "z": -4.572480611386709e-05 + }, + "shape": "Cube", + "type": "Box", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}", + "visible": false + }, + { + "clientOnly": false, + "created": "2018-09-25T18:44:28Z", + "dimensions": { + "blue": 6.9401350021362305, + "green": 0.04553089290857315, + "red": 7.004304885864258, + "x": 7.004304885864258, + "y": 0.04553089290857315, + "z": 6.9401350021362305 + }, + "id": "{5582179a-fb69-4678-af0c-c8e6d890839a}", + "lastEdited": 1537901430334966, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", "locked": true, "modelURL": "http://hifi-content.s3.amazonaws.com/alexia/LoadingScreens/floor.fbx", "name": "floorModel", @@ -122,14 +302,14 @@ "position": { "blue": 3.6175529956817627, "green": 0, - "red": 4.102385997772217, - "x": 4.102385997772217, + "red": 4.367232322692871, + "x": 4.367232322692871, "y": 0, "z": 3.6175529956817627 }, "queryAACube": { "scale": 9.860417366027832, - "x": -0.8278226852416992, + "x": -0.5629763603210449, "y": -4.930208683013916, "z": -1.3126556873321533 }, @@ -150,54 +330,7 @@ "green": 0, "red": 0 }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 6.9401350021362305, - "green": 0.04553089290857315, - "red": 7.004304885864258, - "x": 7.004304885864258, - "y": 0.04553089290857315, - "z": 6.9401350021362305 - }, - "id": "{8cd93fe5-16c0-44b7-b1e9-e7e06c4e9228}", - "lastEdited": 1536107948774796, - "lastEditedBy": "{4eecd88f-ef9b-4a83-bb9a-7f7496209c6b}", - "locked": true, - "name": "floor", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 3.6175529956817627, - "green": 0, - "red": 4.102385997772217, - "x": 4.102385997772217, - "y": 0, - "z": 3.6175529956817627 - }, - "queryAACube": { - "scale": 9.860417366027832, - "x": -0.8278226852416992, - "y": -4.930208683013916, - "z": -1.3126556873321533 - }, - "rotation": { - "w": 0.8660253882408142, - "x": -1.5922749298624694e-05, - "y": 0.5, - "z": -4.572480611386709e-05 - }, - "shape": "Cube", - "type": "Box", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}", - "visible": false - }, - { - "clientOnly": false, - "color": { - "blue": 0, - "green": 0, - "red": 0 - }, - "created": "2018-09-05T00:40:03Z", + "created": "2018-09-25T18:44:28Z", "dimensions": { "blue": 11.117486953735352, "green": 3.580313205718994, @@ -206,23 +339,23 @@ "y": 3.580313205718994, "z": 11.117486953735352 }, - "id": "{147272dc-a344-4171-9621-efc1c2095997}", - "lastEdited": 1536107948776823, - "lastEditedBy": "{ce82d352-3002-44ae-9b76-66492989a1db}", + "id": "{366ec0b9-5106-4172-a9f6-2143f6c279aa}", + "lastEdited": 1537901430334307, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", "locked": true, "name": "leftWall", "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", "position": { "blue": 6.1806135177612305, "green": 1.0066027641296387, - "red": 1.4690406322479248, - "x": 1.4690406322479248, + "red": 1.7338871955871582, + "x": 1.7338871955871582, "y": 1.0066027641296387, "z": 6.1806135177612305 }, "queryAACube": { "scale": 11.681488037109375, - "x": -4.371703147888184, + "x": -4.106856822967529, "y": -4.834141254425049, "z": 0.33986949920654297 }, @@ -236,747 +369,8 @@ "type": "Box", "userData": "{\"grabbableKey\":{\"grabbable\":false}}", "visible": false - }, - { - "clientOnly": false, - "color": { - "blue": 0, - "green": 0, - "red": 0 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 11.117486953735352, - "green": 3.580313205718994, - "red": 0.20000000298023224, - "x": 0.20000000298023224, - "y": 3.580313205718994, - "z": 11.117486953735352 - }, - "id": "{5f2b89b8-47e3-4915-a966-d46307a40f06}", - "lastEdited": 1536107948774605, - "lastEditedBy": "{ce82d352-3002-44ae-9b76-66492989a1db}", - "locked": true, - "name": "backWall", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 5.268576622009277, - "green": 1.0066027641296387, - "red": 6.093774318695068, - "x": 6.093774318695068, - "y": 1.0066027641296387, - "z": 5.268576622009277 - }, - "queryAACube": { - "scale": 11.681488037109375, - "x": 0.25303030014038086, - "y": -4.834141254425049, - "z": -0.5721673965454102 - }, - "rotation": { - "w": 0.9662165641784668, - "x": -4.57763671875e-05, - "y": -0.2576791048049927, - "z": 1.52587890625e-05 - }, - "shape": "Cube", - "type": "Box", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}", - "visible": false - }, - { - "clientOnly": false, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 14.40000057220459, - "green": 14.40000057220459, - "red": 14.40000057220459, - "x": 14.40000057220459, - "y": 14.40000057220459, - "z": 14.40000057220459 - }, - "id": "{baf96345-8f68-4068-af4c-3c690035852a}", - "lastEdited": 1536107948775591, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "locked": true, - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 2.3440732955932617, - "green": 1.6162219047546387, - "red": 1.8748211860656738, - "x": 1.8748211860656738, - "y": 1.6162219047546387, - "z": 2.3440732955932617 - }, - "queryAACube": { - "scale": 24.9415340423584, - "x": -10.595945358276367, - "y": -10.854545593261719, - "z": -10.126693725585938 - }, - "rotation": { - "w": 0.8697794675827026, - "x": -1.52587890625e-05, - "y": 0.4933699369430542, - "z": -4.57763671875e-05 - }, - "shapeType": "box", - "skyboxMode": "enabled", - "type": "Zone", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "alpha": 0, - "alphaFinish": 0, - "alphaStart": 1, - "clientOnly": false, - "color": { - "blue": 211, - "green": 227, - "red": 104 - }, - "colorFinish": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "colorStart": { - "blue": 211, - "green": 227, - "red": 104, - "x": 104, - "y": 227, - "z": 211 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 2.5, - "green": 2.5, - "red": 2.5, - "x": 2.5, - "y": 2.5, - "z": 2.5 - }, - "emitAcceleration": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "emitDimensions": { - "blue": 1, - "green": 1, - "red": 1, - "x": 1, - "y": 1, - "z": 1 - }, - "emitOrientation": { - "w": 0.9993909597396851, - "x": 0.034897372126579285, - "y": -1.525880907138344e-05, - "z": -1.525880907138344e-05 - }, - "emitRate": 2, - "emitSpeed": 0, - "id": "{639a51f0-8613-4e46-bc7e-fef24597df73}", - "lastEdited": 1536107948776693, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "lifespan": 10, - "locked": true, - "maxParticles": 40, - "name": "Rays", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "particleRadius": 0.75, - "polarFinish": 3.1415927410125732, - "position": { - "blue": 1.3553659915924072, - "green": 1.2890124320983887, - "red": 2.5663273334503174, - "x": 2.5663273334503174, - "y": 1.2890124320983887, - "z": 1.3553659915924072 - }, - "queryAACube": { - "scale": 4.330127239227295, - "x": 0.4012637138366699, - "y": -0.8760511875152588, - "z": -0.8096976280212402 - }, - "radiusFinish": 0.10000000149011612, - "radiusStart": 0, - "rotation": { - "w": 0.9803768396377563, - "x": -1.52587890625e-05, - "y": 0.19707024097442627, - "z": -7.62939453125e-05 - }, - "speedSpread": 0, - "spinFinish": null, - "spinStart": null, - "textures": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/stripe.png", - "type": "ParticleEffect", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "alpha": 0, - "alphaFinish": 0, - "alphaStart": 1, - "clientOnly": false, - "color": { - "blue": 255, - "green": 205, - "red": 3 - }, - "colorFinish": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "colorStart": { - "blue": 255, - "green": 204, - "red": 0, - "x": 0, - "y": 204, - "z": 255 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 2.5, - "green": 2.5, - "red": 2.5, - "x": 2.5, - "y": 2.5, - "z": 2.5 - }, - "emitAcceleration": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "emitDimensions": { - "blue": 1, - "green": 1, - "red": 1, - "x": 1, - "y": 1, - "z": 1 - }, - "emitOrientation": { - "w": 0.9993909597396851, - "x": 0.034897372126579285, - "y": -1.525880907138344e-05, - "z": -1.525880907138344e-05 - }, - "emitRate": 2, - "emitSpeed": 0, - "emitterShouldTrail": true, - "id": "{e62ced49-fa18-4ae1-977f-abef5bc0f3ba}", - "lastEdited": 1536107948775366, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "lifespan": 10, - "locked": true, - "maxParticles": 40, - "name": "Rays", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "particleRadius": 0.75, - "polarFinish": 3.1415927410125732, - "position": { - "blue": 3.814434051513672, - "green": 1.2890124320983887, - "red": 1.2254328727722168, - "x": 1.2254328727722168, - "y": 1.2890124320983887, - "z": 3.814434051513672 - }, - "queryAACube": { - "scale": 4.330127239227295, - "x": -0.9396307468414307, - "y": -0.8760511875152588, - "z": 1.6493704319000244 - }, - "radiusFinish": 0.10000000149011612, - "radiusStart": 0, - "rotation": { - "w": 0.9594720602035522, - "x": -1.52587890625e-05, - "y": 0.28178834915161133, - "z": -4.57763671875e-05 - }, - "speedSpread": 0, - "spinFinish": null, - "spinStart": null, - "textures": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/stripe.png", - "type": "ParticleEffect", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "alpha": 0, - "alphaFinish": 0, - "alphaStart": 0.25, - "clientOnly": false, - "colorFinish": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "colorStart": { - "blue": 255, - "green": 255, - "red": 255, - "x": 255, - "y": 255, - "z": 255 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 13.24000072479248, - "green": 13.24000072479248, - "red": 13.24000072479248, - "x": 13.24000072479248, - "y": 13.24000072479248, - "z": 13.24000072479248 - }, - "emitAcceleration": { - "blue": 0, - "green": 0.10000000149011612, - "red": 0, - "x": 0, - "y": 0.10000000149011612, - "z": 0 - }, - "emitDimensions": { - "blue": 1, - "green": 1, - "red": 1, - "x": 1, - "y": 1, - "z": 1 - }, - "emitOrientation": { - "w": 1, - "x": -1.52587890625e-05, - "y": -1.52587890625e-05, - "z": -1.52587890625e-05 - }, - "emitRate": 6, - "emitSpeed": 0, - "id": "{298c0571-cbd8-487b-8640-64037d6a8414}", - "lastEdited": 1536107948776382, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "lifespan": 10, - "locked": true, - "maxParticles": 10, - "name": "Stars", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "particleRadius": 0.07000000029802322, - "polarFinish": 3.1415927410125732, - "position": { - "blue": 1.3712034225463867, - "green": 0.3698839843273163, - "red": 2.6216418743133545, - "x": 2.6216418743133545, - "y": 0.3698839843273163, - "z": 1.3712034225463867 - }, - "queryAACube": { - "scale": 22.932353973388672, - "x": -8.844534873962402, - "y": -11.096293449401855, - "z": -10.09497356414795 - }, - "radiusFinish": 0, - "radiusStart": 0, - "rotation": { - "w": 0.9852597713470459, - "x": -1.52587890625e-05, - "y": -0.17106890678405762, - "z": -7.62939453125e-05 - }, - "speedSpread": 0, - "spinFinish": null, - "spinStart": null, - "textures": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/star.png", - "type": "ParticleEffect", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "clientOnly": false, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 2.1097896099090576, - "green": 0.04847164824604988, - "red": 1.458284616470337, - "x": 1.458284616470337, - "y": 0.04847164824604988, - "z": 2.1097896099090576 - }, - "id": "{6625dbb8-ff25-458d-a92e-644b58460604}", - "lastEdited": 1536107948776195, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "locked": true, - "modelURL": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/portal1.fbx", - "name": "Try Again", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 3.946338653564453, - "green": 0.09449335932731628, - "red": 1.594836711883545, - "x": 1.594836711883545, - "y": 0.09449335932731628, - "z": 3.946338653564453 - }, - "queryAACube": { - "scale": 2.5651814937591553, - "x": 0.3122459650039673, - "y": -1.188097357749939, - "z": 2.663747787475586 - }, - "rotation": { - "w": 0.8220492601394653, - "x": -1.52587890625e-05, - "y": 0.5693598985671997, - "z": -0.0001068115234375 - }, - "script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/tryAgainEntityScript.js", - "shapeType": "static-mesh", - "type": "Model", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "clientOnly": false, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 0.06014331430196762, - "green": 2.582186460494995, - "red": 2.582186698913574, - "x": 2.582186698913574, - "y": 2.582186460494995, - "z": 0.06014331430196762 - }, - "id": "{dfe92dce-f09d-4e9e-b3ed-c68ecd4d476f}", - "lastEdited": 1536108160862286, - "lastEditedBy": "{4656d4a8-5e61-4230-ab34-2888d7945bd6}", - "modelURL": "", - "name": "Oops Dialog", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 1.45927095413208, - "green": 1.6763916015625, - "red": 0, - "x": 0, - "y": 1.6763916015625, - "z": 1.45927095413208 - }, - "queryAACube": { - "scale": 3.6522583961486816, - "x": -1.8261291980743408, - "y": -0.14973759651184082, - "z": -0.36685824394226074 - }, - "rotation": { - "w": 0.8684672117233276, - "x": -4.57763671875e-05, - "y": 0.4957197904586792, - "z": -7.62939453125e-05 - }, - "script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/oopsEntityScript.js", - "scriptTimestamp": 1536102551825, - "type": "Model", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "clientOnly": false, - "color": { - "blue": 0, - "green": 0, - "red": 0 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 11.117486953735352, - "green": 3.580313205718994, - "red": 0.20000000298023224, - "x": 0.20000000298023224, - "y": 3.580313205718994, - "z": 11.117486953735352 - }, - "id": "{144a8cf4-b0e8-489a-9403-d74d4dc4cb3e}", - "lastEdited": 1536107948775774, - "lastEditedBy": "{ce82d352-3002-44ae-9b76-66492989a1db}", - "locked": true, - "name": "rightWall", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 0, - "green": 1.0061144828796387, - "red": 4.965089321136475, - "x": 4.965089321136475, - "y": 1.0061144828796387, - "z": 0 - }, - "queryAACube": { - "scale": 11.681488037109375, - "x": -0.8756546974182129, - "y": -4.834629535675049, - "z": -5.8407440185546875 - }, - "rotation": { - "w": 0.8637980222702026, - "x": -4.57763671875e-05, - "y": 0.5038070678710938, - "z": -1.52587890625e-05 - }, - "shape": "Cube", - "type": "Box", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}", - "visible": false - }, - { - "clientOnly": false, - "collidesWith": "static,dynamic,kinematic,otherAvatar,", - "collisionMask": 23, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 1.159199833869934, - "green": 2.8062009811401367, - "red": 1.6216505765914917, - "x": 1.6216505765914917, - "y": 2.8062009811401367, - "z": 1.159199833869934 - }, - "id": "{37f53408-3d0c-42a5-9891-e6c40a227349}", - "lastEdited": 1536107948775010, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "locked": true, - "name": "Back Zone", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 1.8632707595825195, - "green": 1.6500625610351562, - "red": 3.3211965560913086, - "x": 3.3211965560913086, - "y": 1.6500625610351562, - "z": 1.8632707595825195 - }, - "queryAACube": { - "scale": 3.4421300888061523, - "x": 1.6001315116882324, - "y": -0.07100248336791992, - "z": 0.14220571517944336 - }, - "rotation": { - "w": 0.9304176568984985, - "x": 0, - "y": -0.36650121212005615, - "z": 0 - }, - "script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/zoneBackEntityScript.js", - "shapeType": "box", - "type": "Zone", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "clientOnly": false, - "color": { - "blue": 0, - "green": 0, - "red": 0 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 11.117486953735352, - "green": 3.580313205718994, - "red": 0.20000000298023224, - "x": 0.20000000298023224, - "y": 3.580313205718994, - "z": 11.117486953735352 - }, - "id": "{aa6e680c-6750-4776-95bc-ef3118cace5c}", - "lastEdited": 1536107948775945, - "lastEditedBy": "{ce82d352-3002-44ae-9b76-66492989a1db}", - "locked": true, - "name": "frontWall", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 2.662257671356201, - "green": 1.0063786506652832, - "red": 1.4868733882904053, - "x": 1.4868733882904053, - "y": 1.0063786506652832, - "z": 2.662257671356201 - }, - "queryAACube": { - "scale": 11.681488037109375, - "x": -4.353870391845703, - "y": -4.834365367889404, - "z": -3.1784863471984863 - }, - "rotation": { - "w": 0.9666743278503418, - "x": -4.57763671875e-05, - "y": -0.2560006380081177, - "z": 1.52587890625e-05 - }, - "shape": "Cube", - "type": "Box", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}", - "visible": false - }, - { - "clientOnly": false, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 2.1097896099090576, - "green": 0.04847164824604988, - "red": 1.458284616470337, - "x": 1.458284616470337, - "y": 0.04847164824604988, - "z": 2.1097896099090576 - }, - "id": "{303631f1-04f3-42a6-b8a8-8dd4b65d1231}", - "lastEdited": 1536107948776513, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "locked": true, - "modelURL": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/portal2.fbx", - "name": "Back", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 1.5835940837860107, - "green": 0.09449335932731628, - "red": 3.028078079223633, - "x": 3.028078079223633, - "y": 0.09449335932731628, - "z": 1.5835940837860107 - }, - "queryAACube": { - "scale": 2.5651814937591553, - "x": 1.7454873323440552, - "y": -1.188097357749939, - "z": 0.3010033369064331 - }, - "rotation": { - "w": 0.9084458351135254, - "x": -1.52587890625e-05, - "y": 0.4179598093032837, - "z": -0.0001068115234375 - }, - "script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/backEntityScript.js", - "scriptTimestamp": 1535751754379, - "shapeType": "static-mesh", - "type": "Model", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "alpha": 0, - "alphaFinish": 0, - "alphaStart": 0.25, - "clientOnly": false, - "colorFinish": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "colorStart": { - "blue": 255, - "green": 255, - "red": 255, - "x": 255, - "y": 255, - "z": 255 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 13.24000072479248, - "green": 13.24000072479248, - "red": 13.24000072479248, - "x": 13.24000072479248, - "y": 13.24000072479248, - "z": 13.24000072479248 - }, - "emitAcceleration": { - "blue": 0, - "green": 0.10000000149011612, - "red": 0, - "x": 0, - "y": 0.10000000149011612, - "z": 0 - }, - "emitDimensions": { - "blue": 1, - "green": 1, - "red": 1, - "x": 1, - "y": 1, - "z": 1 - }, - "emitOrientation": { - "w": 1, - "x": -1.52587890625e-05, - "y": -1.52587890625e-05, - "z": -1.52587890625e-05 - }, - "emitRate": 6, - "emitSpeed": 0, - "emitterShouldTrail": true, - "id": "{8ded39e6-303c-48f2-be79-81b715cca9f7}", - "lastEdited": 1536107948777127, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "lifespan": 10, - "locked": true, - "maxParticles": 10, - "name": "Stars", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "particleRadius": 0.07000000029802322, - "polarFinish": 3.1415927410125732, - "position": { - "blue": 3.78922963142395, - "green": 0.3698839843273163, - "red": 1.1863799095153809, - "x": 1.1863799095153809, - "y": 0.3698839843273163, - "z": 3.78922963142395 - }, - "queryAACube": { - "scale": 22.932353973388672, - "x": -10.279796600341797, - "y": -11.096293449401855, - "z": -7.676947593688965 - }, - "radiusFinish": 0, - "radiusStart": 0, - "rotation": { - "w": 0.996429443359375, - "x": -1.52587890625e-05, - "y": -0.08442819118499756, - "z": -4.57763671875e-05 - }, - "speedSpread": 0, - "spinFinish": null, - "spinStart": null, - "textures": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/star.png", - "type": "ParticleEffect", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" } ], - "Id": "{18abccad-2d57-4176-9d89-24dc424916f5}", + "Id": "{6ec356c4-abf2-41b7-9980-c47dd08343b2}", "Version": 93 } diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index f34a93de96..64841295de 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -311,6 +311,7 @@ void DomainHandler::setIsConnected(bool isConnected) { _isConnected = isConnected; if (_isConnected) { + _lastDomainConnectionError = -1; emit connectedToDomain(_domainURL); if (_domainURL.scheme() == URL_SCHEME_HIFI && !_domainURL.host().isEmpty()) { diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index aaf5ca7260..e11891bb33 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -40,6 +40,7 @@ var DEFAULT_SCRIPTS_SEPARATE = [ if (Settings.getValue("enableInterstitialMode", false)) { DEFAULT_SCRIPTS_SEPARATE.push("system/interstitialPage.js"); + DEFAULT_SCRIPTS_SEPARATE.push("system/redirectOverlays.js"); } // add a menu item for debugging diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 0c786dad87..c8a7dc3e83 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -178,7 +178,7 @@ localOrientation: Quat.fromVec3Degrees({ x: 0.0, y: 180.0, z: 0.0 }), parentID: anchorOverlay }); - + var TARGET_UPDATE_HZ = 60; // 50hz good enough, but we're using update var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ; var lastInterval = Date.now(); @@ -347,7 +347,6 @@ Overlays.editOverlay(loadingBarPlacard, properties); Overlays.editOverlay(loadingBarProgress, loadingBarProperties); - Menu.setIsOptionChecked("Show Overlays", physicsEnabled); if (!HMD.active) { toolbar.writeProperty("visible", physicsEnabled); @@ -399,6 +398,18 @@ }; Overlays.editOverlay(loadingBarProgress, properties); + + + var hardRefusalErrorsIdx = hardRefusalErrors.indexOf(Window.getLastDomainConnectionError()); + + var redirectProperties = { + visible: (hardRefusalErrorsIdx >= 0) + }; + + Overlays.editOverlay(redirectOopsText, redirectProperties); + Overlays.editOverlay(tryAgainImage, redirectProperties); + Overlays.editOverlay(backImage, redirectProperties); + if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); endAudio(); @@ -457,6 +468,9 @@ Overlays.deleteOverlay(loadingBarPlacard); Overlays.deleteOverlay(loadingBarProgress); Overlays.deleteOverlay(anchorOverlay); + Overlays.deleteOverlay(redirectOopsText); + Overlays.deleteOverlay(tryAgainImage); + Overlays.deleteOverlay(backImage); if (DEBUG) { tablet.removeButton(button); diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js new file mode 100644 index 0000000000..c3aca60a94 --- /dev/null +++ b/scripts/system/redirectOverlays.js @@ -0,0 +1,144 @@ +"use strict"; +(function() { + + var ERROR_MESSAGE_MAP = [ + "Oops! Protocol version mismatch.", + "Oops! Not authorized to join domain.", + "Oops! Connection timed out.", + "Oops! Something went wrong." + ]; + + var PROTOCOL_VERSION_MISMATCH = 1; + var NOT_AUTHORIZED = 3; + var TIMEOUT = 5; + var hardRefusalErrors = [PROTOCOL_VERSION_MISMATCH, + NOT_AUTHORIZED, TIMEOUT]; + var error = -1; + var timer = null; + + function getOopsText() { + error = Window.getLastDomainConnectionError(); + if (hardRefusalErrors.indexOf(error) >= 0) { + return ERROR_MESSAGE_MAP[error]; + } else { + // some other text. + return ERROR_MESSAGE_MAP[4]; + } + }; + + var redirectOopsText = Overlays.addOverlay("text3d", { + name: "oopsText", + // position: { x: 0.2656, y: 1.6764, z: 1.4593}, + position: { x: 0.0, y: 1.6764, z: 1.4593}, + text: getOopsText(), + textAlpha: 1, + backgroundAlpha: 0, + lineHeight: 0.13, + // dimensions: {x: 2.58, y: 2.58}, + visible: false, + emissive: true, + ignoreRayIntersection: false, + drawInFront: true, + grabbable: false, + orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, + parentID: MyAvatar.SELF_ID + }); + print("redirect oops text = " + redirectOopsText); + + var tryAgainImage = Overlays.addOverlay("image3d", { + name: "tryAgainImage", + position: { x: 0.0, y: 1.0695, z: 1.9094}, + url: Script.resourcesPath() + "images/interstitialPage/button_tryAgain.png", + alpha: 1, + // dimensions: {x: 0.9, y: 0.4}, + visible: false, + emissive: true, + ignoreRayIntersection: false, + drawInFront: true, + grabbable: false, + orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, + parentID: MyAvatar.SELF_ID + }); + print("try again image = " + tryAgainImage); + + var backImage = Overlays.addOverlay("image3d", { + name: "backImage", + position: { x: 0.525, y: 1.0695, z: 1.0186}, + url: Script.resourcesPath() + "images/interstitialPage/button_back.png", + alpha: 1, + // dimensions: {x: 0.9, y: 0.4}, + visible: false, + emissive: true, + ignoreRayIntersection: false, + drawInFront: true, + grabbable: false, + localOrientation: Quat.fromVec3Degrees({ x: 0.0, y: 180.0, z: 0.0 }), + orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, + parentID: MyAvatar.SELF_ID + }); + print("back image = " + backImage); + + var TARGET_UPDATE_HZ = 60; + var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ; + + function toggleOverlays() { + var overlaysVisible = false; + error = Window.getLastDomainConnectionError(); + var oopsText = ""; + if (error === -1) { + overlaysVisible = false; + } else if (hardRefusalErrors.indexOf(error) >= 0) { + overlaysVisible = true; + oopsText = ERROR_MESSAGE_MAP[error]; + } else { + overlaysVisible = true; + oopsText = ERROR_MESSAGE_MAP[4]; + } + var properties = { + visible: overlaysVisible + }; + var oopsTextProperties = { + visible: overlaysVisible, + text: oopsText + }; + + Overlays.editOverlay(redirectOopsText, oopsTextProperties); + Overlays.editOverlay(tryAgainImage, properties); + Overlays.editOverlay(backImage, properties) + } + + function clickedOnOverlay(overlayID, event) { + if (tryAgainImage === overlayID) { + location.goToLastAddress(); + } else if (backImage === overlayID) { + location.goBack(); + } + } + + function cleanup() { + timer = null; + Overlays.deleteOverlay(redirectOopsText); + Overlays.deleteOverlay(tryAgainImage); + Overlays.deleteOverlay(backImage); + } + + var whiteColor = {red: 255, green: 255, blue: 255}; + var greyColor = {red: 125, green: 125, blue: 125}; + Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); + Overlays.hoverEnterOverlay.connect(function(overlayID, event) { + if (overlayID === backImage || overlayID === tryAgainImage) { + Overlays.editOverlay(overlayID, { color: greyColor }); + } + }); + + Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { + if (overlayID === backImage || overlayID === tryAgainImage) { + Overlays.editOverlay(overlayID, { color: whiteColor }); + } + }); + + // timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS); + Script.update.connect(toggleOverlays); + + Script.scriptEnding.connect(cleanup); +}()); From 42579f3d167a67aa2f2a1ebd72f6a488b15fcbfa Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Tue, 25 Sep 2018 18:21:51 -0700 Subject: [PATCH 05/48] fixing oops dialog text index lookups --- scripts/system/redirectOverlays.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index c3aca60a94..fdd69fdab3 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -18,8 +18,9 @@ function getOopsText() { error = Window.getLastDomainConnectionError(); - if (hardRefusalErrors.indexOf(error) >= 0) { - return ERROR_MESSAGE_MAP[error]; + var errorMessageMapIndex = hardRefusalErrors.indexOf(error); + if (errorMessageMapIndex >= 0) { + return ERROR_MESSAGE_MAP[errorMessageMapIndex]; } else { // some other text. return ERROR_MESSAGE_MAP[4]; @@ -84,12 +85,13 @@ function toggleOverlays() { var overlaysVisible = false; error = Window.getLastDomainConnectionError(); + var errorMessageMapIndex = hardRefusalErrors.indexOf(error); var oopsText = ""; if (error === -1) { overlaysVisible = false; - } else if (hardRefusalErrors.indexOf(error) >= 0) { + } else if (errorMessageMapIndex >= 0) { overlaysVisible = true; - oopsText = ERROR_MESSAGE_MAP[error]; + oopsText = ERROR_MESSAGE_MAP[errorMessageMapIndex]; } else { overlaysVisible = true; oopsText = ERROR_MESSAGE_MAP[4]; From 54f800fbda08b9e859a050dcaf2b312540651f2f Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Tue, 25 Sep 2018 20:21:05 -0700 Subject: [PATCH 06/48] including images/parent buttons to text --- .../images/interstitialPage/button_back.png | Bin 0 -> 3842 bytes .../interstitialPage/button_tryAgain.png | Bin 0 -> 4512 bytes scripts/system/redirectOverlays.js | 26 ++++++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 interface/resources/images/interstitialPage/button_back.png create mode 100644 interface/resources/images/interstitialPage/button_tryAgain.png diff --git a/interface/resources/images/interstitialPage/button_back.png b/interface/resources/images/interstitialPage/button_back.png new file mode 100644 index 0000000000000000000000000000000000000000..cb9c9098361abd4aebc4778c26824e907ec290dc GIT binary patch literal 3842 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 yv`)_^59vp&p0R{lj)4fZfwJUM}0000= 0) - }; - - Overlays.editOverlay(redirectOopsText, redirectProperties); - Overlays.editOverlay(tryAgainImage, redirectProperties); - Overlays.editOverlay(backImage, redirectProperties); - if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); endAudio(); @@ -468,9 +457,6 @@ Overlays.deleteOverlay(loadingBarPlacard); Overlays.deleteOverlay(loadingBarProgress); Overlays.deleteOverlay(anchorOverlay); - Overlays.deleteOverlay(redirectOopsText); - Overlays.deleteOverlay(tryAgainImage); - Overlays.deleteOverlay(backImage); if (DEBUG) { tablet.removeButton(button); diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index b0caba7c52..5d37078a26 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -33,7 +33,7 @@ text: getOopsText(), textAlpha: 1, backgroundAlpha: 0, - lineHeight: 0.13, + lineHeight: 0.10, visible: false, emissive: true, ignoreRayIntersection: false, @@ -43,11 +43,10 @@ parentID: MyAvatar.SELF_ID, parentJointIndex: MyAvatar.getJointIndex("Head") }); - print("redirect oops text = " + redirectOopsText); var tryAgainImage = Overlays.addOverlay("image3d", { name: "tryAgainImage", - localPosition: { x: -0.15, y: -0.4, z: 0.0}, + localPosition: {x: -0.15, y: -0.4, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_tryAgain.png", alpha: 1, visible: false, @@ -58,12 +57,10 @@ orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, parentID: redirectOopsText }); - print("try again image = " + tryAgainImage); - Window.copyToClipboard(redirectOopsText); var backImage = Overlays.addOverlay("image3d", { name: "backImage", - localPosition: { x: 1.0, y: -0.4, z: 0.0}, + localPosition: {x: 1.0, y: -0.4, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_back.png", alpha: 1, visible: false, @@ -74,7 +71,6 @@ orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, parentID: redirectOopsText }); - print("back image = " + backImage); var TARGET_UPDATE_HZ = 60; var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ; @@ -84,7 +80,7 @@ error = Window.getLastDomainConnectionError(); var errorMessageMapIndex = hardRefusalErrors.indexOf(error); var oopsText = ""; - if (error === -1) { + if (error === -1 || !Window.isPhysicsEnabled() || location.isConnected) { overlaysVisible = false; } else if (errorMessageMapIndex >= 0) { overlaysVisible = true; @@ -96,6 +92,7 @@ var properties = { visible: overlaysVisible }; + var oopsTextProperties = { visible: overlaysVisible, text: oopsText @@ -121,6 +118,7 @@ } function cleanup() { + Script.clearInterval(timer); timer = null; Overlays.deleteOverlay(redirectOopsText); Overlays.deleteOverlay(tryAgainImage); @@ -142,8 +140,8 @@ } }); - // timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS); - Script.update.connect(toggleOverlays); + timer = Script.setInterval(toggleOverlays, 500); + // Script.update.connect(toggleOverlays); Script.scriptEnding.connect(cleanup); }()); From 7e138ebfff00edee42a2f3f4868bc3769ed62a9d Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 26 Sep 2018 10:52:45 -0700 Subject: [PATCH 09/48] update to new enabling method --- interface/src/Application.cpp | 15 ++++++++++----- interface/src/octree/SafeLanding.cpp | 3 +-- scripts/defaultScripts.js | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e0d2ab2586..e6a3ca30f3 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6240,14 +6240,19 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) { const bool isModifiedQuery = !_physicsEnabled; if (isModifiedQuery) { // Create modified view that is a simple sphere. + bool interstitialModeEnabled = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); ConicalViewFrustum sphericalView; - ConicalViewFrustum farView; - - farView.set(_viewFrustum); - sphericalView.setSimpleRadius(INITIAL_QUERY_RADIUS); - _octreeQuery.setConicalViews({ sphericalView, farView }); + + if (interstitialModeEnabled) { + ConicalViewFrustum farView; + farView.set(_viewFrustum); + _octreeQuery.setConicalViews({ sphericalView, farView }); + } else { + _octreeQuery.setConicalViews({ sphericalView }); + } + _octreeQuery.setOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE); static constexpr float MIN_LOD_ADJUST = -20.0f; _octreeQuery.setBoundaryLevelAdjust(MIN_LOD_ADJUST); diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index ba6e1dac8a..5c11c3251f 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -181,8 +181,7 @@ bool SafeLanding::isEntityLoadingComplete() { auto entityTree = qApp->getEntities(); auto entityMapIter = _trackedEntities.begin(); - Settings settings; - bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool(); + bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); while (entityMapIter != _trackedEntities.end()) { auto entity = entityMapIter->second; diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index aaf5ca7260..3f015930f4 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -38,7 +38,7 @@ var DEFAULT_SCRIPTS_SEPARATE = [ //"system/chat.js" ]; -if (Settings.getValue("enableInterstitialMode", false)) { +if (Window.interstitialModeEnabled) { DEFAULT_SCRIPTS_SEPARATE.push("system/interstitialPage.js"); } From db41a1c16b22f42ae9f827f58ded23f5ed7e64e0 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 26 Sep 2018 13:48:15 -0700 Subject: [PATCH 10/48] error state signal for 404/interstitial --- interface/src/octree/SafeLanding.cpp | 2 +- .../scripting/WindowScriptingInterface.cpp | 1 + .../src/scripting/WindowScriptingInterface.h | 8 +++ libraries/networking/src/DomainHandler.cpp | 2 + libraries/networking/src/DomainHandler.h | 3 +- scripts/defaultScripts.js | 2 +- scripts/system/interstitialPage.js | 38 +++++++++++-- scripts/system/redirectOverlays.js | 55 +++++++++++-------- 8 files changed, 78 insertions(+), 33 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 5d4ebe9853..333d76be66 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -172,7 +172,7 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; Settings settings; - bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool(); + bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); if (enableInterstitial) { isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index d4eb37e0aa..4ebfc6411a 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -39,6 +39,7 @@ WindowScriptingInterface::WindowScriptingInterface() { connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, &WindowScriptingInterface::disconnectedFromDomain); connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &WindowScriptingInterface::domainConnectionRefused); + connect(&domainHandler, &DomainHandler::redirectErrorStateChanged, this, &WindowScriptingInterface::redirectErrorStateChanged); connect(qApp, &Application::svoImportRequested, [this](const QString& urlString) { static const QMetaMethod svoImportRequestedSignal = diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index ddd7159f23..f6a5a5ef74 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -611,6 +611,14 @@ signals: */ void domainConnectionRefused(const QString& reasonMessage, int reasonCode, const QString& extraInfo); + /**jsdoc + * Triggered when you try to visit a domain but are redirected into the error state. + * @function Window.redirectErrorStateChanged + * @param {boolean} isInErrorState - If true, the user has been redirected to the error URL. + * @returns {Signal} + */ + void redirectErrorStateChanged(bool isInErrorState); + /**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/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index 043465d18e..3ff8f29cd0 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -123,6 +123,7 @@ void DomainHandler::hardReset() { softReset(); _isInErrorState = false; + emit redirectErrorStateChanged(_isInErrorState); qCDebug(networking) << "Hard reset in NodeList DomainHandler."; _pendingDomainID = QUuid(); @@ -362,6 +363,7 @@ void DomainHandler::setRedirectErrorState(QUrl errorUrl, QString reasonMessage, if (getInterstitialModeEnabled()) { _errorDomainURL = errorUrl; _isInErrorState = true; + emit redirectErrorStateChanged(_isInErrorState); emit redirectToErrorDomainURL(_errorDomainURL); } else { emit domainConnectionRefused(reasonMessage, reasonCode, extraInfo); diff --git a/libraries/networking/src/DomainHandler.h b/libraries/networking/src/DomainHandler.h index e9ec20ba2e..8cf84b602a 100644 --- a/libraries/networking/src/DomainHandler.h +++ b/libraries/networking/src/DomainHandler.h @@ -187,8 +187,6 @@ private slots: signals: void domainURLChanged(QUrl domainURL); - void domainConnectionErrorChanged(int reasonCode); - // NOTE: the emission of completedSocketDiscovery does not mean a connection to DS is established // It means that, either from DNS lookup or ICE, we think we have a socket we can talk to DS on void completedSocketDiscovery(); @@ -205,6 +203,7 @@ signals: void domainConnectionRefused(QString reasonMessage, int reason, const QString& extraInfo); void redirectToErrorDomainURL(QUrl errorDomainURL); + void redirectErrorStateChanged(bool isInErrorState); void limitOfSilentDomainCheckInsReached(); diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index e11891bb33..42341a8484 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -38,7 +38,7 @@ var DEFAULT_SCRIPTS_SEPARATE = [ //"system/chat.js" ]; -if (Settings.getValue("enableInterstitialMode", false)) { +if (Window.interstitialModeEnabled) { DEFAULT_SCRIPTS_SEPARATE.push("system/interstitialPage.js"); DEFAULT_SCRIPTS_SEPARATE.push("system/redirectOverlays.js"); } diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 49708c44fe..218aafea2b 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -37,6 +37,8 @@ var tablet = null; var button = null; + var errorConnectingToDomain = false; + // Tips have a character limit of 69 var userTips = [ "Tip: Visit TheSpot to explore featured domains!", @@ -188,6 +190,16 @@ var connectionToDomainFailed = false; + function getOopsText() { + var error = Window.getLastDomainConnectionError(); + var errorMessageMapIndex = hardRefusalErrors.indexOf(error); + if (errorMessageMapIndex >= 0) { + return ERROR_MESSAGE_MAP[errorMessageMapIndex]; + } else { + // some other text. + return ERROR_MESSAGE_MAP[4]; + } + } function getAnchorLocalYOffset() { var loadingSpherePosition = Overlays.getProperty(loadingSphereID, "position"); @@ -235,6 +247,13 @@ } } + function toggleInterstitialPage(isInErrorState) { + errorConnectingToDomain = isInErrorState; + if (!errorConnectingToDomain) { + domainChanged(location); + } + } + function startAudio() { sample = Audio.playSound(tune, { localOnly: true, @@ -347,9 +366,11 @@ Overlays.editOverlay(loadingBarPlacard, properties); Overlays.editOverlay(loadingBarProgress, loadingBarProperties); - Menu.setIsOptionChecked("Show Overlays", physicsEnabled); - if (!HMD.active) { - toolbar.writeProperty("visible", physicsEnabled); + if (errorConnectingToDomain) { + Menu.setIsOptionChecked("Show Overlays", physicsEnabled); + if (!HMD.active) { + toolbar.writeProperty("visible", physicsEnabled); + } } resetValues(); @@ -359,7 +380,6 @@ } } - function scaleInterstitialPage(sensorToWorldScale) { var yOffset = getAnchorLocalYOffset(); var localPosition = { @@ -399,14 +419,19 @@ Overlays.editOverlay(loadingBarProgress, properties); - if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { + if (errorConnectingToDomain) { + updateOverlays(errorConnectingToDomain); + endAudio(); + currentDomain = "no domain"; + timer = null; + return; + } else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); endAudio(); currentDomain = "no domain"; timer = null; return; } - timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS); } var whiteColor = {red: 255, green: 255, blue: 255}; @@ -430,6 +455,7 @@ connectionToDomainFailed = !location.isConnected; }, 1200); }); + Window.redirectErrorStateChanged.connect(toggleInterstitialPage); MyAvatar.sensorToWorldScaleChanged.connect(scaleInterstitialPage); MyAvatar.sessionUUIDChanged.connect(function() { diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 5d37078a26..5264112476 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -13,11 +13,10 @@ var TIMEOUT = 5; var hardRefusalErrors = [PROTOCOL_VERSION_MISMATCH, NOT_AUTHORIZED, TIMEOUT]; - var error = -1; var timer = null; function getOopsText() { - error = Window.getLastDomainConnectionError(); + var error = Window.getLastDomainConnectionError(); var errorMessageMapIndex = hardRefusalErrors.indexOf(error); if (errorMessageMapIndex >= 0) { return ERROR_MESSAGE_MAP[errorMessageMapIndex]; @@ -29,58 +28,68 @@ var redirectOopsText = Overlays.addOverlay("text3d", { name: "oopsText", - localPosition: {x: 0.5691902160644531, y: 0.6403706073760986, z: 6.68358039855957}, + localPosition: {x: 0.2691902160644531, y: 0.6403706073760986, z: 3.18358039855957}, + localRotation: Quat.fromPitchYawRollDegrees(0.0, 180.0, 0.0), text: getOopsText(), textAlpha: 1, backgroundAlpha: 0, + color: {x: 255, y: 255, z: 255}, lineHeight: 0.10, + leftMargin: 0.538373570564886, visible: false, emissive: true, ignoreRayIntersection: false, - drawInFront: true, + dimensions: {x: 4.2, y: 1}, grabbable: false, - orientation: {x: 0.0, y: 0.5, z: 0.0, w: 0.87}, parentID: MyAvatar.SELF_ID, parentJointIndex: MyAvatar.getJointIndex("Head") }); var tryAgainImage = Overlays.addOverlay("image3d", { name: "tryAgainImage", - localPosition: {x: -0.15, y: -0.4, z: 0.0}, + localPosition: {x: -0.6, y: -0.4, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_tryAgain.png", alpha: 1, visible: false, emissive: true, ignoreRayIntersection: false, - drawInFront: true, grabbable: false, - orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), parentID: redirectOopsText }); var backImage = Overlays.addOverlay("image3d", { name: "backImage", - localPosition: {x: 1.0, y: -0.4, z: 0.0}, + localPosition: {x: 0.6, y: -0.4, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_back.png", alpha: 1, visible: false, emissive: true, ignoreRayIntersection: false, - drawInFront: true, grabbable: false, - orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), parentID: redirectOopsText }); var TARGET_UPDATE_HZ = 60; var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ; - function toggleOverlays() { + function toggleOverlays(isInErrorState) { + if (!isInErrorState) { + var properties = { + visible: false + }; + + Overlays.editOverlay(redirectOopsText, properties); + Overlays.editOverlay(tryAgainImage, properties); + Overlays.editOverlay(backImage, properties); + return; + } var overlaysVisible = false; - error = Window.getLastDomainConnectionError(); + var error = Window.getLastDomainConnectionError(); var errorMessageMapIndex = hardRefusalErrors.indexOf(error); var oopsText = ""; - if (error === -1 || !Window.isPhysicsEnabled() || location.isConnected) { + if (error === -1) { overlaysVisible = false; } else if (errorMessageMapIndex >= 0) { overlaysVisible = true; @@ -93,28 +102,27 @@ visible: overlaysVisible }; + var textWidth = Overlays.textSize(redirectOopsText, oopsText).width; + var textOverlayWidth = Overlays.getProperty(redirectOopsText, "dimensions").x; + var oopsTextProperties = { visible: overlaysVisible, - text: oopsText + text: oopsText, + leftMargin: (textOverlayWidth - textWidth) / 2 }; Overlays.editOverlay(redirectOopsText, oopsTextProperties); Overlays.editOverlay(tryAgainImage, properties); Overlays.editOverlay(backImage, properties); + } function clickedOnOverlay(overlayID, event) { - var properties = { - visible: false - }; if (tryAgainImage === overlayID) { location.goToLastAddress(); } else if (backImage === overlayID) { location.goBack(); } - Overlays.editOverlay(redirectOopsText, properties); - Overlays.editOverlay(tryAgainImage, properties); - Overlays.editOverlay(backImage, properties); } function cleanup() { @@ -125,6 +133,8 @@ Overlays.deleteOverlay(backImage); } + toggleOverlays(true); + var whiteColor = {red: 255, green: 255, blue: 255}; var greyColor = {red: 125, green: 125, blue: 125}; Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); @@ -140,8 +150,7 @@ } }); - timer = Script.setInterval(toggleOverlays, 500); - // Script.update.connect(toggleOverlays); + Window.redirectErrorStateChanged.connect(toggleOverlays); Script.scriptEnding.connect(cleanup); }()); From db77cbcbc1281b0026ed34c0a6eefd32c980684a Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 26 Sep 2018 15:12:48 -0700 Subject: [PATCH 11/48] new location drop - unparent overlays --- interface/resources/serverless/redirect.json | 2 +- scripts/system/interstitialPage.js | 32 ++++++++++---------- scripts/system/redirectOverlays.js | 16 +++++----- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/interface/resources/serverless/redirect.json b/interface/resources/serverless/redirect.json index b40b3867b3..0b96bad961 100644 --- a/interface/resources/serverless/redirect.json +++ b/interface/resources/serverless/redirect.json @@ -2,7 +2,7 @@ "DataVersion": 0, "Paths": { - "/": "/5.77,1.4,4.96/0,0.49544,0,0.868645" + "/": "/2.3,0.4,2.89/0,0.49544,0,0.868645" }, "Entities": [ { diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 218aafea2b..22ff6eb4b4 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -38,6 +38,7 @@ var button = null; var errorConnectingToDomain = false; + var resettingError = false; // Tips have a character limit of 69 var userTips = [ @@ -190,17 +191,6 @@ var connectionToDomainFailed = false; - function getOopsText() { - var error = Window.getLastDomainConnectionError(); - var errorMessageMapIndex = hardRefusalErrors.indexOf(error); - if (errorMessageMapIndex >= 0) { - return ERROR_MESSAGE_MAP[errorMessageMapIndex]; - } else { - // some other text. - return ERROR_MESSAGE_MAP[4]; - } - } - function getAnchorLocalYOffset() { var loadingSpherePosition = Overlays.getProperty(loadingSphereID, "position"); var loadingSphereOrientation = Overlays.getProperty(loadingSphereID, "rotation"); @@ -366,11 +356,10 @@ Overlays.editOverlay(loadingBarPlacard, properties); Overlays.editOverlay(loadingBarProgress, loadingBarProperties); - if (errorConnectingToDomain) { - Menu.setIsOptionChecked("Show Overlays", physicsEnabled); - if (!HMD.active) { - toolbar.writeProperty("visible", physicsEnabled); - } + Menu.setIsOptionChecked("Show Overlays", physicsEnabled); + if (!HMD.active) { + print("Show toolbar: " + physicsEnabled); + toolbar.writeProperty("visible", physicsEnabled); } resetValues(); @@ -391,6 +380,15 @@ Overlays.editOverlay(anchorOverlay, { localPosition: localPosition }); } + function sleep(milliseconds) { + var start = new Date().getTime(); + for (var i = 0; i < 1e7; i++) { + if ((new Date().getTime() - start) > milliseconds){ + break; + } + } + } + function update() { var physicsEnabled = Window.isPhysicsEnabled(); var thisInterval = Date.now(); @@ -424,6 +422,8 @@ endAudio(); currentDomain = "no domain"; timer = null; + sleep(300); + toolbar.writeProperty("visible", true); return; } else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 5264112476..165e8ae27a 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -26,10 +26,12 @@ } }; + var oopsDimensions = {x: 4.2, y: 1}; + var redirectOopsText = Overlays.addOverlay("text3d", { name: "oopsText", - localPosition: {x: 0.2691902160644531, y: 0.6403706073760986, z: 3.18358039855957}, - localRotation: Quat.fromPitchYawRollDegrees(0.0, 180.0, 0.0), + position: {x: 0, y: 1.6763916015625, z: 1.45927095413208}, + rotation: {x: -4.57763671875e-05, y: 0.4957197904586792, z: -7.62939453125e-05, w: 0.8684672117233276}, text: getOopsText(), textAlpha: 1, backgroundAlpha: 0, @@ -39,15 +41,13 @@ visible: false, emissive: true, ignoreRayIntersection: false, - dimensions: {x: 4.2, y: 1}, + dimensions: oopsDimensions, grabbable: false, - parentID: MyAvatar.SELF_ID, - parentJointIndex: MyAvatar.getJointIndex("Head") }); var tryAgainImage = Overlays.addOverlay("image3d", { name: "tryAgainImage", - localPosition: {x: -0.6, y: -0.4, z: 0.0}, + localPosition: {x: -0.6, y: -0.6, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_tryAgain.png", alpha: 1, visible: false, @@ -60,7 +60,7 @@ var backImage = Overlays.addOverlay("image3d", { name: "backImage", - localPosition: {x: 0.6, y: -0.4, z: 0.0}, + localPosition: {x: 0.6, y: -0.6, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_back.png", alpha: 1, visible: false, @@ -103,7 +103,7 @@ }; var textWidth = Overlays.textSize(redirectOopsText, oopsText).width; - var textOverlayWidth = Overlays.getProperty(redirectOopsText, "dimensions").x; + var textOverlayWidth = oopsDimensions.x; var oopsTextProperties = { visible: overlaysVisible, From afae4f3b9682e723380481e781f9f5c8dc04ec0d Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 26 Sep 2018 15:33:57 -0700 Subject: [PATCH 12/48] adding toolbar reappearing --- scripts/system/interstitialPage.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 22ff6eb4b4..4b48ce66d4 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -422,8 +422,14 @@ endAudio(); currentDomain = "no domain"; timer = null; + // The toolbar doesn't become visible in time to match the speed of + // the signal handling of redirectErrorStateChanged in both this script + // and the redirectOverlays.js script. Use a sleep function to ensure + // the toolbar becomes visible again. sleep(300); - toolbar.writeProperty("visible", true); + if (!HMD.active) { + toolbar.writeProperty("visible", true); + } return; } else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); From fda3ec87ceb59c6f341e0c05a5a4f239d83f9d8e Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 26 Sep 2018 15:57:57 -0700 Subject: [PATCH 13/48] removing lingering print statement --- scripts/system/interstitialPage.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 4b48ce66d4..36184ef3cc 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -358,7 +358,6 @@ Menu.setIsOptionChecked("Show Overlays", physicsEnabled); if (!HMD.active) { - print("Show toolbar: " + physicsEnabled); toolbar.writeProperty("visible", physicsEnabled); } From 33db8e1f24128018046e5f3411214326d821c71c Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 26 Sep 2018 16:40:43 -0700 Subject: [PATCH 14/48] only allow right-click for buttons --- scripts/system/redirectOverlays.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 165e8ae27a..66b338e49c 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -118,6 +118,10 @@ } function clickedOnOverlay(overlayID, event) { + if (event.isRightButton) { + // don't allow right-clicks. + return; + } if (tryAgainImage === overlayID) { location.goToLastAddress(); } else if (backImage === overlayID) { From 747aab2097326e78c76bb105d1ccf0f40982648e Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 10:16:11 -0700 Subject: [PATCH 15/48] persisting signed values --- interface/src/Application.cpp | 5 ++--- interface/src/Application.h | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2ffd49a0b7..69f2445dd3 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -365,7 +365,6 @@ static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SI static const uint32_t INVALID_FRAME = UINT32_MAX; -static const float PHYSICS_READY_RANGE = 3.0f; // how far from avatar to check for entities that aren't ready for simulation static const float INITIAL_QUERY_RADIUS = 10.0f; // priority radius for entities before physics enabled static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); @@ -6569,8 +6568,8 @@ bool Application::gpuTextureMemSizeStable() { auto renderConfig = qApp->getRenderEngine()->getConfiguration(); auto renderStats = renderConfig->getConfig("Stats"); - quint64 textureResourceGPUMemSize = renderStats->textureResourceGPUMemSize; - quint64 texturePopulatedGPUMemSize = renderStats->textureResourcePopulatedGPUMemSize; + qint64 textureResourceGPUMemSize = renderStats->textureResourceGPUMemSize; + qint64 texturePopulatedGPUMemSize = renderStats->textureResourcePopulatedGPUMemSize; if (_gpuTextureMemSizeAtLastCheck == textureResourceGPUMemSize) { _gpuTextureMemSizeStabilityCount++; diff --git a/interface/src/Application.h b/interface/src/Application.h index d9fff89915..cb37e655fc 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -730,8 +730,8 @@ private: std::atomic _fullSceneReceivedCounter { 0 }; // how many times have we received a full-scene octree stats packet uint32_t _fullSceneCounterAtLastPhysicsCheck { 0 }; // _fullSceneReceivedCounter last time we checked physics ready - quint64 _gpuTextureMemSizeStabilityCount { 0 }; - quint64 _gpuTextureMemSizeAtLastCheck { 0 }; + qint64 _gpuTextureMemSizeStabilityCount { 0 }; + qint64 _gpuTextureMemSizeAtLastCheck { 0 }; quint64 _lastPhysicsCheckTime { usecTimestampNow() }; // when did we last check to see if physics was ready From 9079c8a6b76c94cf395cb13e44589ae359703b1c Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 10:42:21 -0700 Subject: [PATCH 16/48] adding log for redirect cases --- libraries/networking/src/DomainHandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index 3ff8f29cd0..3a8253bfc6 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -363,6 +363,7 @@ void DomainHandler::setRedirectErrorState(QUrl errorUrl, QString reasonMessage, if (getInterstitialModeEnabled()) { _errorDomainURL = errorUrl; _isInErrorState = true; + qCDebug(networking) << "Error connecting to domain: " << reasonMessage; emit redirectErrorStateChanged(_isInErrorState); emit redirectToErrorDomainURL(_errorDomainURL); } else { From 8b29f7c2944d45c742eece967ab58e362cdc9bf2 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 16:56:45 -0700 Subject: [PATCH 17/48] making text box smaller for no occlusion --- scripts/system/redirectOverlays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 66b338e49c..4de9ee354c 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -26,7 +26,7 @@ } }; - var oopsDimensions = {x: 4.2, y: 1}; + var oopsDimensions = {x: 4.2, y: 0.8}; var redirectOopsText = Overlays.addOverlay("text3d", { name: "oopsText", From 5d27cddab5d42801b390ab1e5730381424469233 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 17:16:18 -0700 Subject: [PATCH 18/48] consolidating getting oops message --- scripts/system/redirectOverlays.js | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 4de9ee354c..b4a89a7a4e 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -18,7 +18,10 @@ function getOopsText() { var error = Window.getLastDomainConnectionError(); var errorMessageMapIndex = hardRefusalErrors.indexOf(error); - if (errorMessageMapIndex >= 0) { + if (error === -1) { + // not an error. + return ""; + } else if (errorMessageMapIndex >= 0) { return ERROR_MESSAGE_MAP[errorMessageMapIndex]; } else { // some other text. @@ -71,9 +74,6 @@ parentID: redirectOopsText }); - var TARGET_UPDATE_HZ = 60; - var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ; - function toggleOverlays(isInErrorState) { if (!isInErrorState) { var properties = { @@ -85,19 +85,9 @@ Overlays.editOverlay(backImage, properties); return; } - var overlaysVisible = false; - var error = Window.getLastDomainConnectionError(); - var errorMessageMapIndex = hardRefusalErrors.indexOf(error); - var oopsText = ""; - if (error === -1) { - overlaysVisible = false; - } else if (errorMessageMapIndex >= 0) { - overlaysVisible = true; - oopsText = ERROR_MESSAGE_MAP[errorMessageMapIndex]; - } else { - overlaysVisible = true; - oopsText = ERROR_MESSAGE_MAP[4]; - } + var oopsText = getOopsText(); + // if oopsText === "", it was a success. + var overlaysVisible = (oopsText !== ""); var properties = { visible: overlaysVisible }; From d5950db2a4f1ab48ab7d108214fa512bd9e96f6f Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 21:20:06 -0700 Subject: [PATCH 19/48] fix for showing the text overlay in mac --- scripts/system/redirectOverlays.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index b4a89a7a4e..4d6d185adc 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -37,8 +37,8 @@ rotation: {x: -4.57763671875e-05, y: 0.4957197904586792, z: -7.62939453125e-05, w: 0.8684672117233276}, text: getOopsText(), textAlpha: 1, + backgroundColor: {x: 0, y: 0, z:0}, backgroundAlpha: 0, - color: {x: 255, y: 255, z: 255}, lineHeight: 0.10, leftMargin: 0.538373570564886, visible: false, @@ -98,10 +98,15 @@ var oopsTextProperties = { visible: overlaysVisible, text: oopsText, + textAlpha: overlaysVisible, + // either visible or invisible. 0 doesn't work in Mac. + backgroundAlpha: overlaysVisible * 0.00393, leftMargin: (textOverlayWidth - textWidth) / 2 }; + Window.copyToClipboard(redirectOopsText); Overlays.editOverlay(redirectOopsText, oopsTextProperties); + print("toggleOverlays: setting alpha to " + Overlays.getProperty(redirectOopsText, "alpha")); Overlays.editOverlay(tryAgainImage, properties); Overlays.editOverlay(backImage, properties); From 5c9094d81f32128847582cbcaddc0f9bd6bd7232 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 21:24:04 -0700 Subject: [PATCH 20/48] removing debug print statement --- scripts/system/redirectOverlays.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 4d6d185adc..307bd2b95f 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -106,7 +106,6 @@ Window.copyToClipboard(redirectOopsText); Overlays.editOverlay(redirectOopsText, oopsTextProperties); - print("toggleOverlays: setting alpha to " + Overlays.getProperty(redirectOopsText, "alpha")); Overlays.editOverlay(tryAgainImage, properties); Overlays.editOverlay(backImage, properties); From a8b86bd555c1fbf17a2cfd63ca1e3bb7c0c916f5 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Fri, 28 Sep 2018 08:44:49 -0700 Subject: [PATCH 21/48] removing debug statement --- scripts/system/redirectOverlays.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 307bd2b95f..8dd7d0d26a 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -103,7 +103,6 @@ backgroundAlpha: overlaysVisible * 0.00393, leftMargin: (textOverlayWidth - textWidth) / 2 }; - Window.copyToClipboard(redirectOopsText); Overlays.editOverlay(redirectOopsText, oopsTextProperties); Overlays.editOverlay(tryAgainImage, properties); From 5f05be554f3d079a52c36b30adc7f6733847d555 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Mon, 1 Oct 2018 10:06:13 -0700 Subject: [PATCH 22/48] check for hard refusal to 404 --- libraries/networking/src/DomainHandler.cpp | 7 ++++++- libraries/networking/src/DomainHandler.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index 3a8253bfc6..615546b410 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -139,6 +139,11 @@ void DomainHandler::hardReset() { _pendingPath.clear(); } +bool DomainHandler::isHardRefusal(int reasonCode) { + return (reasonCode == (int)ConnectionRefusedReason::ProtocolMismatch || reasonCode == (int)ConnectionRefusedReason::NotAuthorized || + reasonCode == (int)ConnectionRefusedReason::TimedOut); +} + bool DomainHandler::getInterstitialModeEnabled() const { return _interstitialModeSettingLock.resultWithReadLock([&] { return _enableInterstitialMode.get(); @@ -360,7 +365,7 @@ void DomainHandler::loadedErrorDomain(std::map namedPaths) { void DomainHandler::setRedirectErrorState(QUrl errorUrl, QString reasonMessage, int reasonCode, const QString& extraInfo) { _lastDomainConnectionError = reasonCode; - if (getInterstitialModeEnabled()) { + if (getInterstitialModeEnabled() && isHardRefusal(reasonCode)) { _errorDomainURL = errorUrl; _isInErrorState = true; qCDebug(networking) << "Error connecting to domain: " << reasonMessage; diff --git a/libraries/networking/src/DomainHandler.h b/libraries/networking/src/DomainHandler.h index 8cf84b602a..1ff88b425d 100644 --- a/libraries/networking/src/DomainHandler.h +++ b/libraries/networking/src/DomainHandler.h @@ -212,6 +212,8 @@ private: void sendDisconnectPacket(); void hardReset(); + bool isHardRefusal(int reasonCode); + QUuid _uuid; Node::LocalID _localID; QUrl _domainURL; From 652ec2210d927fbd3b911eebb0b066f42fe8ef42 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 1 Oct 2018 13:58:14 -0700 Subject: [PATCH 23/48] fixing loading issues --- interface/src/octree/SafeLanding.cpp | 32 +++++++++++++------ .../src/RenderableModelEntityItem.cpp | 9 +++++- .../src/RenderableModelEntityItem.h | 1 + .../src/model-networking/ModelCache.cpp | 5 +++ 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index d181348276..6f341c1990 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -14,7 +14,7 @@ #include #include "EntityTreeRenderer.h" -#include "ModelEntityItem.h" +#include "RenderableModelEntityItem.h" #include "InterfaceLogging.h" #include "Application.h" @@ -124,18 +124,30 @@ bool SafeLanding::isLoadSequenceComplete() { float SafeLanding::loadingProgressPercentage() { Locker lock(_lock); + float sequencePercentage = 0.0f; + + if (_initialStart != INVALID_SEQUENCE && _initialEnd != 0) { + int sequenceSize = _initialStart <= _initialEnd ? _initialEnd - _initialStart: + _initialEnd + SEQUENCE_MODULO - _initialStart; + + auto startIter = _sequenceNumbers.find(_initialStart); + auto endIter = _sequenceNumbers.find(_initialEnd - 1); + + sequencePercentage = (distance(startIter, endIter) / (sequenceSize - 1)); + } + static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15; - float percentage = 0.0f; + float entityReadyPercentage = 0.0f; if (_maxTrackedEntityCount > 0) { - percentage = ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount); + entityReadyPercentage = ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount); } if (_trackedEntityStabilityCount < MINIMUM_TRACKED_ENTITY_STABILITY_COUNT) { - percentage *= 0.20f; + entityReadyPercentage *= 0.20f; } - return percentage; + return ((sequencePercentage *= 0.50f) + (entityReadyPercentage *= 0.50f)); } bool SafeLanding::isSequenceNumbersComplete() { @@ -148,7 +160,7 @@ bool SafeLanding::isSequenceNumbersComplete() { if (sequenceSize == 0 || (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() - && distance(startIter, endIter) == sequenceSize - 1) ) { + && distance(startIter, endIter) == sequenceSize - 1)) { _trackingEntities = false; // Don't track anything else that comes in. return true; } @@ -160,13 +172,13 @@ bool isEntityPhysicsReady(const EntityItemPointer& entity) { if (entity && !entity->getCollisionless()) { const auto& entityType = entity->getType(); if (entityType == EntityTypes::Model) { - ModelEntityItem * modelEntity = std::dynamic_pointer_cast(entity).get(); + RenderableModelEntityItem * modelEntity = std::dynamic_pointer_cast(entity).get(); static const std::set downloadedCollisionTypes { SHAPE_TYPE_COMPOUND, SHAPE_TYPE_SIMPLE_COMPOUND, SHAPE_TYPE_STATIC_MESH, SHAPE_TYPE_SIMPLE_HULL }; bool hasAABox; entity->getAABox(hasAABox); if (hasAABox && downloadedCollisionTypes.count(modelEntity->getShapeType()) != 0) { - return (!entity->shouldBePhysical() || entity->isReadyToComputeShape()); + return (!entity->shouldBePhysical() || entity->isReadyToComputeShape() || modelEntity->computeShapeFailedToLoad()); } } } @@ -193,7 +205,7 @@ bool SafeLanding::isEntityLoadingComplete() { if (enableInterstitial) { isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); - qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID() << isVisuallyReady; + //qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID() << isVisuallyReady; } if (isEntityPhysicsReady(entity) && isVisuallyReady) { @@ -209,7 +221,7 @@ bool SafeLanding::isEntityLoadingComplete() { if (enableInterstitial) { _trackedEntityStabilityCount++; - qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; + //qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 3a01650a04..7df9762158 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -314,6 +314,14 @@ void RenderableModelEntityItem::getCollisionGeometryResource() { _compoundShapeResource = DependencyManager::get()->getCollisionGeometryResource(hullURL); } +bool RenderableModelEntityItem::computeShapeFailedToLoad() { + if (!_compoundShapeResource) { + getCollisionGeometryResource(); + } + + return (_compoundShapeResource && _compoundShapeResource->isFailed()); +} + void RenderableModelEntityItem::setShapeType(ShapeType type) { ModelEntityItem::setShapeType(type); if (getShapeType() == SHAPE_TYPE_COMPOUND) { @@ -342,7 +350,6 @@ void RenderableModelEntityItem::setCompoundShapeURL(const QString& url) { bool RenderableModelEntityItem::isReadyToComputeShape() const { ShapeType type = getShapeType(); - auto model = getModel(); if (type == SHAPE_TYPE_COMPOUND) { if (!model || getCompoundShapeURL().isEmpty()) { diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index 75f35fae9c..6fcfa04a1d 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -81,6 +81,7 @@ public: virtual bool isReadyToComputeShape() const override; virtual void computeShapeInfo(ShapeInfo& shapeInfo) override; + bool computeShapeFailedToLoad(); virtual bool contains(const glm::vec3& point) const override; void stopModelOverrideIfNoParent(); diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index f669e8aaef..4d6297303b 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -551,6 +551,11 @@ QUrl NetworkMaterial::getTextureUrl(const QUrl& baseUrl, const FBXTexture& textu graphics::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& baseUrl, const FBXTexture& fbxTexture, image::TextureUsage::Type type, MapChannel channel) { + + if (baseUrl.isEmpty()) { + return nullptr; + } + const auto url = getTextureUrl(baseUrl, fbxTexture); const auto texture = DependencyManager::get()->getTexture(url, type, fbxTexture.content, fbxTexture.maxNumPixels); _textures[channel] = Texture { fbxTexture.name, texture }; From 66bb5f68d28d2455001266b2ef96d3e086cc1395 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 1 Oct 2018 15:26:56 -0700 Subject: [PATCH 24/48] updating interstitialmode --- interface/src/octree/SafeLanding.cpp | 18 +----------------- scripts/system/interstitialPage.js | 1 + 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 6f341c1990..6b28d9c713 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -123,19 +123,6 @@ bool SafeLanding::isLoadSequenceComplete() { float SafeLanding::loadingProgressPercentage() { Locker lock(_lock); - - float sequencePercentage = 0.0f; - - if (_initialStart != INVALID_SEQUENCE && _initialEnd != 0) { - int sequenceSize = _initialStart <= _initialEnd ? _initialEnd - _initialStart: - _initialEnd + SEQUENCE_MODULO - _initialStart; - - auto startIter = _sequenceNumbers.find(_initialStart); - auto endIter = _sequenceNumbers.find(_initialEnd - 1); - - sequencePercentage = (distance(startIter, endIter) / (sequenceSize - 1)); - } - static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15; float entityReadyPercentage = 0.0f; @@ -147,7 +134,7 @@ float SafeLanding::loadingProgressPercentage() { entityReadyPercentage *= 0.20f; } - return ((sequencePercentage *= 0.50f) + (entityReadyPercentage *= 0.50f)); + return entityReadyPercentage; } bool SafeLanding::isSequenceNumbersComplete() { @@ -204,8 +191,6 @@ bool SafeLanding::isEntityLoadingComplete() { if (enableInterstitial) { isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); - - //qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID() << isVisuallyReady; } if (isEntityPhysicsReady(entity) && isVisuallyReady) { @@ -221,7 +206,6 @@ bool SafeLanding::isEntityLoadingComplete() { if (enableInterstitial) { _trackedEntityStabilityCount++; - //qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; } diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 00d62d7fc6..f066529375 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -264,6 +264,7 @@ function domainChanged(domain) { if (domain !== currentDomain) { MyAvatar.restoreAnimation(); + resetValues(); var name = location.placename; domainName = name.charAt(0).toUpperCase() + name.slice(1); var doRequest = true; From 69b547a9fe16cfe7422ab8ec4095cb353d06362c Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Mon, 1 Oct 2018 16:11:27 -0700 Subject: [PATCH 25/48] text overlays for consistency --- scripts/system/interstitialPage.js | 64 +++++++++++--- scripts/system/redirectOverlays.js | 132 ++++++++++++++++++++++++----- 2 files changed, 164 insertions(+), 32 deletions(-) diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 00d62d7fc6..38521208c7 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -38,7 +38,6 @@ var button = null; var errorConnectingToDomain = false; - var resettingError = false; // Tips have a character limit of 69 var userTips = [ @@ -128,7 +127,7 @@ localPosition: { x: 0.0 , y: -1.6, z: 0.0 }, text: toolTip, textAlpha: 1, - backgroundAlpha: 1, + backgroundAlpha: 0.00393, lineHeight: 0.13, visible: isVisible, ignoreRayIntersection: true, @@ -138,17 +137,47 @@ parentID: anchorOverlay }); - var loadingToTheSpotID = Overlays.addOverlay("image3d", { + var loadingToTheSpotText = Overlays.addOverlay("text3d", { name: "Loading-Destination-Card-Text", - localPosition: { x: 0.0 , y: -1.5, z: -0.3 }, - url: Script.resourcesPath() + "images/interstitialPage/goTo_button.png", + localPosition: { x: 0.0 , y: -1.687, z: -0.3 }, + text: "Go To TheSpot", + textAlpha: 1, + backgroundAlpha: 0.00393, + lineHeight: 0.10, + visible: isVisible, + ignoreRayIntersection: true, + dimensions: {x: 1, y: 0.17}, + drawInFront: true, + grabbable: false, + localOrientation: Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }), + parentID: anchorOverlay + }); + + var loadingToTheSpotID = Overlays.addOverlay("image3d", { + name: "Loading-Destination-Card-GoTo-Image", + localPosition: { x: 0.0 , y: -1.75, z: -0.3 }, + url: Script.resourcesPath() + "images/interstitialPage/button.png", alpha: 1, visible: isVisible, emissive: true, ignoreRayIntersection: false, drawInFront: true, grabbable: false, - localOrientation: Quat.fromVec3Degrees({ x: 0.0, y: 180.0, z: 0.0 }), + localOrientation: Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }), + parentID: anchorOverlay + }); + + var loadingToTheSpotHoverID = Overlays.addOverlay("image3d", { + name: "Loading-Destination-Card-GoTo-Image-Hover", + localPosition: { x: 0.0 , y: -1.75, z: -0.3 }, + url: Script.resourcesPath() + "images/interstitialPage/button_hover.png", + alpha: 1, + visible: false, + emissive: true, + ignoreRayIntersection: false, + drawInFront: true, + grabbable: false, + localOrientation: Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }), parentID: anchorOverlay }); @@ -268,7 +297,7 @@ domainName = name.charAt(0).toUpperCase() + name.slice(1); var doRequest = true; if (name.length === 0 && location.href === "file:///~/serverless/tutorial.json") { - domainName = "Serveless Domain (Tutorial)"; + domainName = "Serverless Domain (Tutorial)"; doRequest = false; } var domainNameLeftMargin = getLeftMargin(domainNameTextID, domainName); @@ -319,8 +348,10 @@ var THE_PLACE = (HifiAbout.buildVersion === "dev") ? "hifi://TheSpot-dev": "hifi://TheSpot"; function clickedOnOverlay(overlayID, event) { - if (loadingToTheSpotID === overlayID) { + if (loadingToTheSpotHoverID === overlayID) { location.handleLookupString(THE_PLACE); + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotID, {visible: true}); } } @@ -353,6 +384,7 @@ renderViewTask.getConfig("LightingModel")["enableDirectionalLight"] = physicsEnabled; renderViewTask.getConfig("LightingModel")["enablePointLight"] = physicsEnabled; Overlays.editOverlay(loadingSphereID, mainSphereProperties); + Overlays.editOverlay(loadingToTheSpotText, properties); Overlays.editOverlay(loadingToTheSpotID, properties); Overlays.editOverlay(domainNameTextID, properties); Overlays.editOverlay(domainDescription, domainTextProperties); @@ -475,13 +507,15 @@ Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); Overlays.hoverEnterOverlay.connect(function(overlayID, event) { if (overlayID === loadingToTheSpotID) { - Overlays.editOverlay(loadingToTheSpotID, { color: greyColor }); + Overlays.editOverlay(loadingToTheSpotID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: true}); } }); Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { - if (overlayID === loadingToTheSpotID) { - Overlays.editOverlay(loadingToTheSpotID, { color: whiteColor }); + if (overlayID === loadingToTheSpotHoverID) { + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotID, {visible: true}); } }); @@ -510,9 +544,17 @@ }); } + // set left margin of text. + var loadingTextProperties = { + leftMargin: getLeftMargin(loadingToTheSpotText, "Go To TheSpot") + 0.045 + }; + + Overlays.editOverlay(loadingToTheSpotText, loadingTextProperties); + function cleanup() { Overlays.deleteOverlay(loadingSphereID); Overlays.deleteOverlay(loadingToTheSpotID); + Overlays.deleteOverlay(loadingToTheSpotHoverID); Overlays.deleteOverlay(domainNameTextID); Overlays.deleteOverlay(domainDescription); Overlays.deleteOverlay(domainToolTip); diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 8dd7d0d26a..49844db5b0 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -43,15 +43,15 @@ leftMargin: 0.538373570564886, visible: false, emissive: true, - ignoreRayIntersection: false, + ignoreRayIntersection: true, dimensions: oopsDimensions, grabbable: false, }); - var tryAgainImage = Overlays.addOverlay("image3d", { + var tryAgainImageNeutral = Overlays.addOverlay("image3d", { name: "tryAgainImage", localPosition: {x: -0.6, y: -0.6, z: 0.0}, - url: Script.resourcesPath() + "images/interstitialPage/button_tryAgain.png", + url: Script.resourcesPath() + "images/interstitialPage/button.png", alpha: 1, visible: false, emissive: true, @@ -61,10 +61,10 @@ parentID: redirectOopsText }); - var backImage = Overlays.addOverlay("image3d", { - name: "backImage", - localPosition: {x: 0.6, y: -0.6, z: 0.0}, - url: Script.resourcesPath() + "images/interstitialPage/button_back.png", + var tryAgainImageHover = Overlays.addOverlay("image3d", { + name: "tryAgainImageHover", + localPosition: {x: -0.6, y: -0.6, z: 0.0}, + url: Script.resourcesPath() + "images/interstitialPage/button_hover.png", alpha: 1, visible: false, emissive: true, @@ -74,6 +74,62 @@ parentID: redirectOopsText }); + var tryAgainText = Overlays.addOverlay("text3d", { + name: "tryAgainText", + localPosition: {x: -0.6, y: -0.962, z: 0.0}, + text: "Try Again", + textAlpha: 1, + backgroundAlpha: 0.00393, + lineHeight: 0.08, + visible: false, + emissive: true, + ignoreRayIntersection: true, + grabbable: false, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), + parentID: redirectOopsText + }); + + var backImageNeutral = Overlays.addOverlay("image3d", { + name: "backImage", + localPosition: {x: 0.6, y: -0.6, z: 0.0}, + url: Script.resourcesPath() + "images/interstitialPage/button.png", + alpha: 1, + visible: false, + emissive: true, + ignoreRayIntersection: false, + grabbable: false, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), + parentID: redirectOopsText + }); + + var backImageHover = Overlays.addOverlay("image3d", { + name: "backImageHover", + localPosition: {x: 0.6, y: -0.6, z: 0.0}, + url: Script.resourcesPath() + "images/interstitialPage/button_hover.png", + alpha: 1, + visible: false, + emissive: true, + ignoreRayIntersection: false, + grabbable: false, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), + parentID: redirectOopsText + }); + + var backText = Overlays.addOverlay("text3d", { + name: "backText", + localPosition: {x: 0.6, y: -0.962, z: 0.0}, + text: "Back", + textAlpha: 1, + backgroundAlpha: 0.00393, + lineHeight: 0.08, + visible: false, + emissive: true, + ignoreRayIntersection: true, + grabbable: false, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), + parentID: redirectOopsText + }); + function toggleOverlays(isInErrorState) { if (!isInErrorState) { var properties = { @@ -81,8 +137,10 @@ }; Overlays.editOverlay(redirectOopsText, properties); - Overlays.editOverlay(tryAgainImage, properties); - Overlays.editOverlay(backImage, properties); + Overlays.editOverlay(tryAgainImageNeutral, properties); + Overlays.editOverlay(tryAgainImageHover, properties); + Overlays.editOverlay(backImageNeutral, properties); + Overlays.editOverlay(backImageHover, properties); return; } var oopsText = getOopsText(); @@ -104,9 +162,29 @@ leftMargin: (textOverlayWidth - textWidth) / 2 }; + var tryAgainTextWidth = Overlays.textSize(tryAgainText, "Try Again").width; + var tryAgainImageWidth = Overlays.getProperty(tryAgainImageNeutral, "dimensions").x; + + var tryAgainTextProperties = { + visible: overlaysVisible, + leftMargin: (tryAgainImageWidth - tryAgainTextWidth) / 2 + }; + + var backTextWidth = Overlays.textSize(backText, "Back").width; + var backImageWidth = Overlays.getProperty(backImageNeutral, "dimensions").x; + + var backTextProperties = { + visible: overlaysVisible, + leftMargin: (backImageWidth - backTextWidth) / 2 + }; + Overlays.editOverlay(redirectOopsText, oopsTextProperties); - Overlays.editOverlay(tryAgainImage, properties); - Overlays.editOverlay(backImage, properties); + Overlays.editOverlay(tryAgainImageNeutral, properties); + Overlays.editOverlay(backImageNeutral, properties); + Overlays.editOverlay(tryAgainImageHover, {visible: false}); + Overlays.editOverlay(backImageHover, {visible: false}); + Overlays.editOverlay(tryAgainText, tryAgainTextProperties); + Overlays.editOverlay(backText, backTextProperties); } @@ -115,9 +193,9 @@ // don't allow right-clicks. return; } - if (tryAgainImage === overlayID) { + if (tryAgainImageHover === overlayID) { location.goToLastAddress(); - } else if (backImage === overlayID) { + } else if (backImageHover === overlayID) { location.goBack(); } } @@ -126,24 +204,36 @@ Script.clearInterval(timer); timer = null; Overlays.deleteOverlay(redirectOopsText); - Overlays.deleteOverlay(tryAgainImage); - Overlays.deleteOverlay(backImage); + Overlays.deleteOverlay(tryAgainImageNeutral); + Overlays.deleteOverlay(backImageNeutral); + Overlays.deleteOverlay(tryAgainImageHover); + Overlays.deleteOverlay(backImageHover); + Overlays.deleteOverlay(tryAgainText); + Overlays.deleteOverlay(backText); } toggleOverlays(true); - var whiteColor = {red: 255, green: 255, blue: 255}; - var greyColor = {red: 125, green: 125, blue: 125}; Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); Overlays.hoverEnterOverlay.connect(function(overlayID, event) { - if (overlayID === backImage || overlayID === tryAgainImage) { - Overlays.editOverlay(overlayID, { color: greyColor }); + if (overlayID === backImageNeutral) { + Overlays.editOverlay(backImageNeutral, {visible: false}); + Overlays.editOverlay(backImageHover, {visible: true}); + } + if (overlayID === tryAgainImageNeutral) { + Overlays.editOverlay(tryAgainImageNeutral, {visible: false}); + Overlays.editOverlay(tryAgainImageHover, {visible: true}); } }); Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { - if (overlayID === backImage || overlayID === tryAgainImage) { - Overlays.editOverlay(overlayID, { color: whiteColor }); + if (overlayID === backImageHover) { + Overlays.editOverlay(backImageHover, {visible: false}); + Overlays.editOverlay(backImageNeutral, {visible: true}); + } + if (overlayID === tryAgainImageHover) { + Overlays.editOverlay(tryAgainImageHover, {visible: false}); + Overlays.editOverlay(tryAgainImageNeutral, {visible: true}); } }); From 2d85f882b8b87c69f8bb7cda58b0fcac7eb7fa2d Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Tue, 2 Oct 2018 17:47:09 -0700 Subject: [PATCH 26/48] adding buttons --- .../resources/images/interstitialPage/button.png | Bin 0 -> 2884 bytes .../images/interstitialPage/button_hover.png | Bin 0 -> 2174 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 interface/resources/images/interstitialPage/button.png create mode 100644 interface/resources/images/interstitialPage/button_hover.png diff --git a/interface/resources/images/interstitialPage/button.png b/interface/resources/images/interstitialPage/button.png new file mode 100644 index 0000000000000000000000000000000000000000..064e44758128b86bf7e43f6e280223517b87fd5f GIT binary patch literal 2884 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 i9mKz{+X7er7hnKB;CO`nlfqa40000g8*F zlCs~f#Nlw56gSh~0JsFZEX#J6{06fN3gB6BlgIIU{NEvvC%(r37jGSJpNjEPj7=Ct zh`$Kv^M-K<;aLpgsmd6D_bTle-XXZxW2(AG6VOE{hYy3bJ zRw*xHFz3Ek09;F04>F*OV4fE@pJTNQ09^|KeOCnaR{{NYFo$aSi)tBwo`j~dyJGyO z?*_9$1hilVKu`}TpyN{ZZ3n@;iIe*j|9ck)0GA^_%8%E>YiAt<^}qU9`tBv5V@LLF zOB17f z=Qf_1^0I!>6yv$Uq&&t6c4jaDn&iUnfoRdY#OFaywcQ15GG*K{mza9ZOH-V0^`29RNs z8V$|+cutSO|N5x9JTUW>0AOHwmd6I=Di%Y1GmER)!4AN+1ochDRpHw)hx1m|48Vv& zx@uq5{TRb}WnVJ@BMj+D?3WrxC0#L`Z+*l7j6A3pgWo3|Oa5{1I0u00`8ThyUwU!w z7ngb{)m}IQaDgFR<&fg(xn9&HacB8>4&DZUZj05)IbP68I0HbXkbds^h1}TZ3;?x4 z`nJm#Ae;f<*NmJcX5_4kCx3P*6#%@OlZ&(Ok4`*s_@j>pfGZE_`?H;CES@kt<@BA- z5C(vdPFr!Fweducy{xGNz&HasPiPw3Hhq%0t5N|#<@~(qG(Y3gb$`co0l;`e`mvLS zvBYk)nU4Sf-ptXIrS4^&4R6oVg$4kZ8`8^GtLTL4d9Q0509q+{m;G!E0IoZr+bMbz zI=5BN0MKp~y-3-}O7#o?XRV^QWgEy<&j8R%6+L_X+YfI%eqOTuuUVG8m}UT|?5^bg zPfgN2H@^T-tAd`C92dQR?}1ZSs{(*dL%Qs0SAVT!|GdOqw!Hn#)B->wWm)>iTd7`l zc`VIg0MNXO-j*$Me>nQ%5WdqB+k4O)1^}&iIB{RtPdzF~z4P8~Lw!1b|kZ zEPh`r=(2#`m`4C;)g~pN^HYD6W!c(10ziA>q076nfc|)58#~ho0G%ie=!t*^fV10_ z1$18L!2m!b-4To!FHHGypKNfVRX90B4pG(5_$w0Ote(K}~fOdUMsi1?63K{?gQ9Tp`#>;V8k)o`AaWbI!C@z1CF{Ig`c zpG_?QG%_!_e_bclx8@Z98dcDbC0RRt?}25@+;h_l0JXw7Pc4Msx|)?`ZUE@Umy-Lx zl_mUMvlsxhT0Kvyc+~N z#a5;q0Fp9w+1gQ3A;}Y}=$UB;fRlNevMRl(y3xm!vz-6{?`G+$^>d6QR?#=69{}FW z(Ru6DbA{yJYZwE7U-C0FhHX1riB4QQfAmoRz~A!ozVlwLgzmFo>Ei%^LJ~XG zgfsw`7|zSY3_O4HbcJ^EL+otR-3`DcgmdaDa%c*h_VprDE<%0$D6b@967J@wH8FwkJm zD=cXbGn|j!OqIs5AJw!5G5`jaXUmE!!~4M(ofUVYzY3N2!dC)-o-=G#aW!~+*P%$f zxW-#=a^@=nKo7zESR=RYN4W|dFIv5?8PqCj0EQaO?O!&shc}q#dY;TMaj!w$mG#lTLuh~ZH3k^9f5Z@eHEk(~-}1E>|1QFLckVZt4PmBZ16T;@ zh3_2z1JGMA4=SL43hEHjpF8|D1ORUdOW6;72lF5U`Y5PFIL~8HYXSqHOCgN!Le*RZ z^UF|PR5tWki&gdK7}&Y*5dbZPa;TQS4YjE_8`EsY4!v11{)o2#kSYZ6pCOpXaHLN* z=9!MiqlFRL>8C1e0HWi=Z`a}9Lt4I0@jn3u0DhI-AzTnMNB{r;07*qoM6N<$f~*Gz AB>(^b literal 0 HcmV?d00001 From b28c375ad3d8d988f2027c53ab965589ebc5ab5c Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 3 Oct 2018 09:56:07 -0700 Subject: [PATCH 27/48] better loading check logic --- interface/src/octree/SafeLanding.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 6b28d9c713..62bd1b7b89 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -116,9 +116,10 @@ bool SafeLanding::isLoadSequenceComplete() { _initialEnd = INVALID_SEQUENCE; _entityTree = nullptr; EntityTreeRenderer::setEntityLoadingPriorityFunction(StandardPriority); + return true; } - return !_trackingEntities; + return false; } float SafeLanding::loadingProgressPercentage() { @@ -149,10 +150,9 @@ bool SafeLanding::isSequenceNumbersComplete() { && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { _trackingEntities = false; // Don't track anything else that comes in. - return true; } } - return false; + return !_trackingEntities; } bool isEntityPhysicsReady(const EntityItemPointer& entity) { From efeb598495335918561bb8637096d41c0ae33b1d Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 3 Oct 2018 10:12:07 -0700 Subject: [PATCH 28/48] fixing bug with hover overlay --- scripts/system/interstitialPage.js | 38 ++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 869c47bd2a..bd542b298d 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -356,6 +356,26 @@ } } + function onEnterOverlay(overlayID, event) { + if (currentDomain === "no domain") { + return; + } + if (overlayID === loadingToTheSpotID) { + Overlays.editOverlay(loadingToTheSpotID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: true}); + } + } + + function onLeaveOverlay(overlayID, event) { + if (currentDomain === "no domain") { + return; + } + if (overlayID === loadingToTheSpotHoverID) { + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotID, {visible: true}); + } + } + var currentProgress = 0.1; function updateOverlays(physicsEnabled) { @@ -482,6 +502,8 @@ if (errorConnectingToDomain) { updateOverlays(errorConnectingToDomain); + // setting hover id to invisible + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); endAudio(); currentDomain = "no domain"; timer = null; @@ -496,6 +518,8 @@ return; } else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); + // setting hover id to invisible + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); endAudio(); currentDomain = "no domain"; timer = null; @@ -506,19 +530,9 @@ var whiteColor = {red: 255, green: 255, blue: 255}; var greyColor = {red: 125, green: 125, blue: 125}; Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); - Overlays.hoverEnterOverlay.connect(function(overlayID, event) { - if (overlayID === loadingToTheSpotID) { - Overlays.editOverlay(loadingToTheSpotID, {visible: false}); - Overlays.editOverlay(loadingToTheSpotHoverID, {visible: true}); - } - }); + Overlays.hoverEnterOverlay.connect(onEnterOverlay); - Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { - if (overlayID === loadingToTheSpotHoverID) { - Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); - Overlays.editOverlay(loadingToTheSpotID, {visible: true}); - } - }); + Overlays.hoverLeaveOverlay.connect(onLeaveOverlay); location.hostChanged.connect(domainChanged); location.lookupResultsFinished.connect(function() { From 78268001c4c7ca668d473a6df7d9170085f2b6d0 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 3 Oct 2018 15:13:42 -0700 Subject: [PATCH 29/48] reverting logic change --- interface/src/octree/SafeLanding.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 62bd1b7b89..f1deb06e3b 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -116,10 +116,9 @@ bool SafeLanding::isLoadSequenceComplete() { _initialEnd = INVALID_SEQUENCE; _entityTree = nullptr; EntityTreeRenderer::setEntityLoadingPriorityFunction(StandardPriority); - return true; } - return false; + return !_trackingEntities; } float SafeLanding::loadingProgressPercentage() { @@ -150,9 +149,10 @@ bool SafeLanding::isSequenceNumbersComplete() { && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { _trackingEntities = false; // Don't track anything else that comes in. + returnm true; } } - return !_trackingEntities; + return false; } bool isEntityPhysicsReady(const EntityItemPointer& entity) { From b46d2319b11e77552992186422a11a1beb0906eb Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 3 Oct 2018 15:22:53 -0700 Subject: [PATCH 30/48] fix spelling error --- interface/src/octree/SafeLanding.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index f1deb06e3b..6b28d9c713 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -149,7 +149,7 @@ bool SafeLanding::isSequenceNumbersComplete() { && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { _trackingEntities = false; // Don't track anything else that comes in. - returnm true; + return true; } } return false; From d6af09ca62f8e5d07b66e69499f64691882c714b Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 3 Oct 2018 17:40:42 -0700 Subject: [PATCH 31/48] ignoring entities in interstitial/saving address on 404 error --- libraries/networking/src/AddressManager.cpp | 12 +++++++- libraries/networking/src/AddressManager.h | 6 ++++ .../controllerModules/farActionGrabEntity.js | 30 +++++++++++++++++++ scripts/system/interstitialPage.js | 2 +- scripts/system/redirectOverlays.js | 4 +-- 5 files changed, 50 insertions(+), 4 deletions(-) diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index 8085039b02..f8ab8ceaec 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -161,8 +161,14 @@ void AddressManager::storeCurrentAddress() { // be loaded over http(s) // url.scheme() == URL_SCHEME_HTTP || // url.scheme() == URL_SCHEME_HTTPS || + bool isInErrorState = DependencyManager::get()->getDomainHandler().isInErrorState(); if (isConnected()) { - currentAddressHandle.set(url); + if (isInErrorState) { + // save the last address visited before the problem url. + currentAddressHandle.set(lastAddress()); + } else { + currentAddressHandle.set(url); + } } else { qCWarning(networking) << "Ignoring attempt to save current address because not connected to domain:" << url; } @@ -861,6 +867,10 @@ void AddressManager::goToUser(const QString& username, bool shouldMatchOrientati QByteArray(), nullptr, requestParams); } +bool AddressManager::canGoBack() const { + return (_backStack.size() > 0); +} + void AddressManager::refreshPreviousLookup() { // if we have a non-empty previous lookup, fire it again now (but don't re-store it in the history) if (!_previousAPILookup.isEmpty()) { diff --git a/libraries/networking/src/AddressManager.h b/libraries/networking/src/AddressManager.h index 17041a5fd7..5318822cdc 100644 --- a/libraries/networking/src/AddressManager.h +++ b/libraries/networking/src/AddressManager.h @@ -254,6 +254,12 @@ public slots: */ void goToLastAddress() { handleUrl(_lastVisitedURL, LookupTrigger::AttemptedRefresh); } + /**jsdoc + * Returns if going back is possible. + * @function location.canGoBack + */ + bool canGoBack() const; + /**jsdoc * Refresh the current address, e.g., after connecting to a domain in order to position the user to the desired location. * @function location.refreshPreviousLookup diff --git a/scripts/system/controllers/controllerModules/farActionGrabEntity.js b/scripts/system/controllers/controllerModules/farActionGrabEntity.js index 5e798ed680..2e73526728 100644 --- a/scripts/system/controllers/controllerModules/farActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farActionGrabEntity.js @@ -110,6 +110,8 @@ Script.include("/~/system/libraries/Xform.js"); this.reticleMinY = MARGIN; this.reticleMaxY; + this.ignoredEntities = []; + var ACTION_TTL = 15; // seconds var DISTANCE_HOLDING_RADIUS_FACTOR = 3.5; // multiplied by distance between hand and object @@ -314,6 +316,17 @@ Script.include("/~/system/libraries/Xform.js"); return point2d; }; + this.restoreIgnoredEntities = function() { + for (var i = 0; i < this.ignoredEntities; i++) { + var data = { + action: 'remove', + id: this.ignoredEntities[i] + }; + Messages.sendMessage('Hifi-Hand-RayPick-Blacklist', JSON.stringify(data)); + } + this.ignoredEntities = []; + }; + this.notPointingAtEntity = function(controllerData) { var intersection = controllerData.rayPicks[this.hand]; var entityProperty = Entities.getEntityProperties(intersection.objectID); @@ -323,6 +336,15 @@ Script.include("/~/system/libraries/Xform.js"); if ((intersection.type === Picks.INTERSECTED_ENTITY && entityType === "Web") || intersection.type === Picks.INTERSECTED_OVERLAY || Window.isPointOnDesktopWindow(point2d)) { return true; + } else if (intersection.type === Picks.INTERSECTED_ENTITY && !Window.isPhysicsEnabled()) { + // add to ignored items. + var data = { + action: 'add', + id: intersection.objectID + }; + Messages.sendMessage('Hifi-Hand-RayPick-Blacklist', JSON.stringify(data)); + this.ignoredEntities.push(intersection.objectID); + } return false; }; @@ -383,6 +405,7 @@ Script.include("/~/system/libraries/Xform.js"); this.isReady = function (controllerData) { if (HMD.active) { if (this.notPointingAtEntity(controllerData)) { + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } @@ -394,9 +417,11 @@ Script.include("/~/system/libraries/Xform.js"); return makeRunningValues(true, [], []); } else { this.destroyContextOverlay(); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); }; @@ -407,6 +432,7 @@ Script.include("/~/system/libraries/Xform.js"); Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity", this.highlightedEntity); this.highlightedEntity = null; + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } this.intersectionDistance = controllerData.rayPicks[this.hand].distance; @@ -437,6 +463,7 @@ Script.include("/~/system/libraries/Xform.js"); if (nearGrabReadiness[k].active && (nearGrabReadiness[k].targets[0] === this.grabbedThingID || HMD.tabletID && nearGrabReadiness[k].targets[0] === HMD.tabletID)) { this.endFarGrabAction(); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } @@ -448,6 +475,7 @@ Script.include("/~/system/libraries/Xform.js"); for (var j = 0; j < nearGrabReadiness.length; j++) { if (nearGrabReadiness[j].active) { this.endFarGrabAction(); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } @@ -466,6 +494,7 @@ Script.include("/~/system/libraries/Xform.js"); ]); if (targetProps.href !== "") { AddressManager.handleLookupString(targetProps.href); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } @@ -583,6 +612,7 @@ Script.include("/~/system/libraries/Xform.js"); Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity", this.highlightedEntity); this.highlightedEntity = null; + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index bd542b298d..39b4821192 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -475,7 +475,7 @@ if (textureMemSizeStabilityCount >= 15) { if (textureResourceGPUMemSize > 0) { - print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); + // print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); var gpuPercantage = (TOTAL_LOADING_PROGRESS * 0.6) * (texturePopulatedGPUMemSize / textureResourceGPUMemSize); var totalProgress = progress + gpuPercantage; if (totalProgress >= target) { diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 49844db5b0..7f4193e4e9 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -195,7 +195,7 @@ } if (tryAgainImageHover === overlayID) { location.goToLastAddress(); - } else if (backImageHover === overlayID) { + } else if (backImageHover === overlayID && location.canGoBack()) { location.goBack(); } } @@ -216,7 +216,7 @@ Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); Overlays.hoverEnterOverlay.connect(function(overlayID, event) { - if (overlayID === backImageNeutral) { + if (overlayID === backImageNeutral && location.canGoBack()) { Overlays.editOverlay(backImageNeutral, {visible: false}); Overlays.editOverlay(backImageHover, {visible: true}); } From 22a9030fb50b1cb5367ebe7390cc3e3795212866 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 3 Oct 2018 17:54:46 -0700 Subject: [PATCH 32/48] hiding text overlays when out of error state --- scripts/system/redirectOverlays.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 7f4193e4e9..eeccb25334 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -141,6 +141,8 @@ Overlays.editOverlay(tryAgainImageHover, properties); Overlays.editOverlay(backImageNeutral, properties); Overlays.editOverlay(backImageHover, properties); + Overlays.editOverlay(tryAgainText, properties); + Overlays.editOverlay(backText, properties); return; } var oopsText = getOopsText(); From c785efec844f80e9dee9e88739643b6f5c5d9d7b Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 4 Oct 2018 10:56:04 -0700 Subject: [PATCH 33/48] removing extraneous bool --- interface/src/octree/SafeLanding.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 6b28d9c713..62fbe12acb 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -187,8 +187,6 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; - bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); - if (enableInterstitial) { isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); } From 2e3566bc73d80df75b40b0c5adbb33dd77e494da Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 4 Oct 2018 14:24:43 -0700 Subject: [PATCH 34/48] hide overlays after clicking on them --- scripts/system/redirectOverlays.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index eeccb25334..2669cb0120 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -196,8 +196,22 @@ return; } if (tryAgainImageHover === overlayID) { + // hide try again overlays. + var properties = { + visible: false + }; + Overlays.editOverlay(tryAgainImageNeutral, properties); + Overlays.editOverlay(tryAgainImageHover, properties); + Overlays.editOverlay(tryAgainText, properties); location.goToLastAddress(); } else if (backImageHover === overlayID && location.canGoBack()) { + // hide back overlays. + var properties = { + visible: false + }; + Overlays.editOverlay(backImageNeutral, properties); + Overlays.editOverlay(backImageHover, properties); + Overlays.editOverlay(backText, properties); location.goBack(); } } From bda9735b5dc077eec1ab246d8e0b8646b42b88ae Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Oct 2018 15:01:16 -0700 Subject: [PATCH 35/48] fix loading progress --- interface/src/Application.cpp | 5 ++++- interface/src/Application.h | 2 +- interface/src/octree/SafeLanding.cpp | 14 +++++++------- .../entities-renderer/src/EntityTreeRenderer.cpp | 2 +- .../src/RenderableParticleEffectEntityItem.cpp | 10 ++++++++++ .../entities/src/ParticleEffectEntityItem.cpp | 3 ++- libraries/networking/src/DomainHandler.h | 2 +- scripts/defaultScripts.js | 4 ++-- scripts/system/interstitialPage.js | 2 +- 9 files changed, 29 insertions(+), 15 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 757007267f..358b0c94ba 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6575,6 +6575,7 @@ bool Application::gpuTextureMemSizeStable() { qint64 textureResourceGPUMemSize = renderStats->textureResourceGPUMemSize; qint64 texturePopulatedGPUMemSize = renderStats->textureResourcePopulatedGPUMemSize; + qint64 textureTransferSize = renderStats->texturePendingGPUTransferSize; if (_gpuTextureMemSizeAtLastCheck == textureResourceGPUMemSize) { _gpuTextureMemSizeStabilityCount++; @@ -6584,8 +6585,10 @@ bool Application::gpuTextureMemSizeStable() { _gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize; if (_gpuTextureMemSizeStabilityCount >= _minimumGPUTextureMemSizeStabilityCount) { - return (textureResourceGPUMemSize == texturePopulatedGPUMemSize); + qDebug() << "GPU checking"; + return (textureResourceGPUMemSize == texturePopulatedGPUMemSize) && (textureTransferSize == 0); } + qDebug() << "GPU not ready"; return false; } diff --git a/interface/src/Application.h b/interface/src/Application.h index cb37e655fc..01c0f3770c 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -587,7 +587,7 @@ private: QElapsedTimer _lastTimeUpdated; QElapsedTimer _lastTimeRendered; - int _minimumGPUTextureMemSizeStabilityCount { 15 }; + int _minimumGPUTextureMemSizeStabilityCount { 20 }; ShapeManager _shapeManager; PhysicalEntitySimulationPointer _entitySimulation; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 6b28d9c713..a4dc086ad8 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -83,8 +83,6 @@ void SafeLanding::addTrackedEntity(const EntityItemID& entityID) { } qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName(); } - } else { - qCDebug(interfaceapp) << "Safe Landing: Null Entity: " << entityID; } } @@ -109,12 +107,13 @@ void SafeLanding::noteReceivedsequenceNumber(int sequenceNumber) { } bool SafeLanding::isLoadSequenceComplete() { + qDebug() << "is sequence complete" << isSequenceNumbersComplete(); if (isEntityLoadingComplete() && isSequenceNumbersComplete()) { Locker lock(_lock); - _trackedEntities.clear(); _initialStart = INVALID_SEQUENCE; _initialEnd = INVALID_SEQUENCE; _entityTree = nullptr; + _trackingEntities = false; // Don't track anything else that comes in. EntityTreeRenderer::setEntityLoadingPriorityFunction(StandardPriority); } @@ -148,7 +147,6 @@ bool SafeLanding::isSequenceNumbersComplete() { (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { - _trackingEntities = false; // Don't track anything else that comes in. return true; } } @@ -187,10 +185,12 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; - bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); - if (enableInterstitial) { - isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); + auto entityRenderable = entityTree->renderableForEntityId(entityMapIter->first); + if (!entityRenderable) { + entityTree->addingEntity(entityMapIter->first); + } + isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); } if (isEntityPhysicsReady(entity) && isVisuallyReady) { diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index dbbf8af4b9..6e82d26f29 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -310,10 +310,10 @@ void EntityTreeRenderer::addPendingEntities(const render::ScenePointer& scene, r } auto entityID = entity->getEntityItemID(); - processedIds.insert(entityID); auto renderable = EntityRenderer::addToScene(*this, entity, scene, transaction); if (renderable) { _entitiesInScene.insert({ entityID, renderable }); + processedIds.insert(entityID); } } diff --git a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp index 1a263fba79..f51a3f7740 100644 --- a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp @@ -104,6 +104,10 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi _networkTexture.reset(); }); } + + withWriteLock([&] { + entity->setVisuallyReady(true); + }); } else { bool textureNeedsUpdate = resultWithReadLock([&]{ return !_networkTexture || _networkTexture->getURL() != QUrl(_particleProperties.textures); @@ -113,6 +117,12 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi _networkTexture = DependencyManager::get()->getTexture(_particleProperties.textures); }); } + + if (_networkTexture) { + withWriteLock([&] { + entity->setVisuallyReady(_networkTexture->isFailed() || _networkTexture->isLoaded()); + }); + } } void* key = (void*)this; diff --git a/libraries/entities/src/ParticleEffectEntityItem.cpp b/libraries/entities/src/ParticleEffectEntityItem.cpp index 238f41b05f..a0c12d8ee0 100644 --- a/libraries/entities/src/ParticleEffectEntityItem.cpp +++ b/libraries/entities/src/ParticleEffectEntityItem.cpp @@ -166,6 +166,7 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte { _type = EntityTypes::ParticleEffect; setColor(DEFAULT_COLOR); + _visuallyReady = false; } void ParticleEffectEntityItem::setAlpha(float alpha) { @@ -777,4 +778,4 @@ particle::Properties ParticleEffectEntityItem::getParticleProperties() const { } return result; -} \ No newline at end of file +} diff --git a/libraries/networking/src/DomainHandler.h b/libraries/networking/src/DomainHandler.h index 1ff88b425d..ddd23339df 100644 --- a/libraries/networking/src/DomainHandler.h +++ b/libraries/networking/src/DomainHandler.h @@ -231,7 +231,7 @@ private: QString _pendingPath; QTimer _settingsTimer; mutable ReadWriteLockable _interstitialModeSettingLock; - Setting::Handle _enableInterstitialMode{ "enableInterstitialMode", false }; + Setting::Handle _enableInterstitialMode{ "enableInterstitialMode", true }; QSet _domainConnectionRefusals; bool _hasCheckedForAccessToken { false }; diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 42341a8484..b8dcd22923 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -39,8 +39,8 @@ var DEFAULT_SCRIPTS_SEPARATE = [ ]; if (Window.interstitialModeEnabled) { - DEFAULT_SCRIPTS_SEPARATE.push("system/interstitialPage.js"); - DEFAULT_SCRIPTS_SEPARATE.push("system/redirectOverlays.js"); + DEFAULT_SCRIPTS_COMBINED.push("system/interstitialPage.js"); + DEFAULT_SCRIPTS_COMBINED.push("system/redirectOverlays.js"); } // add a menu item for debugging diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index bd542b298d..00db9b1909 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -472,7 +472,7 @@ textureMemSizeAtLastCheck = textureResourceGPUMemSize; - if (textureMemSizeStabilityCount >= 15) { + if (textureMemSizeStabilityCount >= 20) { if (textureResourceGPUMemSize > 0) { print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); From 2a3b4a85c7cffbf39883d7bfce39d2a763d60628 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Oct 2018 15:57:05 -0700 Subject: [PATCH 36/48] debugging --- interface/src/octree/SafeLanding.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index a4dc086ad8..3077762a08 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -186,10 +186,13 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; if (enableInterstitial) { + bool hasRenderable = true; auto entityRenderable = entityTree->renderableForEntityId(entityMapIter->first); if (!entityRenderable) { + hasRenderable = false; entityTree->addingEntity(entityMapIter->first); } + qDebug() << EntityTypes::getEntityTypeName(entity->getType()) << entity->isVisuallyReady() << hasRenderable << entity->isParentPathComplete(); isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); } @@ -204,6 +207,10 @@ bool SafeLanding::isEntityLoadingComplete() { } } + if (!_trackedEntities.empty()) { + qDebug() << "\n"; + } + if (enableInterstitial) { _trackedEntityStabilityCount++; } From c423305bd1639f697f6737e3499b873a05de2a34 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 4 Oct 2018 16:30:48 -0700 Subject: [PATCH 37/48] check overlay visibility before showing back up again --- scripts/system/redirectOverlays.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 2669cb0120..d7b58eb668 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -243,11 +243,11 @@ }); Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { - if (overlayID === backImageHover) { + if (overlayID === backImageHover && Overlays.getProperty(backImageHover, "visible")) { Overlays.editOverlay(backImageHover, {visible: false}); Overlays.editOverlay(backImageNeutral, {visible: true}); } - if (overlayID === tryAgainImageHover) { + if (overlayID === tryAgainImageHover && Overlays.getProperty(tryAgainImageHover, "visible")) { Overlays.editOverlay(tryAgainImageHover, {visible: false}); Overlays.editOverlay(tryAgainImageNeutral, {visible: true}); } From a2237aa48a3e4793d4a3825648566f874ea35e92 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 4 Oct 2018 16:41:14 -0700 Subject: [PATCH 38/48] reverting click overlay behavior --- scripts/system/redirectOverlays.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index d7b58eb668..8f42990b7d 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -196,22 +196,8 @@ return; } if (tryAgainImageHover === overlayID) { - // hide try again overlays. - var properties = { - visible: false - }; - Overlays.editOverlay(tryAgainImageNeutral, properties); - Overlays.editOverlay(tryAgainImageHover, properties); - Overlays.editOverlay(tryAgainText, properties); location.goToLastAddress(); } else if (backImageHover === overlayID && location.canGoBack()) { - // hide back overlays. - var properties = { - visible: false - }; - Overlays.editOverlay(backImageNeutral, properties); - Overlays.editOverlay(backImageHover, properties); - Overlays.editOverlay(backText, properties); location.goBack(); } } From 5d011bafb26b3e034e0f4228b1231136c9187264 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Oct 2018 17:02:44 -0700 Subject: [PATCH 39/48] small tweaks --- interface/src/Application.h | 2 +- interface/src/octree/SafeLanding.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.h b/interface/src/Application.h index 1ceae9cd02..750d9ce987 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -583,7 +583,7 @@ private: QElapsedTimer _lastTimeUpdated; QElapsedTimer _lastTimeRendered; - int _minimumGPUTextureMemSizeStabilityCount { 20 }; + int _minimumGPUTextureMemSizeStabilityCount { 30 }; ShapeManager _shapeManager; PhysicalEntitySimulationPointer _entitySimulation; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 3077762a08..d5eb4c23c2 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -147,6 +147,10 @@ bool SafeLanding::isSequenceNumbersComplete() { (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { + bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); + if (!enableInterstitial) { + _trackingEntities = false; // Don't track anything else that comes in. + } return true; } } @@ -193,7 +197,7 @@ bool SafeLanding::isEntityLoadingComplete() { entityTree->addingEntity(entityMapIter->first); } qDebug() << EntityTypes::getEntityTypeName(entity->getType()) << entity->isVisuallyReady() << hasRenderable << entity->isParentPathComplete(); - isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); + isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); } if (isEntityPhysicsReady(entity) && isVisuallyReady) { From d2850801976a8a585a67c4dfab5b033ece31b869 Mon Sep 17 00:00:00 2001 From: danteruiz Date: Thu, 4 Oct 2018 18:38:25 -0700 Subject: [PATCH 40/48] remmoving some debug statements --- interface/src/Application.cpp | 2 -- interface/src/octree/SafeLanding.cpp | 7 +------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4688160a34..1e158c30be 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6607,10 +6607,8 @@ bool Application::gpuTextureMemSizeStable() { _gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize; if (_gpuTextureMemSizeStabilityCount >= _minimumGPUTextureMemSizeStabilityCount) { - qDebug() << "GPU checking"; return (textureResourceGPUMemSize == texturePopulatedGPUMemSize) && (textureTransferSize == 0); } - qDebug() << "GPU not ready"; return false; } diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index d5eb4c23c2..ed0ce3c278 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -107,7 +107,6 @@ void SafeLanding::noteReceivedsequenceNumber(int sequenceNumber) { } bool SafeLanding::isLoadSequenceComplete() { - qDebug() << "is sequence complete" << isSequenceNumbersComplete(); if (isEntityLoadingComplete() && isSequenceNumbersComplete()) { Locker lock(_lock); _initialStart = INVALID_SEQUENCE; @@ -196,7 +195,7 @@ bool SafeLanding::isEntityLoadingComplete() { hasRenderable = false; entityTree->addingEntity(entityMapIter->first); } - qDebug() << EntityTypes::getEntityTypeName(entity->getType()) << entity->isVisuallyReady() << hasRenderable << entity->isParentPathComplete(); + isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); } @@ -211,10 +210,6 @@ bool SafeLanding::isEntityLoadingComplete() { } } - if (!_trackedEntities.empty()) { - qDebug() << "\n"; - } - if (enableInterstitial) { _trackedEntityStabilityCount++; } From 8abbd51bb1734fea69ce6cfa9bbfa7da45435a62 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 4 Oct 2018 23:11:27 -0700 Subject: [PATCH 41/48] removing unused variable --- interface/src/octree/SafeLanding.cpp | 2 -- scripts/system/redirectOverlays.js | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index ed0ce3c278..94dfe77ba7 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -189,10 +189,8 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; if (enableInterstitial) { - bool hasRenderable = true; auto entityRenderable = entityTree->renderableForEntityId(entityMapIter->first); if (!entityRenderable) { - hasRenderable = false; entityTree->addingEntity(entityMapIter->first); } diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 8f42990b7d..b1180e0cd0 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -14,6 +14,7 @@ var hardRefusalErrors = [PROTOCOL_VERSION_MISMATCH, NOT_AUTHORIZED, TIMEOUT]; var timer = null; + var isErrorState = false; function getOopsText() { var error = Window.getLastDomainConnectionError(); @@ -131,6 +132,7 @@ }); function toggleOverlays(isInErrorState) { + isErrorState = isInErrorState; if (!isInErrorState) { var properties = { visible: false @@ -148,6 +150,8 @@ var oopsText = getOopsText(); // if oopsText === "", it was a success. var overlaysVisible = (oopsText !== ""); + // for catching init or if error state were to be different. + isErrorState = overlaysVisible; var properties = { visible: overlaysVisible }; @@ -218,6 +222,10 @@ Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); Overlays.hoverEnterOverlay.connect(function(overlayID, event) { + if (!isErrorState) { + // don't allow hover overlay events to get caught if it's not in error state anymore. + return; + } if (overlayID === backImageNeutral && location.canGoBack()) { Overlays.editOverlay(backImageNeutral, {visible: false}); Overlays.editOverlay(backImageHover, {visible: true}); @@ -229,11 +237,15 @@ }); Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { - if (overlayID === backImageHover && Overlays.getProperty(backImageHover, "visible")) { + if (!isErrorState) { + // don't allow hover overlay events to get caught if it's not in error state anymore. + return; + } + if (overlayID === backImageHover) { Overlays.editOverlay(backImageHover, {visible: false}); Overlays.editOverlay(backImageNeutral, {visible: true}); } - if (overlayID === tryAgainImageHover && Overlays.getProperty(tryAgainImageHover, "visible")) { + if (overlayID === tryAgainImageHover) { Overlays.editOverlay(tryAgainImageHover, {visible: false}); Overlays.editOverlay(tryAgainImageNeutral, {visible: true}); } From 88f76ac7601c3a5536e6638903ce0573af583435 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 4 Oct 2018 14:57:08 -0700 Subject: [PATCH 42/48] suppress traits larger than INT16_MAX bytes --- .../src/avatars/AvatarMixerClientData.cpp | 44 ++++++++++++++----- .../src/avatars/AvatarMixerSlave.cpp | 3 ++ libraries/avatars/src/AvatarData.cpp | 41 +++++++++++------ libraries/avatars/src/AvatarTraits.h | 1 + libraries/networking/src/NodeList.cpp | 1 - 5 files changed, 64 insertions(+), 26 deletions(-) diff --git a/assignment-client/src/avatars/AvatarMixerClientData.cpp b/assignment-client/src/avatars/AvatarMixerClientData.cpp index 187c9ed0f2..09bdfbc564 100644 --- a/assignment-client/src/avatars/AvatarMixerClientData.cpp +++ b/assignment-client/src/avatars/AvatarMixerClientData.cpp @@ -112,6 +112,11 @@ void AvatarMixerClientData::processSetTraitsMessage(ReceivedMessage& message, AvatarTraits::TraitWireSize traitSize; message.readPrimitive(&traitSize); + if (traitSize < -1 || traitSize > message.getBytesLeftToRead()) { + qWarning() << "Refusing to process simple trait of size" << traitSize << "from" << message.getSenderSockAddr(); + break; + } + if (packetTraitVersion > _lastReceivedTraitVersions[traitType]) { _avatar->processTrait(traitType, message.read(traitSize)); _lastReceivedTraitVersions[traitType] = packetTraitVersion; @@ -128,26 +133,41 @@ void AvatarMixerClientData::processSetTraitsMessage(ReceivedMessage& message, } else { AvatarTraits::TraitInstanceID instanceID = QUuid::fromRfc4122(message.readWithoutCopy(NUM_BYTES_RFC4122_UUID)); + if (message.getBytesLeftToRead() == 0) { + qWarning () << "Received an instanced trait with no size from" << message.getSenderSockAddr(); + break; + } + AvatarTraits::TraitWireSize traitSize; message.readPrimitive(&traitSize); - auto& instanceVersionRef = _lastReceivedTraitVersions.getInstanceValueRef(traitType, instanceID); + if (traitSize < -1 || traitSize > message.getBytesLeftToRead()) { + qWarning() << "Refusing to process instanced trait of size" << traitSize << "from" << message.getSenderSockAddr(); + break; + } - if (packetTraitVersion > instanceVersionRef) { - if (traitSize == AvatarTraits::DELETED_TRAIT_SIZE) { - _avatar->processDeletedTraitInstance(traitType, instanceID); + if (traitType == AvatarTraits::AvatarEntity) { + auto& instanceVersionRef = _lastReceivedTraitVersions.getInstanceValueRef(traitType, instanceID); - // to track a deleted instance but keep version information - // the avatar mixer uses the negative value of the sent version - instanceVersionRef = -packetTraitVersion; + if (packetTraitVersion > instanceVersionRef) { + if (traitSize == AvatarTraits::DELETED_TRAIT_SIZE) { + _avatar->processDeletedTraitInstance(traitType, instanceID); + + // to track a deleted instance but keep version information + // the avatar mixer uses the negative value of the sent version + instanceVersionRef = -packetTraitVersion; + } else { + _avatar->processTraitInstance(traitType, instanceID, message.read(traitSize)); + instanceVersionRef = packetTraitVersion; + } + + anyTraitsChanged = true; } else { - _avatar->processTraitInstance(traitType, instanceID, message.read(traitSize)); - instanceVersionRef = packetTraitVersion; + message.seek(message.getPosition() + traitSize); } - - anyTraitsChanged = true; } else { - message.seek(message.getPosition() + traitSize); + qWarning() << "Refusing to process traits packet with instanced trait of unprocessable type from" << message.getSenderSockAddr(); + break; } } } diff --git a/assignment-client/src/avatars/AvatarMixerSlave.cpp b/assignment-client/src/avatars/AvatarMixerSlave.cpp index 9c88580b99..b6ec006c39 100644 --- a/assignment-client/src/avatars/AvatarMixerSlave.cpp +++ b/assignment-client/src/avatars/AvatarMixerSlave.cpp @@ -152,6 +152,7 @@ qint64 AvatarMixerSlave::addChangedTraitsToBulkPacket(AvatarMixerClientData* lis }); if (!isDeleted && (sentInstanceIt == sentIDValuePairs.end() || receivedVersion > sentInstanceIt->value)) { + // this instance version exists and has never been sent or is newer so we need to send it bytesWritten += sendingAvatar->packTraitInstance(traitType, instanceID, traitsPacketList, receivedVersion); @@ -161,6 +162,7 @@ qint64 AvatarMixerSlave::addChangedTraitsToBulkPacket(AvatarMixerClientData* lis sentIDValuePairs.emplace_back(instanceID, receivedVersion); } } else if (isDeleted && sentInstanceIt != sentIDValuePairs.end() && absoluteReceivedVersion > sentInstanceIt->value) { + // this instance version was deleted and we haven't sent the delete to this client yet bytesWritten += AvatarTraits::packInstancedTraitDelete(traitType, instanceID, traitsPacketList, absoluteReceivedVersion); @@ -180,6 +182,7 @@ qint64 AvatarMixerSlave::addChangedTraitsToBulkPacket(AvatarMixerClientData* lis listeningNodeData->setLastOtherAvatarTraitsSendPoint(otherNodeLocalID, timeOfLastTraitsChange); } + return bytesWritten; } diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 2168dff1f6..62eaee0f46 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -1802,15 +1802,24 @@ QUrl AvatarData::getWireSafeSkeletonModelURL() const { qint64 AvatarData::packTrait(AvatarTraits::TraitType traitType, ExtendedIODevice& destination, AvatarTraits::TraitVersion traitVersion) { - qint64 bytesWritten = 0; - bytesWritten += destination.writePrimitive(traitType); - if (traitVersion > AvatarTraits::DEFAULT_TRAIT_VERSION) { - bytesWritten += destination.writePrimitive(traitVersion); - } + qint64 bytesWritten = 0; if (traitType == AvatarTraits::SkeletonModelURL) { + QByteArray encodedSkeletonURL = getWireSafeSkeletonModelURL().toEncoded(); + + if (encodedSkeletonURL.size() > AvatarTraits::MAXIMUM_TRAIT_SIZE) { + qWarning() << "Refusing to pack simple trait" << traitType << "of size" << encodedSkeletonURL.size() + << "bytes since it exceeds the maximum size" << AvatarTraits::MAXIMUM_TRAIT_SIZE << "bytes"; + return 0; + } + + bytesWritten += destination.writePrimitive(traitType); + + if (traitVersion > AvatarTraits::DEFAULT_TRAIT_VERSION) { + bytesWritten += destination.writePrimitive(traitVersion); + } AvatarTraits::TraitWireSize encodedURLSize = encodedSkeletonURL.size(); bytesWritten += destination.writePrimitive(encodedURLSize); @@ -1825,14 +1834,6 @@ qint64 AvatarData::packTraitInstance(AvatarTraits::TraitType traitType, AvatarTr ExtendedIODevice& destination, AvatarTraits::TraitVersion traitVersion) { qint64 bytesWritten = 0; - bytesWritten += destination.writePrimitive(traitType); - - if (traitVersion > AvatarTraits::DEFAULT_TRAIT_VERSION) { - bytesWritten += destination.writePrimitive(traitVersion); - } - - bytesWritten += destination.write(traitInstanceID.toRfc4122()); - if (traitType == AvatarTraits::AvatarEntity) { // grab a read lock on the avatar entities and check for entity data for the given ID QByteArray entityBinaryData; @@ -1843,6 +1844,20 @@ qint64 AvatarData::packTraitInstance(AvatarTraits::TraitType traitType, AvatarTr } }); + if (entityBinaryData.size() > AvatarTraits::MAXIMUM_TRAIT_SIZE) { + qWarning() << "Refusing to pack instanced trait" << traitType << "of size" << entityBinaryData.size() + << "bytes since it exceeds the maximum size " << AvatarTraits::MAXIMUM_TRAIT_SIZE << "bytes"; + return 0; + } + + bytesWritten += destination.writePrimitive(traitType); + + if (traitVersion > AvatarTraits::DEFAULT_TRAIT_VERSION) { + bytesWritten += destination.writePrimitive(traitVersion); + } + + bytesWritten += destination.write(traitInstanceID.toRfc4122()); + if (!entityBinaryData.isNull()) { AvatarTraits::TraitWireSize entityBinarySize = entityBinaryData.size(); diff --git a/libraries/avatars/src/AvatarTraits.h b/libraries/avatars/src/AvatarTraits.h index f0c807a432..5e28515d12 100644 --- a/libraries/avatars/src/AvatarTraits.h +++ b/libraries/avatars/src/AvatarTraits.h @@ -39,6 +39,7 @@ namespace AvatarTraits { using TraitWireSize = int16_t; const TraitWireSize DELETED_TRAIT_SIZE = -1; + const TraitWireSize MAXIMUM_TRAIT_SIZE = INT16_MAX; inline qint64 packInstancedTraitDelete(TraitType traitType, TraitInstanceID instanceID, ExtendedIODevice& destination, TraitVersion traitVersion = NULL_TRAIT_VERSION) { diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index e458ffab7e..917a4ca791 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -332,7 +332,6 @@ void NodeList::sendDomainServerCheckIn() { qCDebug(networking) << "Local domain-server port read from shared memory (or default) is" << domainPort; _domainHandler.setPort(domainPort); } - } // check if we're missing a keypair we need to verify ourselves with the domain-server From c3478dc018a34e5e392d96b8819ce2955633348e Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 5 Oct 2018 13:48:35 -0700 Subject: [PATCH 43/48] remove expired avatarEntities from their avatars --- interface/src/Application.cpp | 4 ++++ interface/src/avatar/AvatarManager.cpp | 11 +++++++++++ interface/src/avatar/AvatarManager.h | 2 ++ interface/src/avatar/MyAvatar.cpp | 2 +- libraries/entities/src/EntitySimulation.h | 2 +- libraries/physics/src/PhysicalEntitySimulation.cpp | 8 ++++++++ libraries/physics/src/PhysicalEntitySimulation.h | 2 ++ 7 files changed, 29 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4b45541e1a..c708676b17 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5921,6 +5921,10 @@ void Application::update(float deltaTime) { // update the rendering without any simulation getEntities()->update(false); } + // remove recently dead avatarEntities + SetOfEntities deadAvatarEntities; + _entitySimulation->takeDeadAvatarEntities(deadAvatarEntities); + avatarManager->removeDeadAvatarEntities(deadAvatarEntities); } // AvatarManager update diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index c268561a8d..d31b201dc7 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -452,6 +452,17 @@ void AvatarManager::handleProcessedPhysicsTransaction(PhysicsEngine::Transaction transaction.clear(); } +void AvatarManager::removeDeadAvatarEntities(const SetOfEntities& deadEntities) { + for (auto entity : deadEntities) { + QUuid sessionID = entity->getOwningAvatarID(); + AvatarSharedPointer avatar = getAvatarBySessionID(sessionID); + if (avatar) { + const bool REQUIRES_REMOVAL_FROM_TREE = false; + avatar->clearAvatarEntity(entity->getID(), REQUIRES_REMOVAL_FROM_TREE); + } + } +} + void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar, KillAvatarReason removalReason) { auto avatar = std::static_pointer_cast(removedAvatar); { diff --git a/interface/src/avatar/AvatarManager.h b/interface/src/avatar/AvatarManager.h index 3ed156f673..209b976c44 100644 --- a/interface/src/avatar/AvatarManager.h +++ b/interface/src/avatar/AvatarManager.h @@ -26,6 +26,7 @@ #include #include #include +#include // for SetOfEntities #include "AvatarMotionState.h" #include "MyAvatar.h" @@ -187,6 +188,7 @@ public: void queuePhysicsChange(const OtherAvatarPointer& avatar); void buildPhysicsTransaction(PhysicsEngine::Transaction& transaction); void handleProcessedPhysicsTransaction(PhysicsEngine::Transaction& transaction); + void removeDeadAvatarEntities(const SetOfEntities& deadEntities); public slots: /**jsdoc diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 086cbb3425..b347963cf1 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -137,7 +137,7 @@ MyAvatar::MyAvatar(QThread* thread) : _useSnapTurnSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "useSnapTurn", _useSnapTurn), _userHeightSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "userHeight", DEFAULT_AVATAR_HEIGHT), _flyingHMDSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "flyingHMD", _flyingPrefHMD), - _avatarEntityCountSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "avatarEntityData" << "size", _flyingPrefHMD) + _avatarEntityCountSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "avatarEntityData" << "size", 0) { _clientTraitsHandler = std::unique_ptr(new ClientTraitsHandler(this)); diff --git a/libraries/entities/src/EntitySimulation.h b/libraries/entities/src/EntitySimulation.h index b19e1c33d3..f107bcae6e 100644 --- a/libraries/entities/src/EntitySimulation.h +++ b/libraries/entities/src/EntitySimulation.h @@ -104,7 +104,7 @@ protected: QMutex _dynamicsMutex { QMutex::Recursive }; protected: - SetOfEntities _deadEntities; + SetOfEntities _deadEntities; // dead entities that might still be in the _entityTree private: void moveSimpleKinematics(); diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index 2004f8953d..ab8bfb8290 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -79,6 +79,9 @@ void PhysicalEntitySimulation::removeEntityInternal(EntityItemPointer entity) { _deadEntities.insert(entity); } } + if (entity->getClientOnly()) { + _deadAvatarEntities.insert(entity); + } } void PhysicalEntitySimulation::removeOwnershipData(EntityMotionState* motionState) { @@ -123,6 +126,11 @@ void PhysicalEntitySimulation::takeDeadEntities(SetOfEntities& deadEntities) { _deadEntities.clear(); } +void PhysicalEntitySimulation::takeDeadAvatarEntities(SetOfEntities& deadEntities) { + _deadAvatarEntities.swap(deadEntities); + _deadAvatarEntities.clear(); +} + void PhysicalEntitySimulation::changeEntityInternal(EntityItemPointer entity) { // queue incoming changes: from external sources (script, EntityServer, etc) to physics engine QMutexLocker lock(&_mutex); diff --git a/libraries/physics/src/PhysicalEntitySimulation.h b/libraries/physics/src/PhysicalEntitySimulation.h index fdf996df25..843069e247 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.h +++ b/libraries/physics/src/PhysicalEntitySimulation.h @@ -60,6 +60,7 @@ public: virtual void applyDynamicChanges() override; virtual void takeDeadEntities(SetOfEntities& deadEntities) override; + void takeDeadAvatarEntities(SetOfEntities& deadEntities); signals: void entityCollisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision); @@ -112,6 +113,7 @@ private: VectorOfEntityMotionStates _owned; VectorOfEntityMotionStates _bids; + SetOfEntities _deadAvatarEntities; workload::SpacePointer _space; uint64_t _nextBidExpiry; uint32_t _lastStepSendPackets { 0 }; From 82170a66edb67c552eb42d0bdeae8448cf78783f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 5 Oct 2018 14:43:57 -0700 Subject: [PATCH 44/48] avoid backwards seek for skipped trait deletes --- libraries/avatars/src/AvatarHashMap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/avatars/src/AvatarHashMap.cpp b/libraries/avatars/src/AvatarHashMap.cpp index c8ea68dae4..2f3b12e0ed 100644 --- a/libraries/avatars/src/AvatarHashMap.cpp +++ b/libraries/avatars/src/AvatarHashMap.cpp @@ -337,7 +337,7 @@ void AvatarHashMap::processBulkAvatarTraits(QSharedPointer mess // grab the last trait versions for this avatar auto& lastProcessedVersions = _processedTraitVersions[avatarID]; - while (traitType != AvatarTraits::NullTrait) { + while (traitType != AvatarTraits::NullTrait && message->getBytesLeftToRead() > 0) { AvatarTraits::TraitVersion packetTraitVersion; message->readPrimitive(&packetTraitVersion); @@ -378,7 +378,7 @@ void AvatarHashMap::processBulkAvatarTraits(QSharedPointer mess } } - if (skipBinaryTrait) { + if (skipBinaryTrait && traitBinarySize > 0) { // we didn't read this trait because it was older or because we didn't have an avatar to process it for message->seek(message->getPosition() + traitBinarySize); } From 36c2cceb577a6daeb16024ad967d5e4710484e0f Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 5 Oct 2018 15:39:51 -0700 Subject: [PATCH 45/48] fix for failing to enter domain --- interface/src/Application.cpp | 5 ++++- interface/src/Application.h | 4 ++++ interface/src/octree/SafeLanding.cpp | 4 +++- interface/src/scripting/WindowScriptingInterface.cpp | 4 ---- interface/src/scripting/WindowScriptingInterface.h | 2 -- scripts/system/interstitialPage.js | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 1e158c30be..57ed19c021 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5617,7 +5617,8 @@ void Application::update(float deltaTime) { // for nearby entities before starting bullet up. quint64 now = usecTimestampNow(); if (isServerlessMode() || _octreeProcessor.isLoadSequenceComplete()) { - if (gpuTextureMemSizeStable()) { + 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; _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; @@ -6241,6 +6242,8 @@ int Application::sendNackPackets() { missingSequenceNumbers = sequenceNumberStats.getMissingSet(); }); + _isMissingSequenceNumbers = (missingSequenceNumbers.size() != 0); + // construct nack packet(s) for this node foreach(const OCTREE_PACKET_SEQUENCE& missingNumber, missingSequenceNumbers) { nackPacketList->writePrimitive(missingNumber); diff --git a/interface/src/Application.h b/interface/src/Application.h index 750d9ce987..75260b910f 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -183,6 +183,8 @@ public: // passes, mirror window passes, etc void copyDisplayViewFrustum(ViewFrustum& viewOut) const; + bool isMissingSequenceNumbers() { return _isMissingSequenceNumbers; } + const ConicalViewFrustums& getConicalViews() const override { return _conicalViews; } const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; } @@ -713,6 +715,8 @@ private: bool _fakedMouseEvent { false }; + bool _isMissingSequenceNumbers { false }; + void checkChangeCursor(); mutable QMutex _changeCursorLock { QMutex::Recursive }; Qt::CursorShape _desiredCursor{ Qt::BlankCursor }; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index ed0ce3c278..02a8441fab 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -142,10 +142,12 @@ bool SafeLanding::isSequenceNumbersComplete() { _initialEnd + SEQUENCE_MODULO - _initialStart; auto startIter = _sequenceNumbers.find(_initialStart); auto endIter = _sequenceNumbers.find(_initialEnd - 1); + + bool missingSequenceNumbers = qApp->isMissingSequenceNumbers(); if (sequenceSize == 0 || (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() - && distance(startIter, endIter) == sequenceSize - 1)) { + && ((distance(startIter, endIter) == sequenceSize - 1) || !missingSequenceNumbers))) { bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); if (!enableInterstitial) { _trackingEntities = false; // Don't track anything else that comes in. diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index c09bff7b5e..75f17def20 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -399,10 +399,6 @@ void WindowScriptingInterface::showAssetServer(const QString& upload) { QMetaObject::invokeMethod(qApp, "showAssetServerWidget", Qt::QueuedConnection, Q_ARG(QString, upload)); } -void WindowScriptingInterface::setMinimumGPUTextureMemSizeStabilityCount(int stabilityCount) { - QMetaObject::invokeMethod(qApp, " setMinimumGPUTextureMemStabilityCount", Qt::QueuedConnection, Q_ARG(int, stabilityCount)); -} - QString WindowScriptingInterface::checkVersion() { return QCoreApplication::applicationVersion(); } diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index fe0113b770..f6a5a5ef74 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -571,8 +571,6 @@ public slots: float domainLoadingProgress(); - void setMinimumGPUTextureMemSizeStabilityCount(int stabilityCount); - private slots: void onWindowGeometryChanged(const QRect& geometry); void onMessageBoxSelected(int button); diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 1c2f83bb04..19e603b4ab 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -50,7 +50,7 @@ "Tip: Use the Create app to import models and create custom entities.", "Tip: We're open source! Feel free to contribute to our code on GitHub!", "Tip: What emotes have you used in the Emote app?", - "Tip: Take and share your snapshots with the everyone using the Snap app.", + "Tip: Take and share your snapshots with everyone using the Snap app.", "Tip: Did you know you can show websites in-world by creating a web entity?", "Tip: Find out more information about domains by visiting our website!", "Tip: Did you know you can get cool new apps from the Marketplace?", From 335c60e6b8afd91e7cda6eb1ccca34668286a545 Mon Sep 17 00:00:00 2001 From: Anthony Thibault Date: Fri, 5 Oct 2018 17:29:25 -0700 Subject: [PATCH 46/48] Reduce the glitches of far away animating avatars Currently, the avatars that are further then 10 meters away have a very aggressive 15 degree rotation threshold, used to reduce the amount of rotation joint changes sent over the network. This PR tunes both the distances and rotation thresholds used for this LOD culling. --- libraries/avatars/src/AvatarData.cpp | 8 +++++--- libraries/avatars/src/AvatarData.h | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 5fb4ef3156..5930b79074 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -206,11 +206,13 @@ float AvatarData::getDistanceBasedMinRotationDOT(glm::vec3 viewerPosition) const if (distance < AVATAR_DISTANCE_LEVEL_1) { result = AVATAR_MIN_ROTATION_DOT; } else if (distance < AVATAR_DISTANCE_LEVEL_2) { - result = ROTATION_CHANGE_15D; + result = ROTATION_CHANGE_2D; } else if (distance < AVATAR_DISTANCE_LEVEL_3) { - result = ROTATION_CHANGE_45D; + result = ROTATION_CHANGE_4D; } else if (distance < AVATAR_DISTANCE_LEVEL_4) { - result = ROTATION_CHANGE_90D; + result = ROTATION_CHANGE_6D; + } else if (distance < AVATAR_DISTANCE_LEVEL_5) { + result = ROTATION_CHANGE_15D; } return result; } diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 860772b7c9..46489451f7 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -309,16 +309,19 @@ const float AVATAR_SEND_FULL_UPDATE_RATIO = 0.02f; const float AVATAR_MIN_ROTATION_DOT = 0.9999999f; const float AVATAR_MIN_TRANSLATION = 0.0001f; -const float ROTATION_CHANGE_15D = 0.9914449f; -const float ROTATION_CHANGE_45D = 0.9238795f; -const float ROTATION_CHANGE_90D = 0.7071068f; -const float ROTATION_CHANGE_179D = 0.0087266f; - -const float AVATAR_DISTANCE_LEVEL_1 = 10.0f; -const float AVATAR_DISTANCE_LEVEL_2 = 100.0f; -const float AVATAR_DISTANCE_LEVEL_3 = 1000.0f; -const float AVATAR_DISTANCE_LEVEL_4 = 10000.0f; +// quaternion dot products +const float ROTATION_CHANGE_2D = 0.99984770f; // 2 degrees +const float ROTATION_CHANGE_4D = 0.99939083f; // 4 degrees +const float ROTATION_CHANGE_6D = 0.99862953f; // 6 degrees +const float ROTATION_CHANGE_15D = 0.99144486f; // 15 degrees +const float ROTATION_CHANGE_179D = 0.00872653f; // 179 degrees +// rotation culling distance thresholds +const float AVATAR_DISTANCE_LEVEL_1 = 12.5f; // meters +const float AVATAR_DISTANCE_LEVEL_2 = 16.6f; // meters +const float AVATAR_DISTANCE_LEVEL_3 = 25.0f; // meters +const float AVATAR_DISTANCE_LEVEL_4 = 50.0f; // meters +const float AVATAR_DISTANCE_LEVEL_5 = 200.0f; // meters // Where one's own Avatar begins in the world (will be overwritten if avatar data file is found). // This is the start location in the Sandbox (xyz: 6270, 211, 6000). From 1719f4a4748b7ace4fd07a214c61558ccedce794 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Fri, 5 Oct 2018 23:49:06 -0300 Subject: [PATCH 47/48] Build libplugins_libhifiCodec.so --- android/app/CMakeLists.txt | 2 ++ android/app/build.gradle | 2 ++ android/build.gradle | 28 +++++++++++++++++++------ cmake/macros/TargetHifiAudioCodec.cmake | 22 +++++++++++++++++++ plugins/hifiCodec/CMakeLists.txt | 5 +---- 5 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 cmake/macros/TargetHifiAudioCodec.cmake diff --git a/android/app/CMakeLists.txt b/android/app/CMakeLists.txt index d24a84c6a5..9930a9e152 100644 --- a/android/app/CMakeLists.txt +++ b/android/app/CMakeLists.txt @@ -7,6 +7,8 @@ target_bullet() set(INTERFACE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../interface") add_subdirectory("${INTERFACE_DIR}" "libraries/interface") include_directories("${INTERFACE_DIR}/src") +set(HIFI_CODEC_PLUGIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../plugins/hifiCodec") +add_subdirectory("${HIFI_CODEC_PLUGIN_DIR}" "libraries/hifiCodecPlugin") target_link_libraries(native-lib android log m interface) diff --git a/android/app/build.gradle b/android/app/build.gradle index 24c067b176..13d3a0fc41 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -80,8 +80,10 @@ android { if (Os.isFamily(Os.FAMILY_UNIX)) { def uploadDumpSymsTask = rootProject.getTasksByName("uploadBreakpadDumpSyms${variant.name.capitalize()}", false).first() def runDumpSymsTask = rootProject.getTasksByName("runBreakpadDumpSyms${variant.name.capitalize()}", false).first() + def renameHifiACTask = rootProject.getTasksByName("renameHifiACTask${variant.name.capitalize()}", false).first() runDumpSymsTask.dependsOn(task) variant.assemble.dependsOn(uploadDumpSymsTask) + variant.assemble.dependsOn(renameHifiACTask) } } diff --git a/android/build.gradle b/android/build.gradle index aa7aa399b2..72015aab2e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -143,11 +143,9 @@ def packages = [ includeLibs: ['libtbb.so', 'libtbbmalloc.so'], ], hifiAC: [ - file: 'libplugins_libhifiCodec.zip', - versionId: 'i31pW.qNbvFOXRxbyiJUxg3sphaFNmZU', - checksum: '9412a8e12c88a4096c1fc843bb9fe52d', - sharedLibFolder: '', - includeLibs: ['libplugins_libhifiCodec.so'] + baseUrl: 'http://s3.amazonaws.com/hifi-public/dependencies/', + file: 'codecSDK-android_armv8-2.0.zip', + checksum: '1cbef929675818fc64c4101b72f84a6a' ], etc2comp: [ file: 'etc2comp-patched-armv8-libcpp.tgz', @@ -367,7 +365,8 @@ task downloadDependencies { doLast { packages.each { entry -> def filename = entry.value['file']; - def url = baseUrl + filename; + def dependencyBaseUrl = entry.value['baseUrl'] + def url = (dependencyBaseUrl?.trim() ? dependencyBaseUrl : baseUrl) + filename; if (entry.value.containsKey('versionId')) { url = url + '?versionId=' + entry.value['versionId'] } @@ -668,6 +667,23 @@ task uploadBreakpadDumpSymsRelease(type:io.github.httpbuilderng.http.HttpTask, d } } +task renameHifiACTaskDebug() { + doLast { + def sourceFile = new File("${appDir}/build/intermediates/cmake/debug/obj/arm64-v8a/","libhifiCodec.so") + def destinationFile = new File("${appDir}/src/main/jniLibs/", "libplugins_libhifiCodec.so)") + copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } + } +} +task renameHifiACTaskRelease(type: Copy) { + doLast { + doLast { + def sourceFile = new File("${appDir}/build/intermediates/cmake/release/obj/arm64-v8a/","libhifiCodec.so") + def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") + copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } + } + } +} + // FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. // See the comment on the qtBundle task above /* diff --git a/cmake/macros/TargetHifiAudioCodec.cmake b/cmake/macros/TargetHifiAudioCodec.cmake new file mode 100644 index 0000000000..98c24e684c --- /dev/null +++ b/cmake/macros/TargetHifiAudioCodec.cmake @@ -0,0 +1,22 @@ +# +# Copyright 2018 High Fidelity, Inc. +# Created by Gabriel Calero and Cristian Duarte on 2018/10/05 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_HIFIAUDIOCODEC) + if (ANDROID) + set(HIFIAC_INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/hifiAC/codecSDK) + set(HIFIAC_LIB_DIR "${HIFIAC_INSTALL_DIR}/Release") + set(HIFIAC_INCLUDE_DIRS "${HIFIAC_INSTALL_DIR}/include" CACHE TYPE INTERNAL) + list(APPEND HIFIAC_LIBS "${HIFIAC_LIB_DIR}/libaudio.a") + set(HIFIAC_LIBRARIES ${HIFIAC_LIBS} CACHE TYPE INTERNAL) + else() + add_dependency_external_projects(hifiAudioCodec) + target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAUDIOCODEC_INCLUDE_DIRS}) + target_link_libraries(${TARGET_NAME} ${HIFIAUDIOCODEC_LIBRARIES}) + endif() + target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAC_INCLUDE_DIRS}) + target_link_libraries(${TARGET_NAME} ${HIFIAC_LIBRARIES}) +endmacro() diff --git a/plugins/hifiCodec/CMakeLists.txt b/plugins/hifiCodec/CMakeLists.txt index 9ecaf7b511..0d4f093fc2 100644 --- a/plugins/hifiCodec/CMakeLists.txt +++ b/plugins/hifiCodec/CMakeLists.txt @@ -9,10 +9,7 @@ set(TARGET_NAME hifiCodec) setup_hifi_client_server_plugin() link_hifi_libraries(audio plugins) -add_dependency_external_projects(hifiAudioCodec) -target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAUDIOCODEC_INCLUDE_DIRS}) -target_link_libraries(${TARGET_NAME} ${HIFIAUDIOCODEC_LIBRARIES}) - +target_hifiAudioCodec() if (BUILD_SERVER) install_beside_console() endif () From 42285245d5eda94c12fa52c3d943739f1efe5bc1 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Sat, 6 Oct 2018 00:43:19 -0300 Subject: [PATCH 48/48] Fix gradle script --- android/app/build.gradle | 2 +- android/build.gradle | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 13d3a0fc41..76f5acfaea 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -83,7 +83,7 @@ android { def renameHifiACTask = rootProject.getTasksByName("renameHifiACTask${variant.name.capitalize()}", false).first() runDumpSymsTask.dependsOn(task) variant.assemble.dependsOn(uploadDumpSymsTask) - variant.assemble.dependsOn(renameHifiACTask) + variant.mergeResources.dependsOn(renameHifiACTask) } } diff --git a/android/build.gradle b/android/build.gradle index 72015aab2e..14f9e4803f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -670,17 +670,15 @@ task uploadBreakpadDumpSymsRelease(type:io.github.httpbuilderng.http.HttpTask, d task renameHifiACTaskDebug() { doLast { def sourceFile = new File("${appDir}/build/intermediates/cmake/debug/obj/arm64-v8a/","libhifiCodec.so") - def destinationFile = new File("${appDir}/src/main/jniLibs/", "libplugins_libhifiCodec.so)") + def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } } } task renameHifiACTaskRelease(type: Copy) { doLast { - doLast { - def sourceFile = new File("${appDir}/build/intermediates/cmake/release/obj/arm64-v8a/","libhifiCodec.so") - def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") - copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } - } + def sourceFile = new File("${appDir}/build/intermediates/cmake/release/obj/arm64-v8a/","libhifiCodec.so") + def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") + copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } } }