Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -680,6 +680,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 679 unmodified lines | ||
| 680 | 680 | |
| 681 | 681 | connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded); |
| 682 | 682 | connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled); |
| 683 | + connect(nodeList.data(), &NodeList::nodeActivated, this, &Application::nodeActivated); | |
| 683 | 684 | connect(nodeList.data(), &NodeList::uuidChanged, getMyAvatar(), &MyAvatar::setSessionUUID); |
| 684 | 685 | connect(nodeList.data(), &NodeList::uuidChanged, this, &Application::setSessionUUID); |
| 685 | 686 | connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset); |
| @@ -4121,15 +4122,26 @@ void Application::nodeAdded(SharedNodePointer node) { · 3435 unmodified lines | ||
| 4121 | 4122 | if (node->getType() == NodeType::AvatarMixer) { |
| 4122 | 4123 | // new avatar mixer, send off our identity packet right away |
| 4123 | 4124 | getMyAvatar()->sendIdentityPacket(); |
| 4124 | − } else if (node->getType() == NodeType::AssetServer) { | |
| 4125 | + } | |
| 4126 | +} | |
| 4127 | + | |
| 4128 | +void Application::nodeActivated(SharedNodePointer node) { | |
| 4129 | + if (node->getType() == NodeType::AssetServer) { | |
| 4125 | 4130 | // asset server just connected - check if we have the asset browser showing |
| 4126 | 4131 | |
| 4127 | 4132 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 4128 | 4133 | auto assetDialog = offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer"); |
| 4129 | 4134 | |
| 4130 | 4135 | if (assetDialog) { |
| 4131 | − // call reload on the shown asset browser dialog to get the mappings (if permissions allow) | |
| 4132 | − QMetaObject::invokeMethod(assetDialog, "reload"); | |
| 4136 | + auto nodeList = DependencyManager::get<NodeList>(); | |
| 4137 | + | |
| 4138 | + if (nodeList->getThisNodeCanRez()) { | |
| 4139 | + // call reload on the shown asset browser dialog to get the mappings (if permissions allow) | |
| 4140 | + QMetaObject::invokeMethod(assetDialog, "reload"); | |
| 4141 | + } else { | |
| 4142 | + // we switched to an Asset Server that we can't modify, hide the Asset Browser | |
| 4143 | + assetDialog->setVisible(false); | |
| 4144 | + } | |
| 4133 | 4145 | } |
| 4134 | 4146 | } |
| 4135 | 4147 | } |