Put some bullet proofing around cleanup and enable funcs

This commit is contained in:
Greg Wiatroski 2005-04-22 21:23:57 +00:00
parent 9c97466a56
commit a3702b8a8f

View File

@ -36,13 +36,17 @@ class ParticleEffect(NodePath):
def cleanup(self): def cleanup(self):
self.removeNode() self.removeNode()
self.disable() self.disable()
if hasattr(self, 'forceGroupDict'):
for f in self.forceGroupDict.values(): for f in self.forceGroupDict.values():
f.cleanup() f.cleanup()
del self.forceGroupDict
if hasattr(self, 'particlesDict'):
for p in self.particlesDict.values(): for p in self.particlesDict.values():
p.cleanup() p.cleanup()
del self.renderParent
del self.particlesDict del self.particlesDict
del self.forceGroupDict del self.renderParent
def reset(self): def reset(self):
self.removeAllForces() self.removeAllForces()
@ -52,6 +56,8 @@ class ParticleEffect(NodePath):
def enable(self): def enable(self):
"""enable()""" """enable()"""
# band-aid added for client crash - grw
if hasattr(self, 'forceGroupDict') and hasattr(self, 'particlesGroupDict'):
if (self.renderParent != None): if (self.renderParent != None):
for p in self.particlesDict.values(): for p in self.particlesDict.values():
p.setRenderParent(self.renderParent.node()) p.setRenderParent(self.renderParent.node())