History

use nodeActivated to trigger refresh of Asset Browser

Stephen Birarda committed 10 years ago

Commit ee7bee91 parent 459cbeb2 files · +16 −3Browse files

Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all

Unified · Split

interface/src/Application.cpp+15−3
@@ -680,6 +680,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 679 unmodified lines
680 680
681 connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded);681 connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded);
682 connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled);682 connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled);
683 connect(nodeList.data(), &NodeList::nodeActivated, this, &Application::nodeActivated);
683 connect(nodeList.data(), &NodeList::uuidChanged, getMyAvatar(), &MyAvatar::setSessionUUID);684 connect(nodeList.data(), &NodeList::uuidChanged, getMyAvatar(), &MyAvatar::setSessionUUID);
684 connect(nodeList.data(), &NodeList::uuidChanged, this, &Application::setSessionUUID);685 connect(nodeList.data(), &NodeList::uuidChanged, this, &Application::setSessionUUID);
685 connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset);686 connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset);
@@ -4121,15 +4122,26 @@ void Application::nodeAdded(SharedNodePointer node) { · 3435 unmodified lines
4121 if (node->getType() == NodeType::AvatarMixer) {4122 if (node->getType() == NodeType::AvatarMixer) {
4122 // new avatar mixer, send off our identity packet right away4123 // new avatar mixer, send off our identity packet right away
4123 getMyAvatar()->sendIdentityPacket();4124 getMyAvatar()->sendIdentityPacket();
4124 } else if (node->getType() == NodeType::AssetServer) {4125 }
4126}
4127
4128void Application::nodeActivated(SharedNodePointer node) {
4129 if (node->getType() == NodeType::AssetServer) {
4125 // asset server just connected - check if we have the asset browser showing4130 // asset server just connected - check if we have the asset browser showing
4126 4131
4127 auto offscreenUi = DependencyManager::get<OffscreenUi>();4132 auto offscreenUi = DependencyManager::get<OffscreenUi>();
4128 auto assetDialog = offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer");4133 auto assetDialog = offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer");
4129 4134
4130 if (assetDialog) {4135 if (assetDialog) {
4131 // call reload on the shown asset browser dialog to get the mappings (if permissions allow)4136 auto nodeList = DependencyManager::get<NodeList>();
4132 QMetaObject::invokeMethod(assetDialog, "reload");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}