summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJere Tuliniemi <jere.tuliniemi@qt.io>2020-02-04 14:39:59 +0200
committerJere Tuliniemi <jere.tuliniemi@qt.io>2020-02-06 11:30:10 +0200
commit12f4d0fee51e5e19eb82f9ded798a661629c132c (patch)
tree7c15c3a0340bae84f7ba1cd2401dd8e22174f36f
parent8b9521e38bcb7419aefa97689fdb172718823d16 (diff)
Load component subpresentation when needed
All components were iterated and included subpresentation loaded at the start. Now only components included in the master slide are loaded. Rest are loaded when the slide in which they reside is shown. Task-number: QT3DS-4057 Change-Id: I1e8f67f51fd452ac362c1020f7e9674bc86b7ec1 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Antti Määttä <antti.maatta@qt.io>
-rw-r--r--src/runtime/Qt3DSApplication.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/runtime/Qt3DSApplication.cpp b/src/runtime/Qt3DSApplication.cpp
index 39387ab..20a8e5a 100644
--- a/src/runtime/Qt3DSApplication.cpp
+++ b/src/runtime/Qt3DSApplication.cpp
@@ -1230,6 +1230,21 @@ struct SApp : public IApplication
QVector<QString> newAssets;
getComponentSlideAssets(newAssets, presentation, component, index);
+
+ // Load subpresentations of components under non-master slides of the main scene
+ // Also load subpresentation located in master slides of sub-components
+ if (presentation->GetRoot() != component || index > 0) {
+ QVector<element::SElement *> components;
+ component->findComponents(components);
+ for (int i = 0; i < components.size(); ++i) {
+ if (components[i] != component
+ && slidesystem.isElementInSlide(*components[i], *component, index)) {
+ getComponentSlideAssets(newAssets, presentation, components[i], 0);
+ getComponentSlideAssets(newAssets, presentation, components[i], 1);
+ }
+ }
+ }
+
if (newAssets.size())
qCInfo(TRACE_INFO) << "Slide assets: " << newAssets;
for (QT3DSU32 idx = 0, end = m_OrderedAssets.size(); idx < end; ++idx) {
@@ -1348,10 +1363,14 @@ struct SApp : public IApplication
if (inAsset.m_Id.IsValid())
newScene->RegisterOffscreenRenderer(inAsset.m_Id);
+ // Load scene master slide resources
+ // Also load master slide resources of components located in the master slide
QVector<TElement *> components;
thePresentation->GetRoot()->findComponents(components);
- for (auto &component : qAsConst(components))
- loadComponentSlideResources(component, thePresentation, 0, "Master", true);
+ for (auto &component : qAsConst(components)) {
+ if (component->m_OnMaster || component == thePresentation->GetRoot())
+ loadComponentSlideResources(component, thePresentation, 0, "Master", true);
+ }
return true;
}
@@ -2111,9 +2130,12 @@ struct SXMLLoader : public IAppLoadContext
QVector<element::SElement*> components;
mainPresentation->GetRoot()->findComponents(components);
+ // Load subpresentations of components under master slide
for (int i = 0; i < components.size(); ++i) {
- m_App.getComponentSlideAssets(initialAssets, mainPresentation, components[i], 0);
- m_App.getComponentSlideAssets(initialAssets, mainPresentation, components[i], 1);
+ if (components[i]->m_OnMaster || components[i] == mainPresentation->GetRoot()) {
+ m_App.getComponentSlideAssets(initialAssets, mainPresentation, components[i], 0);
+ m_App.getComponentSlideAssets(initialAssets, mainPresentation, components[i], 1);
+ }
}
if (!delayedLoading || (m_App.m_OrderedAssets.size() > 1 && initialAssets.size() > 0)) {