History

Don't refresh if not connected to the Asset Server

Atlante45 committed 9 years ago

Commit 8583be41 parent 1a571d01 file · +7 −2Browse files

Showing the changes to interface/src/scripting/AssetMappingsScriptingInterface.cpp (1 of 1 file). Show all

Unified · Split

interface/src/scripting/AssetMappingsScriptingInterface.cpp+7−2
@@ -19,11 +19,12 @@ · 18 unmodified lines
1919 #include <AssetUpload.h>
2020 #include <MappingRequest.h>
2121 #include <NetworkLogging.h>
22+#include <NodeList.h>
2223 #include <OffscreenUi.h>
2324
2425 static const int AUTO_REFRESH_INTERVAL = 1000;
2526
26−const int assetMappingModelMetatypeId = qRegisterMetaType<AssetMappingModel*>("AssetMappingModel*");
27+int assetMappingModelMetatypeId = qRegisterMetaType<AssetMappingModel*>("AssetMappingModel*");
2728
2829 AssetMappingsScriptingInterface::AssetMappingsScriptingInterface() {
2930 _proxyModel.setSourceModel(&_assetMappingModel);
@@ -195,7 +196,11 @@ AssetMappingModel::AssetMappingModel() { · 165 unmodified lines
195196 setupRoles();
196197
197198 connect(&_autoRefreshTimer, &QTimer::timeout, this, [this] {
198− refresh();
199+ auto nodeList = DependencyManager::get<NodeList>();
200+ auto assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
201+ if (assetServer) {
202+ refresh();
203+ }
199204 });
200205 _autoRefreshTimer.setInterval(AUTO_REFRESH_INTERVAL);
201206 }