summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-03-16 08:15:14 +0100
committerSean Harmer <sean.harmer@kdab.com>2015-04-25 11:34:29 +0000
commitfb5816c2760c45f9ed3c58ac263f6d47cdacc6ca (patch)
tree04d784ce932903d1da1a1e865317176a8865b1db
parent8c692dd5d17b7dd7877dec021440549dbf4d1a43 (diff)
QFrameGraphNode copy takes care of copying FrameGraphNode children
This avoids having each QFrameGraphNode subclass do a clone of the children in their copy methods. Change-Id: I2e1ef2b924a3e2a9eb7b90b69711162493dea89f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/render/frontend/framegraph-components/qcameraselector.cpp2
-rw-r--r--src/render/frontend/framegraph-components/qclearbuffer.cpp3
-rw-r--r--src/render/frontend/framegraph-components/qframegraphnode.cpp4
-rw-r--r--src/render/frontend/framegraph-components/qframegraphselector.cpp3
-rw-r--r--src/render/frontend/framegraph-components/qlayerfilter.cpp2
-rw-r--r--src/render/frontend/framegraph-components/qrenderpassfilter.cpp2
-rw-r--r--src/render/frontend/framegraph-components/qrendertargetselector.cpp2
-rw-r--r--src/render/frontend/framegraph-components/qstateset.cpp2
-rw-r--r--src/render/frontend/framegraph-components/qtechniquefilter.cpp3
-rw-r--r--src/render/frontend/framegraph-components/qviewport.cpp2
10 files changed, 5 insertions, 20 deletions
diff --git a/src/render/frontend/framegraph-components/qcameraselector.cpp b/src/render/frontend/framegraph-components/qcameraselector.cpp
index e679d6b8f..695ec37d2 100644
--- a/src/render/frontend/framegraph-components/qcameraselector.cpp
+++ b/src/render/frontend/framegraph-components/qcameraselector.cpp
@@ -67,8 +67,6 @@ void QCameraSelector::copy(const QNode *ref)
{
QFrameGraphNode::copy(ref);
const QCameraSelector *other = static_cast<const QCameraSelector*>(ref);
- Q_FOREACH (QFrameGraphNode *fgChild, other->d_func()->m_fgChildren)
- appendFrameGraphNode(qobject_cast<QFrameGraphNode *>(QNode::clone(fgChild)));
if (other->d_func()->m_camera)
setCamera(qobject_cast<QEntity *>(QNode::clone(other->d_func()->m_camera)));
diff --git a/src/render/frontend/framegraph-components/qclearbuffer.cpp b/src/render/frontend/framegraph-components/qclearbuffer.cpp
index 41a069551..f1e6ddb85 100644
--- a/src/render/frontend/framegraph-components/qclearbuffer.cpp
+++ b/src/render/frontend/framegraph-components/qclearbuffer.cpp
@@ -57,9 +57,6 @@ void QClearBuffer::copy(const QNode *ref)
QFrameGraphNode::copy(ref);
const QClearBuffer *b = static_cast<const QClearBuffer*>(ref);
d_func()->m_buffersType = b->d_func()->m_buffersType;
-
- Q_FOREACH (QFrameGraphNode *fgChild, b->d_func()->m_fgChildren)
- appendFrameGraphNode(qobject_cast<QFrameGraphNode *>(QNode::clone(fgChild)));
}
QClearBuffer::QClearBuffer(QNode *parent)
diff --git a/src/render/frontend/framegraph-components/qframegraphnode.cpp b/src/render/frontend/framegraph-components/qframegraphnode.cpp
index 7bf379b4b..d3cf5f835 100644
--- a/src/render/frontend/framegraph-components/qframegraphnode.cpp
+++ b/src/render/frontend/framegraph-components/qframegraphnode.cpp
@@ -65,6 +65,10 @@ QFrameGraphNodePrivate::QFrameGraphNodePrivate(QFrameGraphNode *qq)
void QFrameGraphNode::copy(const QNode *ref)
{
QNode::copy(ref);
+ const QFrameGraphNode *refNode = static_cast<const QFrameGraphNode *>(ref);
+ Q_FOREACH (QFrameGraphNode *fgChild, refNode->d_func()->m_fgChildren)
+ appendFrameGraphNode(qobject_cast<QFrameGraphNode *>(QNode::clone(fgChild)));
+
}
QFrameGraphNode::QFrameGraphNode(QNode *parent)
diff --git a/src/render/frontend/framegraph-components/qframegraphselector.cpp b/src/render/frontend/framegraph-components/qframegraphselector.cpp
index 84f88dff7..75e30decd 100644
--- a/src/render/frontend/framegraph-components/qframegraphselector.cpp
+++ b/src/render/frontend/framegraph-components/qframegraphselector.cpp
@@ -95,9 +95,6 @@ void QFrameGraphSelector::setSelectionFunctor(QFrameGraphSelectorFunctorPtr func
void QFrameGraphSelector::copy(const QNode *ref)
{
QFrameGraphNode::copy(ref);
- const QFrameGraphSelector *other = static_cast<const QFrameGraphSelector*>(ref);
- Q_FOREACH (QFrameGraphNode *fgChild, other->d_func()->m_fgChildren)
- appendFrameGraphNode(qobject_cast<QFrameGraphNode *>(QNode::clone(fgChild)));
}
} // Qt3D
diff --git a/src/render/frontend/framegraph-components/qlayerfilter.cpp b/src/render/frontend/framegraph-components/qlayerfilter.cpp
index 838aca131..a883769bc 100644
--- a/src/render/frontend/framegraph-components/qlayerfilter.cpp
+++ b/src/render/frontend/framegraph-components/qlayerfilter.cpp
@@ -56,8 +56,6 @@ void QLayerFilter::copy(const QNode *ref)
QFrameGraphNode::copy(ref);
const QLayerFilter *layer = static_cast<const QLayerFilter*>(ref);
d_func()->m_layers = layer->d_func()->m_layers;
- Q_FOREACH (QFrameGraphNode *fgChild, layer->d_func()->m_fgChildren)
- appendFrameGraphNode(qobject_cast<QFrameGraphNode *>(QNode::clone(fgChild)));
}
QLayerFilter::QLayerFilter(QNode *parent)
diff --git a/src/render/frontend/framegraph-components/qrenderpassfilter.cpp b/src/render/frontend/framegraph-components/qrenderpassfilter.cpp
index 442233f0c..53f422479 100644
--- a/src/render/frontend/framegraph-components/qrenderpassfilter.cpp
+++ b/src/render/frontend/framegraph-components/qrenderpassfilter.cpp
@@ -103,8 +103,6 @@ void QRenderPassFilter::copy(const QNode *ref)
{
QFrameGraphNode::copy(ref);
const QRenderPassFilter *other = static_cast<const QRenderPassFilter*>(ref);
- Q_FOREACH (QFrameGraphNode *fgChild, other->d_func()->m_fgChildren)
- appendFrameGraphNode(qobject_cast<QFrameGraphNode *>(QNode::clone(fgChild)));
Q_FOREACH (QAnnotation *c, other->d_func()->m_includeList)
addInclude(qobject_cast<QAnnotation *>(QNode::clone(c)));
}
diff --git a/src/render/frontend/framegraph-components/qrendertargetselector.cpp b/src/render/frontend/framegraph-components/qrendertargetselector.cpp
index 3307d4879..644dd4137 100644
--- a/src/render/frontend/framegraph-components/qrendertargetselector.cpp
+++ b/src/render/frontend/framegraph-components/qrendertargetselector.cpp
@@ -59,8 +59,6 @@ void QRenderTargetSelector::copy(const QNode *ref)
QFrameGraphNode::copy(ref);
const QRenderTargetSelector *other = static_cast<const QRenderTargetSelector*>(ref);
- Q_FOREACH (QFrameGraphNode *fgChild, other->d_func()->m_fgChildren)
- appendFrameGraphNode(qobject_cast<QFrameGraphNode *>(QNode::clone(fgChild)));
if (other->d_func()->m_target)
setTarget(qobject_cast<QRenderTarget *>(QNode::clone(other->d_func()->m_target)));
diff --git a/src/render/frontend/framegraph-components/qstateset.cpp b/src/render/frontend/framegraph-components/qstateset.cpp
index b90b459c0..166946ec5 100644
--- a/src/render/frontend/framegraph-components/qstateset.cpp
+++ b/src/render/frontend/framegraph-components/qstateset.cpp
@@ -83,8 +83,6 @@ void QStateSet::copy(const QNode *ref)
QFrameGraphNode::copy(ref);
const QStateSet *other = static_cast<const QStateSet*>(ref);
- Q_FOREACH (QFrameGraphNode *fgChild, other->d_func()->m_fgChildren)
- appendFrameGraphNode(qobject_cast<QFrameGraphNode *>(QNode::clone(fgChild)));
Q_FOREACH (QRenderState *renderState, other->d_func()->m_renderStates)
addRenderState(qobject_cast<QRenderState *>(QNode::clone(renderState)));
}
diff --git a/src/render/frontend/framegraph-components/qtechniquefilter.cpp b/src/render/frontend/framegraph-components/qtechniquefilter.cpp
index 2e625988a..70984bd0d 100644
--- a/src/render/frontend/framegraph-components/qtechniquefilter.cpp
+++ b/src/render/frontend/framegraph-components/qtechniquefilter.cpp
@@ -57,8 +57,7 @@ void QTechniqueFilter::copy(const QNode *ref)
{
QFrameGraphNode::copy(ref);
const QTechniqueFilter *other = static_cast<const QTechniqueFilter*>(ref);
- Q_FOREACH (QFrameGraphNode *fgChild, other->d_func()->m_fgChildren)
- appendFrameGraphNode(qobject_cast<QFrameGraphNode *>(QNode::clone(fgChild)));
+
Q_FOREACH (QAnnotation *crit, other->d_func()->m_requireList)
addRequirement(qobject_cast<QAnnotation *>(QNode::clone(crit)));
}
diff --git a/src/render/frontend/framegraph-components/qviewport.cpp b/src/render/frontend/framegraph-components/qviewport.cpp
index fda834176..28dd3e618 100644
--- a/src/render/frontend/framegraph-components/qviewport.cpp
+++ b/src/render/frontend/framegraph-components/qviewport.cpp
@@ -57,8 +57,6 @@ void QViewport::copy(const QNode *ref)
QFrameGraphNode::copy(ref);
const QViewport *viewport = static_cast<const QViewport*>(ref);
d_func()->m_rect = viewport->d_func()->m_rect;
- Q_FOREACH (QFrameGraphNode *fgChild, viewport->d_func()->m_fgChildren)
- appendFrameGraphNode(qobject_cast<QFrameGraphNode *>(QNode::clone(fgChild)));
}
QViewport::QViewport(QNode *parent)