From 0ab6e1fb491cbc9aa821e11a1ee78915f61ee499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Tue, 17 Sep 2019 13:48:26 +0300 Subject: Fix loading subpresentations in preloadSlide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subpresentations were not loaded when calling preloadSlide. Add subpresentation loading handling into loadComponentSlideResources, which gets called when preloadSlide is called. Change-Id: I7bc8c5a799214534370af19e6e104e2846f38743 Reviewed-by: Janne Kangas Reviewed-by: Mahmoud Badri Reviewed-by: Antti Määttä --- src/runtime/Qt3DSApplication.cpp | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/runtime/Qt3DSApplication.cpp b/src/runtime/Qt3DSApplication.cpp index 46f6a19..abe93c8 100644 --- a/src/runtime/Qt3DSApplication.cpp +++ b/src/runtime/Qt3DSApplication.cpp @@ -1226,6 +1226,42 @@ struct SApp : public IApplication m_uploadRenderTask->add(m_resourceCounter.createSet, wait); else m_createSet.unite(m_resourceCounter.createSet); + + QVector newAssets; + + getComponentSlideAssets(newAssets, presentation, component, index); + if (newAssets.size()) + qCInfo(PERF_INFO) << "Slide assets: " << newAssets; + for (QT3DSU32 idx = 0, end = m_OrderedAssets.size(); idx < end; ++idx) { + QString assetId = QString::fromUtf8(m_OrderedAssets[idx].first.c_str()); + if (newAssets.contains(assetId) && !GetPresentationById(qUtf8Printable(assetId))) { + SAssetValue &theAsset = *m_OrderedAssets[idx].second; + switch (theAsset.getType()) { + case AssetValueTypes::Presentation: { + AssetHandlers::handlePresentation(*this, theAsset); + SPresentationAsset &thePresentationAsset + = *theAsset.getDataPtr(); + CPresentation *thePresentation = thePresentationAsset.m_Presentation; + if (thePresentation) { + SStackPerfTimer __loadTimer(m_CoreFactory->GetPerfTimer(), + "Application: SetActivityZone"); + thePresentation->SetActivityZone( + &m_ActivityZoneManager->CreateActivityZone(*thePresentation)); + thePresentation->SetActive(thePresentationAsset.m_Active); + } + } break; + case AssetValueTypes::Behavior: { + AssetHandlers::handleBehavior(*this, theAsset); + } break; + case AssetValueTypes::QmlPresentation: { + AssetHandlers::handleQmlPresentation(*m_RuntimeFactory, theAsset); + } break; + // SCXML, NoAssetValue do not need processing here + default: + break; + } + } + } } } @@ -2068,7 +2104,7 @@ struct SXMLLoader : public IAppLoadContext if (!delayedLoading || (m_App.m_OrderedAssets.size() > 1 && initialAssets.size() > 0)) { for (QT3DSU32 idx = 0, end = m_App.m_OrderedAssets.size(); idx < end; ++idx) { - QString assetId = QString::fromLatin1(m_App.m_OrderedAssets[idx].first.c_str()); + QString assetId = QString::fromUtf8(m_App.m_OrderedAssets[idx].first.c_str()); if (m_App.m_OrderedAssets[idx].first != initialStr && (initialAssets.contains(assetId) || !delayedLoading)) { SAssetValue &theAsset = *m_App.m_OrderedAssets[idx].second; -- cgit v1.2.3