summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/render/framegraph/qtechniquefilter.cpp28
-rw-r--r--src/render/framegraph/techniquefilternode.cpp10
-rw-r--r--src/render/framegraph/techniquefilternode_p.h2
3 files changed, 22 insertions, 18 deletions
diff --git a/src/render/framegraph/qtechniquefilter.cpp b/src/render/framegraph/qtechniquefilter.cpp
index e2dd7c081..37fad6f70 100644
--- a/src/render/framegraph/qtechniquefilter.cpp
+++ b/src/render/framegraph/qtechniquefilter.cpp
@@ -63,6 +63,8 @@ void QTechniqueFilter::copy(const QNode *ref)
Q_FOREACH (QAnnotation *crit, other->d_func()->m_requireList)
addRequirement(qobject_cast<QAnnotation *>(QNode::clone(crit)));
+ Q_FOREACH (QParameter *p, other->d_func()->m_parameters)
+ addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
}
QTechniqueFilter::QTechniqueFilter(QNode *parent)
@@ -90,20 +92,22 @@ QList<QAnnotation *> QTechniqueFilter::criteria() const
void QTechniqueFilter::addRequirement(QAnnotation *criterion)
{
Q_D(QTechniqueFilter);
- d->m_requireList.append(criterion);
+ if (!d->m_requireList.contains(criterion)) {
+ d->m_requireList.append(criterion);
- // We need to add it as a child of the current node if it has been declared inline
- // Or not previously added as a child of the current node so that
- // 1) The backend gets notified about it's creation
- // 2) When the current node is destroyed, it gets destroyed as well
- if (!criterion->parent())
- criterion->setParent(this);
+ // We need to add it as a child of the current node if it has been declared inline
+ // Or not previously added as a child of the current node so that
+ // 1) The backend gets notified about it's creation
+ // 2) When the current node is destroyed, it gets destroyed as well
+ if (!criterion->parent())
+ criterion->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- propertyChange->setPropertyName("require");
- propertyChange->setValue(QVariant::fromValue(criterion));
- d->notifyObservers(propertyChange);
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ propertyChange->setPropertyName("require");
+ propertyChange->setValue(QVariant::fromValue(criterion->id()));
+ d->notifyObservers(propertyChange);
+ }
}
}
diff --git a/src/render/framegraph/techniquefilternode.cpp b/src/render/framegraph/techniquefilternode.cpp
index 9ec764415..7e8ac5723 100644
--- a/src/render/framegraph/techniquefilternode.cpp
+++ b/src/render/framegraph/techniquefilternode.cpp
@@ -59,7 +59,7 @@ void TechniqueFilter::updateFromPeer(Qt3DCore::QNode *peer)
m_filters.clear();
m_parameterPack.clear();
Q_FOREACH (QAnnotation *criterion, filter->criteria())
- appendFilter(criterion);
+ appendFilter(criterion->id());
Q_FOREACH (QParameter *p, filter->parameters())
m_parameterPack.appendParameter(p->id());
setEnabled(filter->isEnabled());
@@ -75,10 +75,10 @@ QList<Qt3DCore::QNodeId> TechniqueFilter::filters() const
return m_filters;
}
-void TechniqueFilter::appendFilter(QAnnotation *criterion)
+void TechniqueFilter::appendFilter(const QNodeId &criterionId)
{
- if (!m_filters.contains(criterion->id()))
- m_filters.append(criterion->id());
+ if (!m_filters.contains(criterionId))
+ m_filters.append(criterionId);
}
void TechniqueFilter::removeFilter(const Qt3DCore::QNodeId &criterionId)
@@ -99,7 +99,7 @@ void TechniqueFilter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
case NodeAdded: {
if (propertyChange->propertyName() == QByteArrayLiteral("require"))
- appendFilter(propertyChange->value().value<QAnnotation *>());
+ appendFilter(propertyChange->value().value<QNodeId>());
else if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
m_parameterPack.appendParameter(propertyChange->value().value<QNodeId>());
}
diff --git a/src/render/framegraph/techniquefilternode_p.h b/src/render/framegraph/techniquefilternode_p.h
index 59ffb9572..59688a557 100644
--- a/src/render/framegraph/techniquefilternode_p.h
+++ b/src/render/framegraph/techniquefilternode_p.h
@@ -80,7 +80,7 @@ public:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
- void appendFilter(QAnnotation *criterion);
+ void appendFilter(const Qt3DCore::QNodeId &criterionId);
void removeFilter(const Qt3DCore::QNodeId &criterionId);
QList<Qt3DCore::QNodeId> m_filters;