mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
*** empty log message ***
This commit is contained in:
parent
cc34a6e7da
commit
ed5ff3d496
@ -43,17 +43,16 @@ class ParticleInterval(Interval.Interval):
|
|||||||
# Update particle effect based on current time
|
# Update particle effect based on current time
|
||||||
if (t >= self.getDuration()):
|
if (t >= self.getDuration()):
|
||||||
# If duration reached or stop event received, stop particle effect
|
# If duration reached or stop event received, stop particle effect
|
||||||
ParticleEffect.cleanupParticleEffect(self.particleEffect)
|
self.particleEffect.cleanup()
|
||||||
self.ignore(self.stopEvent)
|
self.ignore(self.stopEvent)
|
||||||
self.cleanedUp = 1
|
self.cleanedUp = 1
|
||||||
elif (event == Interval.IVAL_INIT):
|
elif (event == Interval.IVAL_INIT):
|
||||||
# IVAL_INIT event, start new particle effect
|
# IVAL_INIT event, start new particle effect
|
||||||
ParticleEffect.startParticleEffect(self.particleEffect,
|
self.particleEffect.start(self.parent, self.worldRelative)
|
||||||
self.parent, self.worldRelative)
|
|
||||||
# Accept event to kill particle effect
|
# Accept event to kill particle effect
|
||||||
self.acceptOnce(self.stopEvent,
|
self.acceptOnce(self.stopEvent,
|
||||||
lambda s = self:
|
lambda s = self:
|
||||||
ParticleEffect.cleanupParticleEffect(s.particleEffect))
|
s.particleEffect.cleanup())
|
||||||
# Print debug information
|
# Print debug information
|
||||||
assert(self.notify.debug('updateFunc() - %s: t = %f' % (self.name, t)))
|
assert(self.notify.debug('updateFunc() - %s: t = %f' % (self.name, t)))
|
||||||
|
|
||||||
|
@ -3,25 +3,6 @@ import Particles
|
|||||||
import ForceGroup
|
import ForceGroup
|
||||||
import DirectNotifyGlobal
|
import DirectNotifyGlobal
|
||||||
|
|
||||||
|
|
||||||
# NOTE: these two calls were moved here from BattleParticles
|
|
||||||
# to avoid DIRECT depending on TOONTOWN! - gregw
|
|
||||||
def startParticleEffect(effect, parent, worldRelative=1):
|
|
||||||
assert(effect != None and parent != None)
|
|
||||||
#notify.debug('startParticleEffect() - name: %s' % effect.getName())
|
|
||||||
particles = effect.getParticlesNamed('particles-1')
|
|
||||||
if (worldRelative == 1):
|
|
||||||
particles.setRenderParent(render.node())
|
|
||||||
effect.enable()
|
|
||||||
effect.reparentTo(parent)
|
|
||||||
|
|
||||||
def cleanupParticleEffect(effect):
|
|
||||||
assert(effect != None)
|
|
||||||
#notify.debug('cleanupParticleEffect() - %s' % effect.getName())
|
|
||||||
effect.disable()
|
|
||||||
effect.reparentTo(hidden)
|
|
||||||
effect.cleanup()
|
|
||||||
|
|
||||||
class ParticleEffect(NodePath):
|
class ParticleEffect(NodePath):
|
||||||
|
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('ParticleEffect')
|
notify = DirectNotifyGlobal.directNotify.newCategory('ParticleEffect')
|
||||||
@ -44,8 +25,18 @@ class ParticleEffect(NodePath):
|
|||||||
# The effect's particle system
|
# The effect's particle system
|
||||||
if (particles != None):
|
if (particles != None):
|
||||||
self.addParticles(particles)
|
self.addParticles(particles)
|
||||||
|
self.worldRelative = 0
|
||||||
|
|
||||||
|
def start(self, parent=None, worldRelative=1):
|
||||||
|
assert(self.notify.debug('start() - name: %s' % self.name))
|
||||||
|
self.worldRelative = worldRelative
|
||||||
|
self.enable()
|
||||||
|
if (parent != None):
|
||||||
|
self.reparentTo(parent)
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
|
self.reparentTo(hidden)
|
||||||
|
self.disable()
|
||||||
for f in self.forceGroupDict.values():
|
for f in self.forceGroupDict.values():
|
||||||
f.cleanup()
|
f.cleanup()
|
||||||
for p in self.particlesDict.values():
|
for p in self.particlesDict.values():
|
||||||
@ -62,6 +53,9 @@ class ParticleEffect(NodePath):
|
|||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
"""enable()"""
|
"""enable()"""
|
||||||
|
if (self.worldRelative == 1):
|
||||||
|
for p in self.particlesDict.values():
|
||||||
|
p.setRenderParent(render.node())
|
||||||
for f in self.forceGroupDict.values():
|
for f in self.forceGroupDict.values():
|
||||||
f.enable()
|
f.enable()
|
||||||
for p in self.particlesDict.values():
|
for p in self.particlesDict.values():
|
||||||
@ -70,6 +64,9 @@ class ParticleEffect(NodePath):
|
|||||||
|
|
||||||
def disable(self):
|
def disable(self):
|
||||||
"""disable()"""
|
"""disable()"""
|
||||||
|
if (self.worldRelative == 1):
|
||||||
|
for p in self.particlesDict.values():
|
||||||
|
p.setRenderParent(hidden.node())
|
||||||
for f in self.forceGroupDict.values():
|
for f in self.forceGroupDict.values():
|
||||||
f.disable()
|
f.disable()
|
||||||
for p in self.particlesDict.values():
|
for p in self.particlesDict.values():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user