void QSGParticleAffector::componentComplete()
{
+ if(!m_system && qobject_cast<QSGParticleSystem*>(parentItem()))
+ setSystem(qobject_cast<QSGParticleSystem*>(parentItem()));
if(!m_system)
qWarning() << "Affector created without a particle system specified";//TODO: useful QML warnings, like line number?
QSGItem::componentComplete();
void QSGParticleEmitter::componentComplete()
{
+ if(!m_system && qobject_cast<QSGParticleSystem*>(parentItem()))
+ setSystem(qobject_cast<QSGParticleSystem*>(parentItem()));
if(!m_system)
qWarning() << "Emitter created without a particle system specified";//TODO: useful QML warnings, like line number?
QSGItem::componentComplete();
void QSGParticlePainter::componentComplete()
{
+ if(!m_system && qobject_cast<QSGParticleSystem*>(parentItem()))
+ setSystem(qobject_cast<QSGParticleSystem*>(parentItem()));
if(!m_system)
- qWarning() << "Particle created without a particle system specified";//TODO: useful QML warnings, like line number?
+ qWarning() << "ParticlePainter created without a particle system specified";//TODO: useful QML warnings, like line number?
QSGItem::componentComplete();
}
}
QSGParticleSystem::QSGParticleSystem(QSGItem *parent) :
- QSGItem(parent), m_particle_count(0), m_running(true) , m_startTime(0), m_overwrite(false)
+ QSGItem(parent), m_particle_count(0), m_running(true)
+ , m_startTime(0), m_overwrite(false)
+ , m_componentComplete(false)
{
m_groupIds = QHash<QString, int>();
}
void QSGParticleSystem::componentComplete()
{
QSGItem::componentComplete();
- reset();
+ m_componentComplete = true;
+ if(!m_emitters.isEmpty() && !m_particles.isEmpty())
+ reset();
}
void QSGParticleSystem::initializeSystem()
void QSGParticleSystem::reset()
{
+ if(!m_componentComplete)
+ return;//Batch starting reset()s a little
//Clear guarded pointers which have been deleted
int cleared = 0;
cleared += m_emitters.removeAll(0);