diff options
author | Liang Qi <liang.qi@qt.io> | 2016-11-24 11:47:42 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-11-24 11:47:42 +0100 |
commit | 4a4b5383e8e2a33db2b95b5540da430df0835125 (patch) | |
tree | 6a1d3498b485657aba2dead6e2b9012ffe7fb8d2 | |
parent | bc218e2fba92368e2c5d8547042d1939481d5e2c (diff) | |
parent | 0eac16fbda846c951f9b3887199e72b66f5aacd7 (diff) |
Merge remote-tracking branch 'origin/5.7.1' into 5.7
Change-Id: Idb141c715c7d06d2ecdce403d0f3740ee18b2b8f
11 files changed, 73 insertions, 43 deletions
diff --git a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp index c82ad7b1d..abbce8663 100644 --- a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp +++ b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp @@ -217,7 +217,7 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri) Qt3DRender::Quick::registerExtendedType<Qt3DRender::QViewport, Qt3DRender::Render::Quick::Quick3DViewport>("QViewport", "Qt3D.Render/Viewport", uri, 2, 0, "Viewport"); Qt3DRender::Quick::registerExtendedType<Qt3DRender::QRenderTargetSelector, Qt3DRender::Render::Quick::Quick3DRenderTargetSelector>("QRenderTargetSelector", "Qt3D.Render/RenderTargetSelector", uri, 2, 0, "RenderTargetSelector"); qmlRegisterType<Qt3DRender::QClearBuffers>(uri, 2, 0, "ClearBuffers"); - qmlRegisterUncreatableType<Qt3DRender::QFrameGraphNode>(uri, 2, 0, "FrameGraphNode", QStringLiteral("FrameGraphNode is a base class")); + qmlRegisterType<Qt3DRender::QFrameGraphNode>(uri, 2, 0, "FrameGraphNode"); Qt3DRender::Quick::registerExtendedType<Qt3DRender::QRenderStateSet, Qt3DRender::Render::Quick::Quick3DStateSet>("QRenderStateSet", "Qt3D.Render/RenderStateSet", uri, 2, 0, "RenderStateSet"); qmlRegisterType<Qt3DRender::QNoDraw>(uri, 2, 0, "NoDraw"); qmlRegisterType<Qt3DRender::QFrustumCulling>(uri, 2, 0, "FrustumCulling"); diff --git a/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp b/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp index 90b6d681a..ce69e471a 100644 --- a/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp +++ b/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp @@ -148,7 +148,7 @@ void Quick3DNodeInstantiatorPrivate::_q_createdItem(int idx, QObject *item) Q_Q(Quick3DNodeInstantiator); if (m_objects.contains(item)) //Case when it was created synchronously in regenerate return; - static_cast<QNode *>(item)->setParent(q); + static_cast<QNode *>(item)->setParent(q->parentNode()); m_objects.insert(idx, item); if (m_objects.count() == 1) q->objectChanged(); diff --git a/src/render/framegraph/qframegraphnode.cpp b/src/render/framegraph/qframegraphnode.cpp index c60c859ac..36a9f737a 100644 --- a/src/render/framegraph/qframegraphnode.cpp +++ b/src/render/framegraph/qframegraphnode.cpp @@ -56,8 +56,10 @@ QFrameGraphNodePrivate::QFrameGraphNodePrivate() \brief Base class of all FrameGraph configuration nodes. - This is an abstract class so it cannot be instanced directly - but rather through one of its subclasses. + This class is rarely instanced directly since it doesn't provide + any frame graph specific behavior, although it can be convenient + to use for grouping other nodes together in dynamic frame graphs. + The actual behavior comes from the subclasses. The subclasses are: \table @@ -112,8 +114,10 @@ QFrameGraphNodePrivate::QFrameGraphNodePrivate() \since 5.5 \brief Base class of all FrameGraph configuration nodes. - This is an abstract class so it cannot be instanced directly - but rather through one of its subclasses. + This class is rarely instanced directly since it doesn't provide + any frame graph specific behavior, although it can be convenient + to use for grouping other nodes together in dynamic frame graphs. + The actual behavior comes from the subclasses. The subclasses are: \table diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp index f6d26fb22..320bfa677 100644 --- a/src/render/frontend/qrenderaspect.cpp +++ b/src/render/frontend/qrenderaspect.cpp @@ -210,6 +210,7 @@ void QRenderAspectPrivate::registerBackendTypes() q->registerBackendType<QTechnique>(QSharedPointer<Render::NodeFunctor<Render::Technique, Render::TechniqueManager> >::create(m_renderer, m_nodeManagers->techniqueManager())); // Framegraph + q->registerBackendType<QFrameGraphNode>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::FrameGraphNode, QFrameGraphNode> >::create(m_renderer, m_nodeManagers->frameGraphManager())); q->registerBackendType<QCameraSelector>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::CameraSelector, QCameraSelector> >::create(m_renderer, m_nodeManagers->frameGraphManager())); q->registerBackendType<QClearBuffers>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::ClearBuffers, QClearBuffers> >::create(m_renderer, m_nodeManagers->frameGraphManager())); q->registerBackendType<QDispatchCompute>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::DispatchCompute, QDispatchCompute> >::create(m_renderer, m_nodeManagers->frameGraphManager())); diff --git a/src/render/jobs/renderviewjobutils.cpp b/src/render/jobs/renderviewjobutils.cpp index 8ffd5ea10..765e5e1de 100644 --- a/src/render/jobs/renderviewjobutils.cpp +++ b/src/render/jobs/renderviewjobutils.cpp @@ -91,6 +91,9 @@ void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, const FrameGraphN FrameGraphNode::FrameGraphNodeType type = node->nodeType(); if (node->isEnabled()) switch (type) { + case FrameGraphNode::InvalidNodeType: + // A base FrameGraphNode, can be used for grouping purposes + break; case FrameGraphNode::CameraSelector: // Can be set only once and we take camera nearest to the leaf node if (!rv->renderCameraLens()) { diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/data/createMultiple.qml b/tests/auto/quick3d/quick3dnodeinstantiator/data/createMultiple.qml index 67c1e4fe7..c1f3b21ed 100644 --- a/tests/auto/quick3d/quick3dnodeinstantiator/data/createMultiple.qml +++ b/tests/auto/quick3d/quick3dnodeinstantiator/data/createMultiple.qml @@ -1,10 +1,12 @@ import QtQml 2.1 import Qt3D.Core 2.0 -NodeInstantiator { - model: 10 - delegate: Entity { - property bool success: true - property int idx: index +Entity { + NodeInstantiator { + model: 10 + delegate: Entity { + property bool success: true + property int idx: index + } } } diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/data/createNone.qml b/tests/auto/quick3d/quick3dnodeinstantiator/data/createNone.qml index 736a02b45..eef31cb8c 100644 --- a/tests/auto/quick3d/quick3dnodeinstantiator/data/createNone.qml +++ b/tests/auto/quick3d/quick3dnodeinstantiator/data/createNone.qml @@ -1,13 +1,15 @@ import QtQml 2.1 import Qt3D.Core 2.0 -NodeInstantiator { - model: 0 - property bool success: true - Entity { +Entity { + NodeInstantiator { + model: 0 property bool success: true - property int idx: index + Entity { + property bool success: true + property int idx: index + } + onObjectChanged: success = false;//Don't create intermediate objects + onCountChanged: success = false;//Don't create intermediate objects } - onObjectChanged: success = false;//Don't create intermediate objects - onCountChanged: success = false;//Don't create intermediate objects } diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/data/createSingle.qml b/tests/auto/quick3d/quick3dnodeinstantiator/data/createSingle.qml index 630da9940..5a79d6105 100644 --- a/tests/auto/quick3d/quick3dnodeinstantiator/data/createSingle.qml +++ b/tests/auto/quick3d/quick3dnodeinstantiator/data/createSingle.qml @@ -1,9 +1,11 @@ import QtQml 2.1 import Qt3D.Core 2.0 -NodeInstantiator { - Entity { - property bool success: true - property int idx: index +Entity { + NodeInstantiator { + Entity { + property bool success: true + property int idx: index + } } } diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/data/inactive.qml b/tests/auto/quick3d/quick3dnodeinstantiator/data/inactive.qml index 178229059..8ae6994db 100644 --- a/tests/auto/quick3d/quick3dnodeinstantiator/data/inactive.qml +++ b/tests/auto/quick3d/quick3dnodeinstantiator/data/inactive.qml @@ -1,10 +1,12 @@ import QtQml 2.1 import Qt3D.Core 2.0 -NodeInstantiator { - active: false - Entity { - property bool success: true - property int idx: index +Entity { + NodeInstantiator { + active: false + Entity { + property bool success: true + property int idx: index + } } } diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/data/stringModel.qml b/tests/auto/quick3d/quick3dnodeinstantiator/data/stringModel.qml index 431c1ebd8..5aa4d399a 100644 --- a/tests/auto/quick3d/quick3dnodeinstantiator/data/stringModel.qml +++ b/tests/auto/quick3d/quick3dnodeinstantiator/data/stringModel.qml @@ -1,10 +1,12 @@ import QtQml 2.1 import Qt3D.Core 2.0 -NodeInstantiator { - model: ["alpha", "beta", "gamma", "delta"] - delegate: Entity { - property bool success: index == 1 ? datum.length == 4 : datum.length == 5 - property string datum: modelData +Entity { + NodeInstantiator { + model: ["alpha", "beta", "gamma", "delta"] + delegate: Entity { + property bool success: index == 1 ? datum.length == 4 : datum.length == 5 + property string datum: modelData + } } } diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp b/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp index fd7f0eb0c..acaba6690 100644 --- a/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp +++ b/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp @@ -60,7 +60,9 @@ void tst_quick3dnodeinstantiator::createNone() { QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("createNone.qml")); - Quick3DNodeInstantiator *instantiator = qobject_cast<Quick3DNodeInstantiator*>(component.create()); + const auto root = qobject_cast<Qt3DCore::QNode*>(component.create()); + QVERIFY(root != 0); + const auto instantiator = root->findChild<Quick3DNodeInstantiator*>(); QVERIFY(instantiator != 0); QCOMPARE(instantiator->isActive(), true); QCOMPARE(instantiator->count(), 0); @@ -72,7 +74,9 @@ void tst_quick3dnodeinstantiator::createSingle() { QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("createSingle.qml")); - Quick3DNodeInstantiator *instantiator = qobject_cast<Quick3DNodeInstantiator*>(component.create()); + const auto root = qobject_cast<Qt3DCore::QNode*>(component.create()); + QVERIFY(root != 0); + const auto instantiator = root->findChild<Quick3DNodeInstantiator*>(); QVERIFY(instantiator != 0); QCOMPARE(instantiator->isActive(), true); QCOMPARE(instantiator->count(), 1); @@ -80,7 +84,7 @@ void tst_quick3dnodeinstantiator::createSingle() QObject *object = instantiator->object(); QVERIFY(object); - QCOMPARE(object->parent(), instantiator); + QCOMPARE(object->parent(), root); QCOMPARE(object->property("success").toBool(), true); QCOMPARE(object->property("idx").toInt(), 0); } @@ -89,7 +93,9 @@ void tst_quick3dnodeinstantiator::createMultiple() { QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("createMultiple.qml")); - Quick3DNodeInstantiator *instantiator = qobject_cast<Quick3DNodeInstantiator*>(component.create()); + const auto root = qobject_cast<Qt3DCore::QNode*>(component.create()); + QVERIFY(root != 0); + const auto instantiator = root->findChild<Quick3DNodeInstantiator*>(); QVERIFY(instantiator != 0); QCOMPARE(instantiator->isActive(), true); QCOMPARE(instantiator->count(), 10); @@ -97,7 +103,7 @@ void tst_quick3dnodeinstantiator::createMultiple() for (int i = 0; i < 10; i++) { QObject *object = instantiator->objectAt(i); QVERIFY(object); - QCOMPARE(object->parent(), instantiator); + QCOMPARE(object->parent(), root); QCOMPARE(object->property("success").toBool(), true); QCOMPARE(object->property("idx").toInt(), i); } @@ -107,7 +113,9 @@ void tst_quick3dnodeinstantiator::stringModel() { QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("stringModel.qml")); - Quick3DNodeInstantiator *instantiator = qobject_cast<Quick3DNodeInstantiator*>(component.create()); + const auto root = qobject_cast<Qt3DCore::QNode*>(component.create()); + QVERIFY(root != 0); + const auto instantiator = root->findChild<Quick3DNodeInstantiator*>(); QVERIFY(instantiator != 0); QCOMPARE(instantiator->isActive(), true); QCOMPARE(instantiator->count(), 4); @@ -115,7 +123,7 @@ void tst_quick3dnodeinstantiator::stringModel() for (int i = 0; i < 4; i++) { QObject *object = instantiator->objectAt(i); QVERIFY(object); - QCOMPARE(object->parent(), instantiator); + QCOMPARE(object->parent(), root); QCOMPARE(object->property("success").toBool(), true); } } @@ -124,7 +132,9 @@ void tst_quick3dnodeinstantiator::activeProperty() { QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("inactive.qml")); - Quick3DNodeInstantiator *instantiator = qobject_cast<Quick3DNodeInstantiator*>(component.create()); + const auto root = qobject_cast<Qt3DCore::QNode*>(component.create()); + QVERIFY(root != 0); + const auto instantiator = root->findChild<Quick3DNodeInstantiator*>(); QVERIFY(instantiator != 0); QSignalSpy activeSpy(instantiator, SIGNAL(activeChanged())); QSignalSpy countSpy(instantiator, SIGNAL(countChanged())); @@ -150,7 +160,7 @@ void tst_quick3dnodeinstantiator::activeProperty() QObject *object = instantiator->object(); QVERIFY(object); - QCOMPARE(object->parent(), instantiator); + QCOMPARE(object->parent(), root); QCOMPARE(object->property("success").toBool(), true); QCOMPARE(object->property("idx").toInt(), 0); } @@ -159,7 +169,9 @@ void tst_quick3dnodeinstantiator::intModelChange() { QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("createMultiple.qml")); - Quick3DNodeInstantiator *instantiator = qobject_cast<Quick3DNodeInstantiator*>(component.create()); + const auto root = qobject_cast<Qt3DCore::QNode*>(component.create()); + QVERIFY(root != 0); + const auto instantiator = root->findChild<Quick3DNodeInstantiator*>(); QVERIFY(instantiator != 0); QSignalSpy activeSpy(instantiator, SIGNAL(activeChanged())); QSignalSpy countSpy(instantiator, SIGNAL(countChanged())); @@ -183,7 +195,7 @@ void tst_quick3dnodeinstantiator::intModelChange() for (int i = 0; i < 2; i++) { QObject *object = instantiator->objectAt(i); QVERIFY(object); - QCOMPARE(object->parent(), instantiator); + QCOMPARE(object->parent(), root); QCOMPARE(object->property("success").toBool(), true); QCOMPARE(object->property("idx").toInt(), i); } |