diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2023-04-20 15:26:09 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2023-06-12 08:39:41 +0000 |
commit | 6652996503ba6e57a660f645b7bcf0df0367cfcb (patch) | |
tree | 69480652f2c047a334e7e691d8a6e3922c970fe2 | |
parent | 0f3a92b45a8a5eda32a600f108a2dc2c028b71a8 (diff) |
QmlDesigner: Fix puppet build after quick3d private API changes
Change-Id: I3668853886306fe00d5da916aa458559964a9af0
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 9817df63fb9eae342d5bf6f28f526aa09b17e8de)
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r-- | src/tools/qml2puppet/qml2puppet/editor3d/generalhelper.cpp | 16 | ||||
-rw-r--r-- | src/tools/qml2puppet/qml2puppet/editor3d/selectionboxgeometry.cpp | 10 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/tools/qml2puppet/qml2puppet/editor3d/generalhelper.cpp b/src/tools/qml2puppet/qml2puppet/editor3d/generalhelper.cpp index 829a6f0edb..52a3f6d74a 100644 --- a/src/tools/qml2puppet/qml2puppet/editor3d/generalhelper.cpp +++ b/src/tools/qml2puppet/qml2puppet/editor3d/generalhelper.cpp @@ -215,6 +215,7 @@ QVector4D GeneralHelper::focusNodesToCamera(QQuick3DCamera *camera, float defaul if (auto renderModel = static_cast<QSSGRenderModel *>(targetPriv->spatialNode)) { QWindow *window = static_cast<QWindow *>(viewPort->window()); if (window) { +#if QT_VERSION < QT_VERSION_CHECK(6, 5, 1) QSSGRef<QSSGRenderContextInterface> context; #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) context = QSSGRenderContextInterface::getRenderContextInterface(quintptr(window)); @@ -222,12 +223,17 @@ QVector4D GeneralHelper::focusNodesToCamera(QQuick3DCamera *camera, float defaul context = targetPriv->sceneManager->rci; #endif if (!context.isNull()) { +#else + const auto &sm = targetPriv->sceneManager; + auto context = sm->wattached ? sm->wattached->rci().get() : nullptr; + if (context) { +#endif QSSGBounds3 bounds; auto geometry = qobject_cast<SelectionBoxGeometry *>(model->geometry()); if (geometry) { bounds = geometry->bounds(); } else { - auto bufferManager = context->bufferManager(); + const auto &bufferManager(context->bufferManager()); #if QT_VERSION < QT_VERSION_CHECK(6, 3, 0) bounds = renderModel->getModelBounds(bufferManager); #else @@ -889,6 +895,7 @@ bool GeneralHelper::getBounds(QQuick3DViewport *view3D, QQuick3DNode *node, QVec if (auto renderModel = static_cast<QSSGRenderModel *>(renderNode)) { QWindow *window = static_cast<QWindow *>(view3D->window()); if (window) { +#if QT_VERSION < QT_VERSION_CHECK(6, 5, 1) QSSGRef<QSSGRenderContextInterface> context; #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) context = QSSGRenderContextInterface::getRenderContextInterface(quintptr(window)); @@ -896,7 +903,12 @@ bool GeneralHelper::getBounds(QQuick3DViewport *view3D, QQuick3DNode *node, QVec context = QQuick3DObjectPrivate::get(node)->sceneManager->rci; #endif if (!context.isNull()) { - auto bufferManager = context->bufferManager(); +#else + const auto &sm = QQuick3DObjectPrivate::get(node)->sceneManager; + auto context = sm->wattached ? sm->wattached->rci().get() : nullptr; + if (context) { +#endif + const auto &bufferManager(context->bufferManager()); #if QT_VERSION < QT_VERSION_CHECK(6, 3, 0) QSSGBounds3 bounds = renderModel->getModelBounds(bufferManager); #else diff --git a/src/tools/qml2puppet/qml2puppet/editor3d/selectionboxgeometry.cpp b/src/tools/qml2puppet/qml2puppet/editor3d/selectionboxgeometry.cpp index f7e2757e60..03f37e8902 100644 --- a/src/tools/qml2puppet/qml2puppet/editor3d/selectionboxgeometry.cpp +++ b/src/tools/qml2puppet/qml2puppet/editor3d/selectionboxgeometry.cpp @@ -287,14 +287,20 @@ void SelectionBoxGeometry::getBounds( if (auto renderModel = static_cast<QSSGRenderModel *>(renderNode)) { QWindow *window = static_cast<QWindow *>(m_view3D->window()); if (window) { +#if QT_VERSION < QT_VERSION_CHECK(6, 5, 1) QSSGRef<QSSGRenderContextInterface> context; #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) context = QSSGRenderContextInterface::getRenderContextInterface(quintptr(window)); -#else +#elif QT_VERSION < QT_VERSION_CHECK(6, 5, 1) context = QQuick3DObjectPrivate::get(this)->sceneManager->rci; #endif if (!context.isNull()) { - auto bufferManager = context->bufferManager(); +#else + const auto &sm = QQuick3DObjectPrivate::get(this)->sceneManager; + auto context = sm->wattached ? sm->wattached->rci().get() : nullptr; + if (context) { +#endif + const auto &bufferManager(context->bufferManager()); #if QT_VERSION < QT_VERSION_CHECK(6, 3, 0) QSSGBounds3 bounds = renderModel->getModelBounds(bufferManager); #else |