summaryrefslogtreecommitdiffstats
path: root/src/Runtime
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2019-05-14 11:02:30 +0300
committerJanne Kangas <janne.kangas@qt.io>2019-05-15 10:30:27 +0000
commitcb2f3cad5ca145bea8121c191ad3c5ff02d68e2c (patch)
tree905e334e63cd3269822ccb677b31e1be021f6a1b /src/Runtime
parentc1b1d767146a664c6427af74aac2d4966c9aea0f (diff)
Implement Q3DSSurfaceViewer::presentationReady in OpenGL Runtime
New signal fixes the issue where setAttribute calls triggered at presentationLoaded() were lost as the runtime overrode attribute values with initial values in UIP file. presentationReady signal is triggered when the initial property values are set, and setAttribute can be safely called to update properties. Task-id: QT3DS-3398 Change-Id: Id605ddeb92766da11e0280a276ffc5e36c57b931 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Runtime')
-rw-r--r--src/Runtime/Source/engine/Qt3DSRuntimeView.cpp3
-rw-r--r--src/Runtime/Source/engine/Qt3DSRuntimeView.h1
-rw-r--r--src/Runtime/Source/runtime/Qt3DSPresentation.cpp6
-rw-r--r--src/Runtime/Source/runtime/Qt3DSPresentation.h2
-rw-r--r--src/Runtime/Source/viewer/Qt3DSViewerApp.cpp12
-rw-r--r--src/Runtime/Source/viewer/Qt3DSViewerApp.h2
6 files changed, 24 insertions, 2 deletions
diff --git a/src/Runtime/Source/engine/Qt3DSRuntimeView.cpp b/src/Runtime/Source/engine/Qt3DSRuntimeView.cpp
index e5c0f298..76866245 100644
--- a/src/Runtime/Source/engine/Qt3DSRuntimeView.cpp
+++ b/src/Runtime/Source/engine/Qt3DSRuntimeView.cpp
@@ -310,6 +310,9 @@ bool CRuntimeView::InitializeGraphics(const QSurfaceFormat &format, bool delayed
signalProxy(), &QRuntimeViewSignalProxy::SigSlideExited);
QObject::connect(m_Presentation->signalProxy(), &QPresentationSignalProxy::SigCustomSignal,
signalProxy(), &QRuntimeViewSignalProxy::SigCustomSignal);
+ QObject::connect(m_Presentation->signalProxy(),
+ &QPresentationSignalProxy::SigPresentationReady,
+ signalProxy(), &QRuntimeViewSignalProxy::SigPresentationReady);
QObject::connect(m_Presentation->signalProxy(), &QPresentationSignalProxy::SigElementCreated,
signalProxy(), &QRuntimeViewSignalProxy::SigElementCreated);
QObject::connect(m_Presentation->signalProxy(), &QPresentationSignalProxy::SigMaterialCreated,
diff --git a/src/Runtime/Source/engine/Qt3DSRuntimeView.h b/src/Runtime/Source/engine/Qt3DSRuntimeView.h
index 6dc0487b..f728f220 100644
--- a/src/Runtime/Source/engine/Qt3DSRuntimeView.h
+++ b/src/Runtime/Source/engine/Qt3DSRuntimeView.h
@@ -55,6 +55,7 @@ Q_SIGNALS:
void SigSlideEntered(const QString &elementPath, unsigned int index, const QString &name);
void SigSlideExited(const QString &elementPath, unsigned int index, const QString &name);
void SigCustomSignal(const QString &elementPath, const QString &name);
+ void SigPresentationReady();
void SigElementCreated(const QString &elementName, const QString &error);
void SigMaterialCreated(const QString &name, const QString &error);
};
diff --git a/src/Runtime/Source/runtime/Qt3DSPresentation.cpp b/src/Runtime/Source/runtime/Qt3DSPresentation.cpp
index ea01878c..dd63393d 100644
--- a/src/Runtime/Source/runtime/Qt3DSPresentation.cpp
+++ b/src/Runtime/Source/runtime/Qt3DSPresentation.cpp
@@ -202,6 +202,12 @@ void CPresentation::EndUpdate()
// Animation Track Evaluation Stage
m_AnimationSystem->Update();
}
+ // Presentation is considered ready to accept external commands when the first frame property
+ // updates are done.
+ if (!m_presentationReady) {
+ m_SignalProxy.SigPresentationReady();
+ m_presentationReady = true;
+ }
}
void CPresentation::PostUpdate(const TTimeUnit inGlobalTime)
diff --git a/src/Runtime/Source/runtime/Qt3DSPresentation.h b/src/Runtime/Source/runtime/Qt3DSPresentation.h
index d39c2bf7..ff5656e3 100644
--- a/src/Runtime/Source/runtime/Qt3DSPresentation.h
+++ b/src/Runtime/Source/runtime/Qt3DSPresentation.h
@@ -50,6 +50,7 @@ Q_SIGNALS:
void SigSlideEntered(const QString &elementPath, unsigned int index, const QString &name);
void SigSlideExited(const QString &elementPath, unsigned int index, const QString &name);
void SigCustomSignal(const QString &elementPath, const QString &name);
+ void SigPresentationReady();
void SigElementCreated(const QString &elementName, const QString &error);
void SigMaterialCreated(const QString &name, const QString &error);
};
@@ -108,6 +109,7 @@ protected:
bool m_Paused;
bool m_OffsetInvalid;
bool m_Active;
+ bool m_presentationReady = false;
typedef eastl::hash_map<TElement *, qt3ds::foundation::CRegisteredString> TElemStringMap;
TElemStringMap m_ElementPathMap;
diff --git a/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp b/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp
index 11199efc..a74fb57e 100644
--- a/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp
+++ b/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp
@@ -361,10 +361,18 @@ bool Q3DSViewerApp::InitializeApp(int winWidth, int winHeight, const QSurfaceFor
&Q3DSViewerApp::SigElementCreated);
connect(m_Impl.m_view->signalProxy(), &QRuntimeViewSignalProxy::SigMaterialCreated, this,
&Q3DSViewerApp::SigMaterialCreated);
-
+ QMetaObject::Connection *presReadyconn = new QMetaObject::Connection();
+ *presReadyconn = connect(m_Impl.m_view->signalProxy(),
+ &QRuntimeViewSignalProxy::SigPresentationReady, [&, presReadyconn]{
+ // We receive presentation ready signal from runtime when animations and properties
+ // have been updated.
+ Q_EMIT SigPresentationReady();
+ disconnect(*presReadyconn);
+ delete presReadyconn;
+ });
Resize(winWidth, winHeight);
- Q_EMIT SigPresentationReady();
+ Q_EMIT SigPresentationLoaded();
}
return true;
}
diff --git a/src/Runtime/Source/viewer/Qt3DSViewerApp.h b/src/Runtime/Source/viewer/Qt3DSViewerApp.h
index b0fe9d9d..971bf473 100644
--- a/src/Runtime/Source/viewer/Qt3DSViewerApp.h
+++ b/src/Runtime/Source/viewer/Qt3DSViewerApp.h
@@ -394,6 +394,7 @@ private:
private:
Q3DSViewerAppImpl &m_Impl;
QElapsedTimer *m_startupTimer;
+ bool m_presentationReady = false;
public:
static Q3DSViewerApp &Create(void *glContext, Q3DStudio::IAudioPlayer *inAudioPlayer = nullptr,
@@ -407,6 +408,7 @@ Q_SIGNALS:
void SigElementCreated(const QString &elementName, const QString &error);
void SigMaterialCreated(const QString &name, const QString &error);
void SigPresentationReady();
+ void SigPresentationLoaded();
};
} // end namespace