diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2022-01-25 15:31:32 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2022-01-28 09:00:57 +0000 |
commit | 557489c3fcb930885f9129cdd76047de1852b4da (patch) | |
tree | 73a7ad6c159faab352763274b9a25cddacf8dfc6 | |
parent | 35d32c9784355a694a84c9da6e886b75d4edc270 (diff) | |
download | qt-creator-557489c3fcb930885f9129cdd76047de1852b4da.tar.gz |
QmlDesigner: Fix camera frustum initialization for Qt5 builds
In Qt5 builds, we need additional async update at camera geometry
initialization to ensure source camera is up to date and frustum mesh
can be constructed.
Fixes: QDS-6071
Change-Id: I41371ae66fde432b0fdf4b5fee6a0604d005bf63
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp | 10 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp index 4260921a37..046dc48606 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp @@ -142,6 +142,16 @@ void CameraGeometry::doUpdateGeometry() if (!QQuick3DObjectPrivate::get(m_camera)->spatialNode) { // Doing explicit viewport mapping forces cameraNode creation m_camera->mapToViewport({}, m_viewPortRect.width(), m_viewPortRect.height()); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + if (!m_nodeCreationUpdateDone) { + // Post-node creation update is done only once to avoid infinite loop in case the node + // creation fails. + m_nodeCreationUpdateDone = true; + m_cameraUpdatePending = true; + update(); + return; + } +#endif } GeometryBase::doUpdateGeometry(); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h index 5b4fa66fe4..c65b0d1798 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h @@ -67,6 +67,9 @@ private: QQuick3DCamera *m_camera = nullptr; QRectF m_viewPortRect; bool m_cameraUpdatePending = false; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + bool m_nodeCreationUpdateDone = false; +#endif }; } |