Showing the changes to interface/src/Application.cpp (1 of 125 files). Show all
Unified · Split
| @@ -154,7 +154,6 @@ · 153 unmodified lines | |||
| 154 | #include "scripting/Audio.h" | 154 | #include "scripting/Audio.h" |
| 155 | #include "networking/CloseEventSender.h" | 155 | #include "networking/CloseEventSender.h" |
| 156 | #include "scripting/TestScriptingInterface.h" | 156 | #include "scripting/TestScriptingInterface.h" |
| 157 | #include "scripting/AccountScriptingInterface.h" | ||
| 158 | #include "scripting/AssetMappingsScriptingInterface.h" | 157 | #include "scripting/AssetMappingsScriptingInterface.h" |
| 159 | #include "scripting/ClipboardScriptingInterface.h" | 158 | #include "scripting/ClipboardScriptingInterface.h" |
| 160 | #include "scripting/DesktopScriptingInterface.h" | 159 | #include "scripting/DesktopScriptingInterface.h" |
| @@ -786,6 +785,7 @@ const float DEFAULT_HMD_TABLET_SCALE_PERCENT = 100.0f; · 625 unmodified lines | |||
| 786 | const float DEFAULT_DESKTOP_TABLET_SCALE_PERCENT = 75.0f; | 785 | const float DEFAULT_DESKTOP_TABLET_SCALE_PERCENT = 75.0f; |
| 787 | const bool DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR = true; | 786 | const bool DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR = true; |
| 788 | const bool DEFAULT_HMD_TABLET_BECOMES_TOOLBAR = false; | 787 | const bool DEFAULT_HMD_TABLET_BECOMES_TOOLBAR = false; |
| 788 | const bool DEFAULT_PREFER_STYLUS_OVER_LASER = false; | ||
| 789 | const bool DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS = false; | 789 | const bool DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS = false; |
| 790 | const QString DEFAULT_CURSOR_NAME = "DEFAULT"; | 790 | const QString DEFAULT_CURSOR_NAME = "DEFAULT"; |
| 791 | 791 | ||
| @@ -805,6 +805,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 13 unmodified lines | |||
| 805 | _desktopTabletScale("desktopTabletScale", DEFAULT_DESKTOP_TABLET_SCALE_PERCENT), | 805 | _desktopTabletScale("desktopTabletScale", DEFAULT_DESKTOP_TABLET_SCALE_PERCENT), |
| 806 | _desktopTabletBecomesToolbarSetting("desktopTabletBecomesToolbar", DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR), | 806 | _desktopTabletBecomesToolbarSetting("desktopTabletBecomesToolbar", DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR), |
| 807 | _hmdTabletBecomesToolbarSetting("hmdTabletBecomesToolbar", DEFAULT_HMD_TABLET_BECOMES_TOOLBAR), | 807 | _hmdTabletBecomesToolbarSetting("hmdTabletBecomesToolbar", DEFAULT_HMD_TABLET_BECOMES_TOOLBAR), |
| 808 | _preferStylusOverLaserSetting("preferStylusOverLaser", DEFAULT_PREFER_STYLUS_OVER_LASER), | ||
| 808 | _preferAvatarFingerOverStylusSetting("preferAvatarFingerOverStylus", DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS), | 809 | _preferAvatarFingerOverStylusSetting("preferAvatarFingerOverStylus", DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS), |
| 809 | _constrainToolbarPosition("toolbar/constrainToolbarToCenterX", true), | 810 | _constrainToolbarPosition("toolbar/constrainToolbarToCenterX", true), |
| 810 | _preferredCursor("preferredCursor", DEFAULT_CURSOR_NAME), | 811 | _preferredCursor("preferredCursor", DEFAULT_CURSOR_NAME), |
| @@ -1238,8 +1239,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 427 unmodified lines | |||
| 1238 | userActivityLogger.logAction("launch", properties); | 1239 | userActivityLogger.logAction("launch", properties); |
| 1239 | } | 1240 | } |
| 1240 | 1241 | ||
| 1241 | // Tell our entity edit sender about our known jurisdictions | ||
| 1242 | _entityEditSender.setServerJurisdictions(&_entityServerJurisdictions); | ||
| 1243 | _entityEditSender.setMyAvatar(myAvatar.get()); | 1242 | _entityEditSender.setMyAvatar(myAvatar.get()); |
| 1244 | 1243 | ||
| 1245 | // The entity octree will have to know about MyAvatar for the parentJointName import | 1244 | // The entity octree will have to know about MyAvatar for the parentJointName import |
| @@ -1492,7 +1491,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 246 unmodified lines | |||
| 1492 | connect(audioIO.data(), &AudioClient::noiseGateClosed, audioScriptingInterface.data(), &AudioScriptingInterface::noiseGateClosed); | 1491 | connect(audioIO.data(), &AudioClient::noiseGateClosed, audioScriptingInterface.data(), &AudioScriptingInterface::noiseGateClosed); |
| 1493 | connect(audioIO.data(), &AudioClient::inputReceived, audioScriptingInterface.data(), &AudioScriptingInterface::inputReceived); | 1492 | connect(audioIO.data(), &AudioClient::inputReceived, audioScriptingInterface.data(), &AudioScriptingInterface::inputReceived); |
| 1494 | 1493 | ||
| 1495 | |||
| 1496 | this->installEventFilter(this); | 1494 | this->installEventFilter(this); |
| 1497 | 1495 | ||
| 1498 | #ifdef HAVE_DDE | 1496 | #ifdef HAVE_DDE |
| @@ -1516,8 +1514,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 17 unmodified lines | |||
| 1516 | applicationUpdater->checkForUpdate(); | 1514 | applicationUpdater->checkForUpdate(); |
| 1517 | } | 1515 | } |
| 1518 | 1516 | ||
| 1519 | // Now that menu is initialized we can sync myAvatar with it's state. | 1517 | Menu::getInstance()->setIsOptionChecked(MenuOption::ActionMotorControl, true); |
| 1520 | myAvatar->updateMotionBehaviorFromMenu(); | ||
| 1521 | 1518 | ||
| 1522 | // FIXME spacemouse code still needs cleanup | 1519 | // FIXME spacemouse code still needs cleanup |
| 1523 | #if 0 | 1520 | #if 0 |
| @@ -2379,9 +2376,10 @@ void Application::initializeUi() { · 855 unmodified lines | |||
| 2379 | 2376 | ||
| 2380 | setupPreferences(); | 2377 | setupPreferences(); |
| 2381 | 2378 | ||
| 2382 | // For some reason there is already an "Application" object in the QML context, | 2379 | // in Qt 5.10.0 there is already an "Audio" object in the QML context |
| 2383 | // though I can't find it. Hence, "ApplicationInterface" | 2380 | // though I failed to find it (from QtMultimedia??). So.. let it be "AudioScriptingInterface" |
| 2384 | surfaceContext->setContextProperty("Audio", DependencyManager::get<AudioScriptingInterface>().data()); | 2381 | surfaceContext->setContextProperty("AudioScriptingInterface", DependencyManager::get<AudioScriptingInterface>().data()); |
| 2382 | |||
| 2385 | surfaceContext->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data()); | 2383 | surfaceContext->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data()); |
| 2386 | surfaceContext->setContextProperty("AudioScope", DependencyManager::get<AudioScope>().data()); | 2384 | surfaceContext->setContextProperty("AudioScope", DependencyManager::get<AudioScope>().data()); |
| 2387 | 2385 | ||
| @@ -2432,7 +2430,7 @@ void Application::initializeUi() { · 44 unmodified lines | |||
| 2432 | surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data()); | 2430 | surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data()); |
| 2433 | surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data()); | 2431 | surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data()); |
| 2434 | 2432 | ||
| 2435 | surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance()); | 2433 | surfaceContext->setContextProperty("Account", GlobalServicesScriptingInterface::getInstance()); |
| 2436 | surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface); | 2434 | surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface); |
| 2437 | surfaceContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance()); | 2435 | surfaceContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance()); |
| 2438 | surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data()); | 2436 | surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data()); |
| @@ -2641,6 +2639,10 @@ void Application::setHmdTabletBecomesToolbarSetting(bool value) { · 202 unmodified lines | |||
| 2641 | updateSystemTabletMode(); | 2639 | updateSystemTabletMode(); |
| 2642 | } | 2640 | } |
| 2643 | 2641 | ||
| 2642 | void Application::setPreferStylusOverLaser(bool value) { | ||
| 2643 | _preferStylusOverLaserSetting.set(value); | ||
| 2644 | } | ||
| 2645 | |||
| 2644 | void Application::setPreferAvatarFingerOverStylus(bool value) { | 2646 | void Application::setPreferAvatarFingerOverStylus(bool value) { |
| 2645 | _preferAvatarFingerOverStylusSetting.set(value); | 2647 | _preferAvatarFingerOverStylusSetting.set(value); |
| 2646 | } | 2648 | } |
| @@ -4622,7 +4624,7 @@ void Application::reloadResourceCaches() { · 1975 unmodified lines | |||
| 4622 | _lastQueriedTime = 0; | 4624 | _lastQueriedTime = 0; |
| 4623 | _octreeQuery.incrementConnectionID(); | 4625 | _octreeQuery.incrementConnectionID(); |
| 4624 | 4626 | ||
| 4625 | queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions); | 4627 | queryOctree(NodeType::EntityServer, PacketType::EntityQuery); |
| 4626 | 4628 | ||
| 4627 | DependencyManager::get<AssetClient>()->clearCache(); | 4629 | DependencyManager::get<AssetClient>()->clearCache(); |
| 4628 | 4630 | ||
| @@ -5115,7 +5117,7 @@ void Application::update(float deltaTime) { · 486 unmodified lines | |||
| 5115 | if (queryIsDue || viewIsDifferentEnough) { | 5117 | if (queryIsDue || viewIsDifferentEnough) { |
| 5116 | _lastQueriedTime = now; | 5118 | _lastQueriedTime = now; |
| 5117 | if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) { | 5119 | if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) { |
| 5118 | queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions); | 5120 | queryOctree(NodeType::EntityServer, PacketType::EntityQuery); |
| 5119 | } | 5121 | } |
| 5120 | sendAvatarViewFrustum(); | 5122 | sendAvatarViewFrustum(); |
| 5121 | _lastQueriedViewFrustum = _viewFrustum; | 5123 | _lastQueriedViewFrustum = _viewFrustum; |
| @@ -5336,15 +5338,12 @@ int Application::sendNackPackets() { · 214 unmodified lines | |||
| 5336 | return packetsSent; | 5338 | return packetsSent; |
| 5337 | } | 5339 | } |
| 5338 | 5340 | ||
| 5339 | void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) { | 5341 | void Application::queryOctree(NodeType_t serverType, PacketType packetType) { |
| 5340 | 5342 | ||
| 5341 | if (!_settingsLoaded) { | 5343 | if (!_settingsLoaded) { |
| 5342 | return; // bail early if settings are not loaded | 5344 | return; // bail early if settings are not loaded |
| 5343 | } | 5345 | } |
| 5344 | 5346 | ||
| 5345 | //qCDebug(interfaceapp) << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView(); | ||
| 5346 | bool wantExtraDebugging = getLogger()->extraDebugging(); | ||
| 5347 | |||
| 5348 | ViewFrustum viewFrustum; | 5347 | ViewFrustum viewFrustum; |
| 5349 | copyViewFrustum(viewFrustum); | 5348 | copyViewFrustum(viewFrustum); |
| 5350 | _octreeQuery.setCameraPosition(viewFrustum.getPosition()); | 5349 | _octreeQuery.setCameraPosition(viewFrustum.getPosition()); |
| @@ -5359,147 +5358,22 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 8 unmodified lines | |||
| 5359 | _octreeQuery.setOctreeSizeScale(lodManager->getOctreeSizeScale()); | 5358 | _octreeQuery.setOctreeSizeScale(lodManager->getOctreeSizeScale()); |
| 5360 | _octreeQuery.setBoundaryLevelAdjust(lodManager->getBoundaryLevelAdjust()); | 5359 | _octreeQuery.setBoundaryLevelAdjust(lodManager->getBoundaryLevelAdjust()); |
| 5361 | 5360 | ||
| 5362 | // Iterate all of the nodes, and get a count of how many octree servers we have... | ||
| 5363 | int totalServers = 0; | ||
| 5364 | int inViewServers = 0; | ||
| 5365 | int unknownJurisdictionServers = 0; | ||
| 5366 | |||
| 5367 | auto nodeList = DependencyManager::get<NodeList>(); | 5361 | auto nodeList = DependencyManager::get<NodeList>(); |
| 5368 | 5362 | ||
| 5369 | nodeList->eachNode([&](const SharedNodePointer& node) { | 5363 | auto node = nodeList->soloNodeOfType(serverType); |
| 5370 | // only send to the NodeTypes that are serverType | 5364 | if (node && node->getActiveSocket()) { |
| 5371 | if (node->getActiveSocket() && node->getType() == serverType) { | 5365 | _octreeQuery.setMaxQueryPacketsPerSecond(getMaxOctreePacketsPerSecond()); |
| 5372 | totalServers++; | ||
| 5373 | 5366 | ||
| 5374 | // get the server bounds for this server | 5367 | auto queryPacket = NLPacket::create(packetType); |
| 5375 | QUuid nodeUUID = node->getUUID(); | ||
| 5376 | 5368 | ||
| 5377 | // if we haven't heard from this voxel server, go ahead and send it a query, so we | 5369 | // encode the query data |
| 5378 | // can get the jurisdiction... | 5370 | auto packetData = reinterpret_cast<unsigned char*>(queryPacket->getPayload()); |
| 5379 | if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { | 5371 | int packetSize = _octreeQuery.getBroadcastData(packetData); |
| 5380 | unknownJurisdictionServers++; | 5372 | queryPacket->setPayloadSize(packetSize); |
| 5381 | } else { | ||
| 5382 | const JurisdictionMap& map = (jurisdictions)[nodeUUID]; | ||
| 5383 | |||
| 5384 | auto rootCode = map.getRootOctalCode(); | ||
| 5385 | |||
| 5386 | if (rootCode) { | ||
| 5387 | VoxelPositionSize rootDetails; | ||
| 5388 | voxelDetailsForCode(rootCode.get(), rootDetails); | ||
| 5389 | AACube serverBounds(glm::vec3(rootDetails.x * TREE_SCALE, | ||
| 5390 | rootDetails.y * TREE_SCALE, | ||
| 5391 | rootDetails.z * TREE_SCALE) - glm::vec3(HALF_TREE_SCALE), | ||
| 5392 | rootDetails.s * TREE_SCALE); | ||
| 5393 | if (viewFrustum.cubeIntersectsKeyhole(serverBounds)) { | ||
| 5394 | inViewServers++; | ||
| 5395 | } | ||
| 5396 | } | ||
| 5397 | } | ||
| 5398 | } | ||
| 5399 | }); | ||
| 5400 | 5373 | ||
| 5401 | if (wantExtraDebugging) { | 5374 | // make sure we still have an active socket |
| 5402 | qCDebug(interfaceapp, "Servers: total %d, in view %d, unknown jurisdiction %d", | 5375 | nodeList->sendUnreliablePacket(*queryPacket, *node); |
| 5403 | totalServers, inViewServers, unknownJurisdictionServers); | ||
| 5404 | } | 5376 | } |
| 5405 | |||
| 5406 | int perServerPPS = 0; | ||
| 5407 | const int SMALL_BUDGET = 10; | ||
| 5408 | int perUnknownServer = SMALL_BUDGET; | ||
| 5409 | int totalPPS = getMaxOctreePacketsPerSecond(); | ||
| 5410 | |||
| 5411 | // determine PPS based on number of servers | ||
| 5412 | if (inViewServers >= 1) { | ||
| 5413 | // set our preferred PPS to be exactly evenly divided among all of the voxel servers... and allocate 1 PPS | ||
| 5414 | // for each unknown jurisdiction server | ||
| 5415 | perServerPPS = (totalPPS / inViewServers) - (unknownJurisdictionServers * perUnknownServer); | ||
| 5416 | } else { | ||
| 5417 | if (unknownJurisdictionServers > 0) { | ||
| 5418 | perUnknownServer = (totalPPS / unknownJurisdictionServers); | ||
| 5419 | } | ||
| 5420 | } | ||
| 5421 | |||
| 5422 | if (wantExtraDebugging) { | ||
| 5423 | qCDebug(interfaceapp, "perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer); | ||
| 5424 | } | ||
| 5425 | |||
| 5426 | auto queryPacket = NLPacket::create(packetType); | ||
| 5427 | |||
| 5428 | nodeList->eachNode([&](const SharedNodePointer& node) { | ||
| 5429 | // only send to the NodeTypes that are serverType | ||
| 5430 | if (node->getActiveSocket() && node->getType() == serverType) { | ||
| 5431 | |||
| 5432 | // get the server bounds for this server | ||
| 5433 | QUuid nodeUUID = node->getUUID(); | ||
| 5434 | |||
| 5435 | bool inView = false; | ||
| 5436 | bool unknownView = false; | ||
| 5437 | |||
| 5438 | // if we haven't heard from this voxel server, go ahead and send it a query, so we | ||
| 5439 | // can get the jurisdiction... | ||
| 5440 | if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { | ||
| 5441 | unknownView = true; // assume it's in view | ||
| 5442 | if (wantExtraDebugging) { | ||
| 5443 | qCDebug(interfaceapp) << "no known jurisdiction for node " << *node << ", assume it's visible."; | ||
| 5444 | } | ||
| 5445 | } else { | ||
| 5446 | const JurisdictionMap& map = (jurisdictions)[nodeUUID]; | ||
| 5447 | |||
| 5448 | auto rootCode = map.getRootOctalCode(); | ||
| 5449 | |||
| 5450 | if (rootCode) { | ||
| 5451 | VoxelPositionSize rootDetails; | ||
| 5452 | voxelDetailsForCode(rootCode.get(), rootDetails); | ||
| 5453 | AACube serverBounds(glm::vec3(rootDetails.x * TREE_SCALE, | ||
| 5454 | rootDetails.y * TREE_SCALE, | ||
| 5455 | rootDetails.z * TREE_SCALE) - glm::vec3(HALF_TREE_SCALE), | ||
| 5456 | rootDetails.s * TREE_SCALE); | ||
| 5457 | |||
| 5458 | |||
| 5459 | inView = viewFrustum.cubeIntersectsKeyhole(serverBounds); | ||
| 5460 | } else if (wantExtraDebugging) { | ||
| 5461 | qCDebug(interfaceapp) << "Jurisdiction without RootCode for node " << *node << ". That's unusual!"; | ||
| 5462 | } | ||
| 5463 | } | ||
| 5464 | |||
| 5465 | if (inView) { | ||
| 5466 | _octreeQuery.setMaxQueryPacketsPerSecond(perServerPPS); | ||
| 5467 | } else if (unknownView) { | ||
| 5468 | if (wantExtraDebugging) { | ||
| 5469 | qCDebug(interfaceapp) << "no known jurisdiction for node " << *node << ", give it budget of " | ||
| 5470 | << perUnknownServer << " to send us jurisdiction."; | ||
| 5471 | } | ||
| 5472 | |||
| 5473 | // set the query's position/orientation to be degenerate in a manner that will get the scene quickly | ||
| 5474 | // If there's only one server, then don't do this, and just let the normal voxel query pass through | ||
| 5475 | // as expected... this way, we will actually get a valid scene if there is one to be seen | ||
| 5476 | if (totalServers > 1) { | ||
| 5477 | _octreeQuery.setCameraPosition(glm::vec3(-0.1,-0.1,-0.1)); | ||
| 5478 | const glm::quat OFF_IN_NEGATIVE_SPACE = glm::quat(-0.5, 0, -0.5, 1.0); | ||
| 5479 | _octreeQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE); | ||
| 5480 | _octreeQuery.setCameraNearClip(0.1f); | ||
| 5481 | _octreeQuery.setCameraFarClip(0.1f); | ||
| 5482 | if (wantExtraDebugging) { | ||
| 5483 | qCDebug(interfaceapp) << "Using 'minimal' camera position for node" << *node; | ||
| 5484 | } | ||
| 5485 | } else { | ||
| 5486 | if (wantExtraDebugging) { | ||
| 5487 | qCDebug(interfaceapp) << "Using regular camera position for node" << *node; | ||
| 5488 | } | ||
| 5489 | } | ||
| 5490 | _octreeQuery.setMaxQueryPacketsPerSecond(perUnknownServer); | ||
| 5491 | } else { | ||
| 5492 | _octreeQuery.setMaxQueryPacketsPerSecond(0); | ||
| 5493 | } | ||
| 5494 | |||
| 5495 | // encode the query data | ||
| 5496 | int packetSize = _octreeQuery.getBroadcastData(reinterpret_cast<unsigned char*>(queryPacket->getPayload())); | ||
| 5497 | queryPacket->setPayloadSize(packetSize); | ||
| 5498 | |||
| 5499 | // make sure we still have an active socket | ||
| 5500 | nodeList->sendUnreliablePacket(*queryPacket, *node); | ||
| 5501 | } | ||
| 5502 | }); | ||
| 5503 | } | 5377 | } |
| 5504 | 5378 | ||
| 5505 | 5379 | ||
| @@ -5614,11 +5488,6 @@ void Application::clearDomainOctreeDetails() { · 108 unmodified lines | |||
| 5614 | 5488 | ||
| 5615 | resetPhysicsReadyInformation(); | 5489 | resetPhysicsReadyInformation(); |
| 5616 | 5490 | ||
| 5617 | // reset our node to stats and node to jurisdiction maps... since these must be changing... | ||
| 5618 | _entityServerJurisdictions.withWriteLock([&] { | ||
| 5619 | _entityServerJurisdictions.clear(); | ||
| 5620 | }); | ||
| 5621 | |||
| 5622 | _octreeServerSceneStats.withWriteLock([&] { | 5491 | _octreeServerSceneStats.withWriteLock([&] { |
| 5623 | _octreeServerSceneStats.clear(); | 5492 | _octreeServerSceneStats.clear(); |
| 5624 | }); | 5493 | }); |
| @@ -5820,8 +5689,6 @@ bool Application::nearbyEntitiesAreReadyForPhysics() { · 195 unmodified lines | |||
| 5820 | } | 5689 | } |
| 5821 | 5690 | ||
| 5822 | int Application::processOctreeStats(ReceivedMessage& message, SharedNodePointer sendingNode) { | 5691 | int Application::processOctreeStats(ReceivedMessage& message, SharedNodePointer sendingNode) { |
| 5823 | // But, also identify the sender, and keep track of the contained jurisdiction root for this server | ||
| 5824 | |||
| 5825 | // parse the incoming stats datas stick it in a temporary object for now, while we | 5692 | // parse the incoming stats datas stick it in a temporary object for now, while we |
| 5826 | // determine which server it belongs to | 5693 | // determine which server it belongs to |
| 5827 | int statsMessageLength = 0; | 5694 | int statsMessageLength = 0; |
| @@ -5836,42 +5703,6 @@ int Application::processOctreeStats(ReceivedMessage& message, SharedNodePointer · 8 unmodified lines | |||
| 5836 | if (octreeStats.isFullScene()) { | 5703 | if (octreeStats.isFullScene()) { |
| 5837 | _fullSceneReceivedCounter++; | 5704 | _fullSceneReceivedCounter++; |
| 5838 | } | 5705 | } |
| 5839 | |||
| 5840 | // see if this is the first we've heard of this node... | ||
| 5841 | NodeToJurisdictionMap* jurisdiction = nullptr; | ||
| 5842 | QString serverType; | ||
| 5843 | if (sendingNode->getType() == NodeType::EntityServer) { | ||
| 5844 | jurisdiction = &_entityServerJurisdictions; | ||
| 5845 | serverType = "Entity"; | ||
| 5846 | } | ||
| 5847 | |||
| 5848 | bool found = false; | ||
| 5849 | |||
| 5850 | jurisdiction->withReadLock([&] { | ||
| 5851 | if (jurisdiction->find(nodeUUID) != jurisdiction->end()) { | ||
| 5852 | found = true; | ||
| 5853 | return; | ||
| 5854 | } | ||
| 5855 | |||
| 5856 | VoxelPositionSize rootDetails; | ||
| 5857 | voxelDetailsForCode(octreeStats.getJurisdictionRoot().get(), rootDetails); | ||
| 5858 | |||
| 5859 | qCDebug(interfaceapp, "stats from new %s server... [%f, %f, %f, %f]", | ||
| 5860 | qPrintable(serverType), | ||
| 5861 | (double)rootDetails.x, (double)rootDetails.y, (double)rootDetails.z, (double)rootDetails.s); | ||
| 5862 | }); | ||
| 5863 | |||
| 5864 | if (!found) { | ||
| 5865 | // store jurisdiction details for later use | ||
| 5866 | // This is bit of fiddling is because JurisdictionMap assumes it is the owner of the values used to construct it | ||
| 5867 | // but OctreeSceneStats thinks it's just returning a reference to its contents. So we need to make a copy of the | ||
| 5868 | // details from the OctreeSceneStats to construct the JurisdictionMap | ||
| 5869 | JurisdictionMap jurisdictionMap; | ||
| 5870 | jurisdictionMap.copyContents(octreeStats.getJurisdictionRoot(), octreeStats.getJurisdictionEndNodes()); | ||
| 5871 | jurisdiction->withWriteLock([&] { | ||
| 5872 | (*jurisdiction)[nodeUUID] = jurisdictionMap; | ||
| 5873 | }); | ||
| 5874 | } | ||
| 5875 | }); | 5706 | }); |
| 5876 | 5707 | ||
| 5877 | return statsMessageLength; | 5708 | return statsMessageLength; |
| @@ -5892,7 +5723,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 14 unmodified lines | |||
| 5892 | return !entityServerNode || isPhysicsEnabled(); | 5723 | return !entityServerNode || isPhysicsEnabled(); |
| 5893 | }); | 5724 | }); |
| 5894 | 5725 | ||
| 5895 | // setup the packet senders and jurisdiction listeners of the script engine's scripting interfaces so | 5726 | // setup the packet sender of the script engine's scripting interfaces so |
| 5896 | // we can use the same ones from the application. | 5727 | // we can use the same ones from the application. |
| 5897 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); | 5728 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); |
| 5898 | entityScriptingInterface->setPacketSender(&_entityEditSender); | 5729 | entityScriptingInterface->setPacketSender(&_entityEditSender); |
| @@ -5978,7 +5809,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 79 unmodified lines | |||
| 5978 | scriptEngine->registerGlobalObject("ModelCache", DependencyManager::get<ModelCache>().data()); | 5809 | scriptEngine->registerGlobalObject("ModelCache", DependencyManager::get<ModelCache>().data()); |
| 5979 | scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get<SoundCache>().data()); | 5810 | scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get<SoundCache>().data()); |
| 5980 | 5811 | ||
| 5981 | scriptEngine->registerGlobalObject("Account", AccountScriptingInterface::getInstance()); | 5812 | scriptEngine->registerGlobalObject("Account", GlobalServicesScriptingInterface::getInstance()); |
| 5982 | scriptEngine->registerGlobalObject("DialogsManager", _dialogsManagerScriptingInterface); | 5813 | scriptEngine->registerGlobalObject("DialogsManager", _dialogsManagerScriptingInterface); |
| 5983 | 5814 | ||
| 5984 | scriptEngine->registerGlobalObject("GlobalServices", GlobalServicesScriptingInterface::getInstance()); | 5815 | scriptEngine->registerGlobalObject("GlobalServices", GlobalServicesScriptingInterface::getInstance()); |
| @@ -6384,7 +6215,7 @@ void Application::showAssetServerWidget(QString filePath) { · 399 unmodified lines | |||
| 6384 | if (!hmd->getShouldShowTablet() && !isHMDMode()) { | 6215 | if (!hmd->getShouldShowTablet() && !isHMDMode()) { |
| 6385 | DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", startUpload); | 6216 | DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", startUpload); |
| 6386 | } else { | 6217 | } else { |
| 6387 | static const QUrl url("../../hifi/dialogs/TabletAssetServer.qml"); | 6218 | static const QUrl url("hifi/dialogs/TabletAssetServer.qml"); |
| 6388 | tablet->pushOntoStack(url); | 6219 | tablet->pushOntoStack(url); |
| 6389 | } | 6220 | } |
| 6390 | } | 6221 | } |
| @@ -6957,7 +6788,7 @@ void Application::loadLODToolsDialog() { · 566 unmodified lines | |||
| 6957 | auto dialogsManager = DependencyManager::get<DialogsManager>(); | 6788 | auto dialogsManager = DependencyManager::get<DialogsManager>(); |
| 6958 | dialogsManager->lodTools(); | 6789 | dialogsManager->lodTools(); |
| 6959 | } else { | 6790 | } else { |
| 6960 | tablet->pushOntoStack("../../hifi/dialogs/TabletLODTools.qml"); | 6791 | tablet->pushOntoStack("hifi/dialogs/TabletLODTools.qml"); |
| 6961 | } | 6792 | } |
| 6962 | } | 6793 | } |
| 6963 | 6794 | ||
| @@ -6969,7 +6800,7 @@ void Application::loadEntityStatisticsDialog() { · 5 unmodified lines | |||
| 6969 | auto dialogsManager = DependencyManager::get<DialogsManager>(); | 6800 | auto dialogsManager = DependencyManager::get<DialogsManager>(); |
| 6970 | dialogsManager->octreeStatsDetails(); | 6801 | dialogsManager->octreeStatsDetails(); |
| 6971 | } else { | 6802 | } else { |
| 6972 | tablet->pushOntoStack("../../hifi/dialogs/TabletEntityStatistics.qml"); | 6803 | tablet->pushOntoStack("hifi/dialogs/TabletEntityStatistics.qml"); |
| 6973 | } | 6804 | } |
| 6974 | } | 6805 | } |
| 6975 | 6806 | ||
| @@ -6980,7 +6811,7 @@ void Application::loadDomainConnectionDialog() { · 4 unmodified lines | |||
| 6980 | auto dialogsManager = DependencyManager::get<DialogsManager>(); | 6811 | auto dialogsManager = DependencyManager::get<DialogsManager>(); |
| 6981 | dialogsManager->showDomainConnectionDialog(); | 6812 | dialogsManager->showDomainConnectionDialog(); |
| 6982 | } else { | 6813 | } else { |
| 6983 | tablet->pushOntoStack("../../hifi/dialogs/TabletDCDialog.qml"); | 6814 | tablet->pushOntoStack("hifi/dialogs/TabletDCDialog.qml"); |
| 6984 | } | 6815 | } |
| 6985 | } | 6816 | } |
| 6986 | 6817 | ||