diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2014-07-15 16:27:54 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2014-07-19 23:19:34 +0200 |
commit | 90e3ebfec5c521acfa2f5aa756d9216a2051d477 (patch) | |
tree | 3100c7b718cc97fec7e7e198af5ada22442d1b9e /src/core/core-components/qabstractmesh.cpp | |
parent | 65061f869f59d579113e153a3753249477dd723e (diff) |
QAbstractMeshFunctor
Each QAbstractMesh class now has to implement a QAbstractMeshFunctor class.
When a mesh is set to dirty, the functor is sent through a QChangeArbiter
notification to the backend. The backend, using the functor can then rebuild
the mesh. There should be no issue if the frontend mesh is deleted while the
backend is creating the mesh as the functor has no direct reference to the
frontend element and contains all the data needed for a complete creation of
the mesh.
Change-Id: I4984f03a612e74c688bfb6cc2f19d9241b517457
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/core/core-components/qabstractmesh.cpp')
-rw-r--r-- | src/core/core-components/qabstractmesh.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/core/core-components/qabstractmesh.cpp b/src/core/core-components/qabstractmesh.cpp index 96694947a..1da8548b0 100644 --- a/src/core/core-components/qabstractmesh.cpp +++ b/src/core/core-components/qabstractmesh.cpp @@ -41,6 +41,7 @@ #include "qabstractmesh.h" #include "qabstractmesh_p.h" +#include <Qt3DCore/qscenepropertychange.h> /*! * \class QAbstractMesh @@ -61,7 +62,7 @@ namespace Qt3D { QAbstractMeshPrivate::QAbstractMeshPrivate(QAbstractMesh *qq) : QComponentPrivate(qq) - , m_dirty(true) + , m_dirty(false) { } @@ -76,12 +77,6 @@ QAbstractMesh::QAbstractMesh(QAbstractMeshPrivate &dd, QNode *parent) { } -void QAbstractMesh::setData(QAbstractMeshDataPtr data) -{ - Q_D(QAbstractMesh); - d->m_data = data; -} - bool QAbstractMesh::isDirty() const { Q_D(const QAbstractMesh); @@ -91,13 +86,17 @@ bool QAbstractMesh::isDirty() const void QAbstractMesh::setDirty(bool dirty) { Q_D(QAbstractMesh); - d->m_dirty = dirty; -} - -QAbstractMeshDataPtr QAbstractMesh::data() const -{ - Q_D(const QAbstractMesh); - return d->m_data; + if (dirty != d->m_dirty) { + d->m_dirty = dirty; + QScenePropertyChangePtr change(new QScenePropertyChange(ComponentUpdated, this)); + change->setPropertyName(QByteArrayLiteral("meshFunctor")); + change->setValue(QVariant::fromValue(meshFunctor())); + notifyObservers(change); + // TO DO see if we can clear the d->m_dirty on request. + // This would allow to send a single notification for classes that have several property changes occur + // over a single given frame + d->m_dirty = false; + } } } // Qt3D |