class QQuickShaderEffectMaterialObject : public QObject, public QQuickShaderEffectMaterial { };
+void QQuickCustomParticle::sceneGraphInvalidated()
+{
+ m_nodes.clear();
+ m_rootNode = 0;
+}
+
QQuickCustomParticle::~QQuickCustomParticle()
{
if (m_material)
QQuickShaderEffectNode *buildCustomNodes();
void performPendingResize();
+ void sceneGraphInvalidated();
+
private:
void buildData();
return QQmlListProperty<QQuickSprite>(this, &m_sprites, spriteAppend, spriteCount, spriteAt, spriteClear);
}
+void QQuickImageParticle::sceneGraphInvalidated()
+{
+ m_nodes.clear();
+ m_rootNode = 0;
+ m_material = 0;
+}
+
void QQuickImageParticle::setImage(const QUrl &image)
{
if (image.isEmpty()){
void prepareNextFrame();
void buildParticleNodes();
+ void sceneGraphInvalidated();
+
private slots:
void createEngine(); //### method invoked by sprite list changing (in engine.h) - pretty nasty
****************************************************************************/
#include "qquickparticlepainter_p.h"
+#include <QQuickCanvas>
#include <QDebug>
QT_BEGIN_NAMESPACE
/*!
*/
QQuickParticlePainter::QQuickParticlePainter(QQuickItem *parent) :
QQuickItem(parent),
- m_system(0), m_count(0), m_pleaseReset(true)
+ m_system(0), m_count(0), m_pleaseReset(true), m_canvas(0)
{
}
+void QQuickParticlePainter::itemChange(ItemChange change, const ItemChangeData &data)
+{
+ if (change == QQuickItem::ItemSceneChange) {
+ if (m_canvas)
+ disconnect(m_canvas, SIGNAL(sceneGraphInvalidated()), this, SLOT(sceneGraphInvalidated()));
+ m_canvas = data.canvas;
+ if (m_canvas)
+ connect(m_canvas, SIGNAL(sceneGraphInvalidated()), this, SLOT(sceneGraphInvalidated()), Qt::DirectConnection);
+
+ }
+}
+
void QQuickParticlePainter::componentComplete()
{
if (!m_system && qobject_cast<QQuickParticleSystem*>(parentItem()))
return m_groups;
}
+ void itemChange(ItemChange, const ItemChangeData &);
+
signals:
void countChanged();
void systemChanged(QQuickParticleSystem* arg);
void calcSystemOffset(bool resetPending = false);
+private slots:
+ virtual void sceneGraphInvalidated() {}
+
protected:
/* Reset resets all your internal data structures. But anything attached to a particle should
be in attached data. So reset + reloads should have no visible effect.
QStringList m_groups;
QPointF m_systemOffset;
+ QQuickCanvas *m_canvas;
+
private:
QSet<QPair<int,int> > m_pendingCommits;
};