mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
refresh the Asset Browser when switching domains
This commit is contained in:
parent
588a5da3ca
commit
194226103c
4 changed files with 43 additions and 6 deletions
|
@ -21,7 +21,7 @@ import "dialogs"
|
|||
Window {
|
||||
id: root
|
||||
objectName: "AssetServer"
|
||||
title: "My Asset Server"
|
||||
title: "Asset Browser"
|
||||
resizable: true
|
||||
destroyOnInvisible: true
|
||||
x: 40; y: 40
|
||||
|
@ -125,6 +125,10 @@ Window {
|
|||
}, false);
|
||||
}
|
||||
|
||||
function clear() {
|
||||
Assets.mappingModel.clear();
|
||||
}
|
||||
|
||||
function reload() {
|
||||
Assets.mappingModel.refresh();
|
||||
treeView.selection.clear();
|
||||
|
|
|
@ -4121,6 +4121,16 @@ void Application::nodeAdded(SharedNodePointer node) {
|
|||
if (node->getType() == NodeType::AvatarMixer) {
|
||||
// new avatar mixer, send off our identity packet right away
|
||||
getMyAvatar()->sendIdentityPacket();
|
||||
} else if (node->getType() == NodeType::AssetServer) {
|
||||
// asset server just connected - check if we have the asset browser showing
|
||||
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
auto assetDialog = offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer");
|
||||
|
||||
if (assetDialog) {
|
||||
// call reload on the shown asset browser dialog to get the mappings (if permissions allow)
|
||||
QMetaObject::invokeMethod(assetDialog, "reload");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4136,10 +4146,7 @@ void Application::nodeKilled(SharedNodePointer node) {
|
|||
|
||||
if (node->getType() == NodeType::AudioMixer) {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "audioMixerKilled");
|
||||
}
|
||||
|
||||
if (node->getType() == NodeType::EntityServer) {
|
||||
|
||||
} else if (node->getType() == NodeType::EntityServer) {
|
||||
QUuid nodeUUID = node->getUUID();
|
||||
// see if this is the first we've heard of this node...
|
||||
_entityServerJurisdictions.withReadLock([&] {
|
||||
|
@ -4170,6 +4177,16 @@ void Application::nodeKilled(SharedNodePointer node) {
|
|||
} else if (node->getType() == NodeType::AvatarMixer) {
|
||||
// our avatar mixer has gone away - clear the hash of avatars
|
||||
DependencyManager::get<AvatarManager>()->clearOtherAvatars();
|
||||
} else if (node->getType() == NodeType::AssetServer) {
|
||||
// asset server going away - check if we have the asset browser showing
|
||||
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
auto assetDialog = offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer");
|
||||
|
||||
if (assetDialog) {
|
||||
// call reload on the shown asset browser dialog
|
||||
QMetaObject::invokeMethod(assetDialog, "clear");
|
||||
}
|
||||
}
|
||||
}
|
||||
void Application::trackIncomingOctreePacket(ReceivedMessage& message, SharedNodePointer sendingNode, bool wasStatsPacket) {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <QtScript/QScriptEngine>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QThread>
|
||||
|
||||
#include <AssetRequest.h>
|
||||
#include <AssetUpload.h>
|
||||
|
@ -20,6 +21,19 @@
|
|||
#include <NetworkLogging.h>
|
||||
#include <OffscreenUi.h>
|
||||
|
||||
void AssetMappingModel::clear() {
|
||||
// make sure we are on the same thread before we touch the hash
|
||||
if (thread() != QThread::currentThread()) {
|
||||
QMetaObject::invokeMethod(this, "clear");
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "Clearing loaded asset mappings for Asset Browser";
|
||||
|
||||
_pathToItemMap.clear();
|
||||
QStandardItemModel::clear();
|
||||
}
|
||||
|
||||
AssetMappingsScriptingInterface::AssetMappingsScriptingInterface() {
|
||||
_proxyModel.setSourceModel(&_assetMappingModel);
|
||||
_proxyModel.setSortRole(Qt::DisplayRole);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <QSortFilterProxyModel>
|
||||
|
||||
|
||||
|
||||
class AssetMappingModel : public QStandardItemModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -30,6 +29,9 @@ public:
|
|||
bool isKnownMapping(QString path) const { return _pathToItemMap.contains(path); }
|
||||
bool isKnownFolder(QString path) const;
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
|
||||
signals:
|
||||
void errorGettingMappings(QString errorString);
|
||||
|
||||
|
|
Loading…
Reference in a new issue