emitCap is intended to prevent issues with multiple emission of infinite
life particles, but it can currently prevent emission of any particles
when particleCount() changes after a reset. Tracking particleCount() on
changes would be inefficient and be more work to integrate with the
correct behavior of infinite particles, so this patch delays the impact
of emitCap until an infinite particle is discovered.
This will lead to a subtle behavior difference of limiting infinite
particle counts based on the count at the first emission, not the first
reset, which could be construed as a bug fix in some situations. This
seems reasonable as a futher subtle behavior change will be needed in
the future to properly support varying counts of infinite particles.
Task-number: QTBUG-30915
Change-Id: I4172aee1d03f00cc63ce7c9d12ace052bc41436d
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
m_last_timestamp = timeStamp/1000.;
m_last_emission = m_last_timestamp;
m_reset_last = false;
- m_emitCap = particleCount();
+ m_emitCap = -1;
}
if (m_pulseLeft){
if (datum->lifeSpan >= m_system->maxLife){
datum->lifeSpan = m_system->maxLife;
+ if (m_emitCap == -1)
+ m_emitCap = particleCount();
m_emitCap--;//emitCap keeps us from reemitting 'infinite' particles after their life. Unless you reset the emitter.
}