diff options
author | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2020-05-06 09:59:31 +0300 |
---|---|---|
committer | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2020-05-08 14:17:35 +0300 |
commit | 74a1bf8d89eb3a62e0803264cea14568e83dc690 (patch) | |
tree | 470d1561b60e7d1f61f6f890a5143443a05bb414 | |
parent | c179b9602ecd003c306803b757fd44203e584405 (diff) |
Fix data inputs with delayed loadingv2.7.0-rc2
Initialize data inputs and outputs every time a presentation is loaded.
Task-number: QT3DS-4105
Change-Id: If2e9a6d95cc40109cb48f4d4d8b5dc88f963fb74
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
-rw-r--r-- | src/runtime/Qt3DSApplication.cpp | 4 | ||||
-rw-r--r-- | src/runtime/Qt3DSIScriptBridge.h | 1 | ||||
-rw-r--r-- | src/runtime/Qt3DSQmlEngine.cpp | 13 |
3 files changed, 18 insertions, 0 deletions
diff --git a/src/runtime/Qt3DSApplication.cpp b/src/runtime/Qt3DSApplication.cpp index f12fef9..7b4d625 100644 --- a/src/runtime/Qt3DSApplication.cpp +++ b/src/runtime/Qt3DSApplication.cpp @@ -2277,6 +2277,10 @@ bool AssetHandlers::handlePresentation(SApp &app, SAssetValue &asset, bool initI thePathStr.c_str()); return false; } + + app.GetRuntimeFactory().GetScriptEngineQml() + .initializePresentationDataInputsAndOutputs(*thePresentationAsset.m_Presentation); + return true; } diff --git a/src/runtime/Qt3DSIScriptBridge.h b/src/runtime/Qt3DSIScriptBridge.h index 9eedfc5..cb13fb2 100644 --- a/src/runtime/Qt3DSIScriptBridge.h +++ b/src/runtime/Qt3DSIScriptBridge.h @@ -202,6 +202,7 @@ public: // Components public: // Presentation virtual void SetPresentationAttribute(const char *presId, const char *attName, const char *attValue) = 0; + virtual void initializePresentationDataInputsAndOutputs(CPresentation &presentation) = 0; public: // Multimedia virtual bool PlaySoundFile(const char *soundPath) = 0; diff --git a/src/runtime/Qt3DSQmlEngine.cpp b/src/runtime/Qt3DSQmlEngine.cpp index d063e5e..994f6c1 100644 --- a/src/runtime/Qt3DSQmlEngine.cpp +++ b/src/runtime/Qt3DSQmlEngine.cpp @@ -460,6 +460,7 @@ public: void GotoSlideRelative(const char *, bool, bool, const SScriptEngineGotoSlideArgs &) override; void SetPresentationAttribute(const char *, const char *, const char *) override; + void initializePresentationDataInputsAndOutputs(CPresentation &presentation); // No need to implement here, as sound playing is done in Qt3DSViewerApp bool PlaySoundFile(const char *) override { return false; } @@ -1917,6 +1918,12 @@ void CQmlEngineImpl::SetPresentationAttribute(const char *presId, const char *, } } +void CQmlEngineImpl::initializePresentationDataInputsAndOutputs(CPresentation &presentation) +{ + initializeDataInputsInPresentation(presentation, false); + initializeDataOutputsInPresentation(presentation, false); +} + void CQmlEngineImpl::GotoSlideIndex(const char *component, const Q3DStudio::INT32 slideIndex, const SScriptEngineGotoSlideArgs &inArgs) { @@ -2135,6 +2142,9 @@ void CQmlEngineImpl::initializeDataInputsInPresentation(CPresentation &presentat bool isPrimary, bool isDynamicAdd, QList<TElement *> inElements) { + if (!m_Application) + return; + QList<TElement *> elements; if (!inElements.empty()) { elements = inElements; @@ -2310,6 +2320,9 @@ void CQmlEngineImpl::initializeDataInputsInPresentation(CPresentation &presentat void CQmlEngineImpl::initializeDataOutputsInPresentation(CPresentation &presentation, bool isPrimary) { + if (!m_Application) + return; + TElement *parent = presentation.GetRoot(); QList<TElement *> elements; listAllElements(parent, elements); |