diff options
author | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2020-03-18 16:00:48 +0200 |
---|---|---|
committer | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2020-03-26 16:17:26 +0200 |
commit | c75ea919bf696a81e00857f1345ce0b2f7c81cd7 (patch) | |
tree | a251b5d23a8f97ea9e2753119a2df323fd584f09 | |
parent | aac88d209f4af370e77ec8fc509b70900453a7d5 (diff) |
Delayed loading: Load subpresentation with setAttribute
Trigger a load when changing the subpresentation attribute of
a material. Also add the subpresentation to the activity list.
Task-number: QT3DS-4090
Change-Id: Ief5c819bcf5cdf94702ba96e71491c8c898d02a6
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/runtime/Qt3DSApplication.cpp | 13 | ||||
-rw-r--r-- | src/runtime/Qt3DSQmlElementHelper.cpp | 7 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/runtime/Qt3DSApplication.cpp b/src/runtime/Qt3DSApplication.cpp index c597802..1abc903 100644 --- a/src/runtime/Qt3DSApplication.cpp +++ b/src/runtime/Qt3DSApplication.cpp @@ -1950,8 +1950,19 @@ struct SApp : public IApplication if (iter != m_AssetMap.end() && iter->second->getType() == AssetValueTypes::Presentation) { CPresentation *ret = iter->second->getData<SPresentationAsset>().m_Presentation; - if (!ret && load) + if (!ret && load) { AssetHandlers::handlePresentation(*this, *iter->second); + SPresentationAsset &thePresentationAsset + = *iter->second->getDataPtr<SPresentationAsset>(); + CPresentation *thePresentation = thePresentationAsset.m_Presentation; + if (thePresentation) { + QT3DS_PERF_SCOPED_TIMER(m_CoreFactory->GetPerfTimer(), + "Application: SetActivityZone") + thePresentation->SetActivityZone( + &m_ActivityZoneManager->CreateActivityZone(*thePresentation)); + thePresentation->SetActive(thePresentationAsset.m_Active); + } + } return iter->second->getData<SPresentationAsset>().m_Presentation; } } diff --git a/src/runtime/Qt3DSQmlElementHelper.cpp b/src/runtime/Qt3DSQmlElementHelper.cpp index 0becf4f..77196ae 100644 --- a/src/runtime/Qt3DSQmlElementHelper.cpp +++ b/src/runtime/Qt3DSQmlElementHelper.cpp @@ -325,6 +325,13 @@ bool CQmlElementHelper::SetAttribute(TElement *theElement, const char *theAttNam else return false; + if (attributeAndValue.attribute.m_Hash == Q3DStudio::ATTRIBUTE_SUBPRESENTATION) { + auto presentation = theElement->GetBelongedPresentation(); + auto stringValue = presentation->GetStringTable().HandleToStr( + attributeAndValue.value.m_StringHandle); + presentation->GetApplication().LoadAndGetPresentationById(stringValue.c_str()); + } + return true; } |