summaryrefslogtreecommitdiffstats
path: root/src/render/framegraph/framegraphnode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/framegraph/framegraphnode.cpp')
-rw-r--r--src/render/framegraph/framegraphnode.cpp49
1 files changed, 20 insertions, 29 deletions
diff --git a/src/render/framegraph/framegraphnode.cpp b/src/render/framegraph/framegraphnode.cpp
index 458d96d4b..93531fd7d 100644
--- a/src/render/framegraph/framegraphnode.cpp
+++ b/src/render/framegraph/framegraphnode.cpp
@@ -66,14 +66,6 @@ FrameGraphNode::~FrameGraphNode()
{
}
-void FrameGraphNode::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
-{
- // Set up the parent child relationship and enabled state
- const auto creationChange = qSharedPointerCast<QFrameGraphNodeCreatedChangeBase>(change);
- setParentId(creationChange->parentFrameGraphNodeId());
- markDirty(AbstractRenderer::FrameGraphDirty);
-}
-
void FrameGraphNode::setFrameGraphManager(FrameGraphManager *manager)
{
if (m_manager != manager)
@@ -129,34 +121,33 @@ QVector<FrameGraphNode *> FrameGraphNode::children() const
return children;
}
-void FrameGraphNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+void FrameGraphNode::cleanup()
{
- switch (e->type()) {
-
- case Qt3DCore::PropertyUpdated: {
- Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
- d_func()->m_enabled = propertyChange->value().toBool();
- markDirty(AbstractRenderer::FrameGraphDirty);
- } else if (propertyChange->propertyName() == QByteArrayLiteral("parentFrameGraphUpdated")) {
- auto newParent = propertyChange->value().value<Qt3DCore::QNodeId>();
- setParentId(newParent);
- markDirty(AbstractRenderer::AllDirty);
- }
- break;
- }
- default:
- markDirty(AbstractRenderer::AllDirty);
- break;
- }
+ setParentId({});
}
-void FrameGraphNode::cleanup()
+void FrameGraphNode::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime)
{
- setParentId({});
+ const QFrameGraphNode *node = qobject_cast<const QFrameGraphNode *>(frontEnd);
+
+ const auto parentId = Qt3DCore::qIdForNode(node->parentFrameGraphNode());
+ if (parentId != m_parentId) {
+ setParentId(parentId);
+ // TO DO: Check if FrameGraphDirty wouldn't be enough here
+ markDirty(AbstractRenderer::AllDirty);
+ }
+
+ if (node->isEnabled() != d_func()->m_enabled) {
+ d_func()->m_enabled = node->isEnabled();
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ }
+
+ if (firstTime)
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
+
} // namespace Render
} // namespace Qt3DRender