diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-23 09:33:53 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-23 09:33:53 +0200 |
commit | ec2c6c0f13004bc1bba92f14443228778da287a0 (patch) | |
tree | 5c4e2621091ad7bbd31e6ffb6a277c1aaee39b55 /src/render/jobs/loadscenejob.cpp | |
parent | 5476bc6b4b6a12c921da502c24c4e078b04dd3b3 (diff) | |
parent | 0e3d54f8d7f9be26687afebcc9f456e4cefc2357 (diff) |
Merge remote-tracking branch 'origin/5.8' into devwip/particles
Change-Id: I4e1c528eb8e1c81aead51a5664635ca2becad397
Diffstat (limited to 'src/render/jobs/loadscenejob.cpp')
-rw-r--r-- | src/render/jobs/loadscenejob.cpp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/render/jobs/loadscenejob.cpp b/src/render/jobs/loadscenejob.cpp index 3111e1ba3..701942976 100644 --- a/src/render/jobs/loadscenejob.cpp +++ b/src/render/jobs/loadscenejob.cpp @@ -60,6 +60,26 @@ LoadSceneJob::LoadSceneJob(const QUrl &source, Qt3DCore::QNodeId m_sceneComponen SET_JOB_RUN_STAT_TYPE(this, JobTypes::LoadScene, 0); } +NodeManagers *LoadSceneJob::nodeManagers() const +{ + return m_managers; +} + +QList<QSceneIOHandler *> LoadSceneJob::sceneIOHandlers() const +{ + return m_sceneIOHandlers; +} + +QUrl LoadSceneJob::source() const +{ + return m_source; +} + +Qt3DCore::QNodeId LoadSceneJob::sceneComponentId() const +{ + return m_sceneComponent; +} + void LoadSceneJob::run() { // Iterate scene IO handlers until we find one that can handle this file type @@ -70,9 +90,11 @@ void LoadSceneJob::run() // Reset status scene->setStatus(QSceneLoader::None); + QSceneLoader::Status finalStatus = QSceneLoader::None; // Perform the loading only if the source wasn't explicitly set to empty if (!m_source.isEmpty()) { + finalStatus = QSceneLoader::Error; for (QSceneIOHandler *sceneIOHandler : qAsConst(m_sceneIOHandlers)) { if (!sceneIOHandler->isFileTypeSupported(m_source)) continue; @@ -82,15 +104,11 @@ void LoadSceneJob::run() // File type is supported, try to load it sceneIOHandler->setSource(m_source); - Qt3DCore::QEntity *sub = sceneIOHandler->scene(); - if (sub) { - sceneSubTree = sub; + sceneSubTree = sceneIOHandler->scene(); + if (sceneSubTree != nullptr) { // Successfully built a subtree - scene->setStatus(QSceneLoader::Ready); + finalStatus = QSceneLoader::Ready; break; - } else { - // Tree wasn't build so something went wrong obviously - scene->setStatus(QSceneLoader::Error); } } } @@ -100,6 +118,10 @@ void LoadSceneJob::run() // Set clone of sceneTree in sceneComponent. This will move the sceneSubTree // to the QCoreApplication thread which is where the frontend object tree lives. scene->setSceneSubtree(sceneSubTree); + + // Note: the status is set after the subtree so that bindinds depending on the status + // in the frontend will be consistent + scene->setStatus(finalStatus); } } // namespace Render |