diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-09-09 14:45:20 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-13 01:43:37 +0200 |
commit | fded142474bcafd3a5a26e93814ff4d36acbda05 (patch) | |
tree | 63ba7e225be03192cff4085c0e5c8a5f62a3d464 /src/declarative/particles | |
parent | 82b21536e72a640699594b3e82a5a6182a95521c (diff) |
Make activeGroups usable.
It actually relied on functionality inside the affectSystem method,
when it was intended to be used in subclass reimplmentations. That
functionality is now in the function itself.
Change-Id: Ie01f5a5d18a15ca207422869d221d75d63b17789
Reviewed-on: http://codereview.qt-project.org/4509
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/declarative/particles')
-rw-r--r-- | src/declarative/particles/qsgparticleaffector.cpp | 18 | ||||
-rw-r--r-- | src/declarative/particles/qsgparticleaffector_p.h | 2 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/declarative/particles/qsgparticleaffector.cpp b/src/declarative/particles/qsgparticleaffector.cpp index 3554121a2b..f637a17508 100644 --- a/src/declarative/particles/qsgparticleaffector.cpp +++ b/src/declarative/particles/qsgparticleaffector.cpp @@ -140,6 +140,16 @@ void QSGParticleAffector::componentComplete() QSGItem::componentComplete(); } +bool QSGParticleAffector::activeGroup(int g) { + if (m_updateIntSet){ + m_groups.clear(); + foreach (const QString &p, m_particles) + m_groups << m_system->m_groupIds[p];//###Can this occur before group ids are properly assigned? + m_updateIntSet = false; + } + return m_groups.isEmpty() || m_groups.contains(g); +} + void QSGParticleAffector::affectSystem(qreal dt) { if (!m_enabled) @@ -147,18 +157,12 @@ void QSGParticleAffector::affectSystem(qreal dt) //If not reimplemented, calls affect particle per particle //But only on particles in targeted system/area bool affectedConnected = isAffectedConnected(); - if (m_updateIntSet){ - m_groups.clear(); - foreach (const QString &p, m_particles) - m_groups << m_system->m_groupIds[p];//###Can this occur before group ids are properly assigned? - m_updateIntSet = false; - } updateOffsets();//### Needed if an ancestor is transformed. foreach (QSGParticleGroupData* gd, m_system->m_groupData){ foreach (QSGParticleData* d, gd->data){ if (!d) continue; - if (m_groups.isEmpty() || m_groups.contains(d->group)){ + if (activeGroup(d->group)){ if ((m_onceOff && m_onceOffed.contains(qMakePair(d->group, d->index))) || !d->stillAlive()) continue; diff --git a/src/declarative/particles/qsgparticleaffector_p.h b/src/declarative/particles/qsgparticleaffector_p.h index c808ef4e76..5700969aad 100644 --- a/src/declarative/particles/qsgparticleaffector_p.h +++ b/src/declarative/particles/qsgparticleaffector_p.h @@ -170,7 +170,7 @@ protected: bool m_needsReset;//### What is this really saving? QSGParticleSystem* m_system; QStringList m_particles; - bool activeGroup(int g) {return m_groups.isEmpty() || m_groups.contains(g);} + bool activeGroup(int g); bool m_enabled; virtual void componentComplete(); QPointF m_offset; |