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
680680
681681 connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded);
682682 connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled);
683+ connect(nodeList.data(), &NodeList::nodeActivated, this, &Application::nodeActivated);
683684 connect(nodeList.data(), &NodeList::uuidChanged, getMyAvatar(), &MyAvatar::setSessionUUID);
684685 connect(nodeList.data(), &NodeList::uuidChanged, this, &Application::setSessionUUID);
685686 connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset);
@@ -4121,15 +4122,26 @@ void Application::nodeAdded(SharedNodePointer node) { · 3435 unmodified lines
41214122 if (node->getType() == NodeType::AvatarMixer) {
41224123 // new avatar mixer, send off our identity packet right away
41234124 getMyAvatar()->sendIdentityPacket();
4124− } else if (node->getType() == NodeType::AssetServer) {
4125+ }
4126+}
4127+
4128+void Application::nodeActivated(SharedNodePointer node) {
4129+ if (node->getType() == NodeType::AssetServer) {
41254130 // asset server just connected - check if we have the asset browser showing
41264131
41274132 auto offscreenUi = DependencyManager::get<OffscreenUi>();
41284133 auto assetDialog = offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer");
41294134
41304135 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+ }
41334145 }
41344146 }
41354147 }