diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2018-01-26 11:25:36 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2018-01-26 11:52:26 +0000 |
commit | 6d56b53bb949caa3e592070794b3010e4801e0ca (patch) | |
tree | 7b68a96c5a43da03f9126a2d30d5c7d05fe7793b /src/render/io | |
parent | e1b0e10340cf0a9c233774647cf316a7519a2093 (diff) | |
parent | 1360f39aa811df96c2762cf081702f7a86a782cd (diff) |
Merge branch '5.10' into dev
Change-Id: I4728b29c349a16867951a781c9417054c798e04a
Diffstat (limited to 'src/render/io')
-rw-r--r-- | src/render/io/scene.cpp | 9 | ||||
-rw-r--r-- | src/render/io/scenemanager.cpp | 4 | ||||
-rw-r--r-- | src/render/io/scenemanager_p.h | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/render/io/scene.cpp b/src/render/io/scene.cpp index 7ae6f9473..d95f42a48 100644 --- a/src/render/io/scene.cpp +++ b/src/render/io/scene.cpp @@ -94,7 +94,14 @@ void Scene::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e); if (propertyChange->propertyName() == QByteArrayLiteral("source")) { m_source = propertyChange->value().toUrl(); - if (Qt3DCore::QDownloadHelperService::isLocal(m_source)) + + // If the source is empty -> we need to unload anything that was + // previously loaded and reset the status accordingly. This means + // we need to call addSceneData with the empty source to send a + // change to the frontend that will trigger the removal of the + // previous scene. The reason this scheme is employed is because + // the backend also takes care of updating the status. + if (m_source.isEmpty() || Qt3DCore::QDownloadHelperService::isLocal(m_source)) m_sceneManager->addSceneData(m_source, peerId()); else m_sceneManager->startSceneDownload(m_source, peerId()); diff --git a/src/render/io/scenemanager.cpp b/src/render/io/scenemanager.cpp index cdf8aae87..464871b48 100644 --- a/src/render/io/scenemanager.cpp +++ b/src/render/io/scenemanager.cpp @@ -78,7 +78,7 @@ void SceneManager::addSceneData(const QUrl &source, m_pendingJobs.push_back(newJob); } -QVector<LoadSceneJobPtr> SceneManager::pendingSceneLoaderJobs() +QVector<LoadSceneJobPtr> SceneManager::takePendingSceneLoaderJobs() { // Explicitly use std::move to clear the m_pendingJobs vector return std::move(m_pendingJobs); @@ -118,6 +118,8 @@ void SceneDownloader::onCompleted() return; if (succeeded()) m_manager->addSceneData(url(), m_sceneComponent, m_data); + else + qWarning() << "Failed to download scene at" << url(); m_manager->clearSceneDownload(this); } diff --git a/src/render/io/scenemanager_p.h b/src/render/io/scenemanager_p.h index 624b32499..470846b83 100644 --- a/src/render/io/scenemanager_p.h +++ b/src/render/io/scenemanager_p.h @@ -95,7 +95,7 @@ public: void addSceneData(const QUrl &source, Qt3DCore::QNodeId sceneUuid, const QByteArray &data = QByteArray()); - QVector<LoadSceneJobPtr> pendingSceneLoaderJobs(); + QVector<LoadSceneJobPtr> takePendingSceneLoaderJobs(); void startSceneDownload(const QUrl &source, Qt3DCore::QNodeId sceneUuid); void clearSceneDownload(SceneDownloader *downloader); |