def __init__(self, particleFn, name = None, hpr = None, position = None, size = None, duration = 0, ** a): if name is None: name = 'PEffect-%d' % PEffect.pid PEffect.pid += 1 Handle.__init__(self, name = name, duration = duration) #pathname = "/lib/panda/lib/lib-original/particles/" base.enableParticles() p = ParticleEffect() particleFn(p, a) self.d.model = p # ??? self.__dict__['position'] = newSignalRefd(self, 'position', P3Type, P3(0,0,0)) self.__dict__['hpr'] = newSignalRefd(self, 'hpr', HPRType, HPR(0,0,0)) self.__dict__['size'] = newSignalRefd(self, 'size', numType, 1) if size is not None: self.size.setBehavior(size) if position is not None: self.position.setBehavior(position) if hpr is not None: self.hpr.setBehavior(hpr) p.reparentTo(render) p.start()
def __init__(self, particleFn, name = 'particleEffect', hpr = None, position = None, size = None, duration = 0, parent = render, **a): Proxy.__init__(self, name = name + ":" + str(PandaGlobals.nextModelId), updater = peffectUpdater, types = {"position":p3Type, "hpr":hprType, "size":numType}) #pathname = "/lib/panda/lib/lib-original/particles/" #base.enableParticles() #this should be in start in main program, this should probably go away base.enableParticles() p = ParticleEffect() self._pandaModel = p self._onScreen = False self._parent = getModel(parent) if position is not None: self.position = position else: self.position = P3(0, 0, 0) if hpr is not None: self.hpr = hpr else: self.hpr = SHPR(0, 0, 0) if size is not None: self.size = size else: self.size = 1 particleFn(p, a) p.start() if duration > 0: react(self, delay(duration), exitScene)
def __init__(self, particleFn, name='particleEffect', hpr=None, position=None, size=None, duration=0, parent=render, **a): Proxy.__init__(self, name=name + ":" + str(PandaGlobals.nextModelId), updater=peffectUpdater, types={ "position": p3Type, "hpr": hprType, "size": numType }) #pathname = "/lib/panda/lib/lib-original/particles/" #base.enableParticles() #this should be in start in main program, this should probably go away base.enableParticles() p = ParticleEffect() self._pandaModel = p self._onScreen = False self._parent = getModel(parent) if position is not None: self.position = position else: self.position = P3(0, 0, 0) if hpr is not None: self.hpr = hpr else: self.hpr = SHPR(0, 0, 0) if size is not None: self.size = size else: self.size = 1 particleFn(p, a) p.start() if duration > 0: react(self, delay(duration), exitScene)
def __init__(self, particleFn, name=None, hpr=None, position=None, size=None, duration=0, **a): if name is None: name = 'PEffect-%d' % PEffect.pid PEffect.pid += 1 Handle.__init__(self, name=name, duration=duration) #pathname = "/lib/panda/lib/lib-original/particles/" base.enableParticles() p = ParticleEffect() particleFn(p, a) self.d.model = p # ??? self.__dict__['position'] = newSignalRefd(self, 'position', P3Type, P3(0, 0, 0)) self.__dict__['hpr'] = newSignalRefd(self, 'hpr', HPRType, HPR(0, 0, 0)) self.__dict__['size'] = newSignalRefd(self, 'size', numType, 1) if size is not None: self.size.setBehavior(size) if position is not None: self.position.setBehavior(position) if hpr is not None: self.hpr.setBehavior(hpr) p.reparentTo(render) p.start()
def __init__(self, name=None, particleFile="LikeFountainWater.py", defaultPath=True, parent=render, hpr=None, position=None, colorType=None, color=gray, endColor=None, size=None, birthRate=None, poolSize=None, litterSize=None, lineScaleFactor=None, lifeSpanBase=None, terminalVelocityBase=None, texture=None, amplitude=None, amplitudeSpread=None, emissionType="ETRADIATE", radius=None, radiusSpread=None, duration=0): """Initalizes the PEffect. PEffect __init__(self, name = 'PEffect', particleFile = "LikeFountainWater.py", defaultPath = True, parent = render, hpr = None, position = None, color = gray, startColor = None , endColor = None, headColor = None, tailColor = None, birthRate = None, poolSize = None, litterSize = None, lineScaleFactor = None, lifeSpanBase = None, terminalVelocityBase = None, amplitude = None, amplitudeSpread = None, particlePic = None ): """ if texture is not None: g.texture = loader.loadTexture(findTexture(texture)) if name is None: name = 'PEffect-%d' % PEffect.pid PEffect.pid += 1 Handle.__init__(self, name=name) self.d.colorType = colorType #pathname = "/lib/panda/lib/lib-original/particles/" base.enableParticles() p = ParticleEffect() self.__dict__[name] = p self.particleName = name self.d.model = p # ??? if defaultPath: # print particleFile p.loadConfig(Filename(g.pandaPath + "/particles/" + particleFile)) else: p.loadConfig(Filename(particleFile)) pd = p.particlesDict["particles-1"] if emissionType is not None: if emissionType is "ETRADIATE": pd.emitter.setEmissionType( BaseParticleEmitter.ETRADIATE ) #emitter type ETEXPICIT ETCUSTOM, ETRADIATE elif emissionType is "ETCUSTOM": pd.emitter.setEmissionType(BaseParticleEmitter.ETCUSTOM) if radius is not None: self.__dict__['radius'] = newSignalRef(self, 'radius', numType, radius) checkKeyType('PEffect', name, stringType, 'name') self.__dict__['position'] = newSignalRef(self, 'position', P3Type) # self.__dict__['color'] = newSignalRefd(self, 'color', ColorType,color) self.__dict__['hpr'] = newSignalRefd(self, 'hpr', HPRType, HPR(0, 0, 0)) self.__dict__['size'] = newSignalRefd(self, 'size', numType, 1) if size is not None: self.size.setBehavior(size) self.__dict__['color'] = newSignalRefd( self, 'color', ColorType, color) # color at which the effect will start if endColor is None: endColor = color self.__dict__['endColor'] = newSignalRefd( self, 'endColor', ColorType, endColor) # color at which the effect will end at self.color.setBehavior(color) if lineScaleFactor is not None: self.__dict__['LineScaleFactor'] = newSignalRefd( self, 'LineScaleFactor', numType, lineScaleFactor) #how long a particle is if poolSize is not None: self.__dict__['PoolSize'] = newSignalRefd( self, 'PoolSize', numType, poolSize) #Number of particles avaiable for the entire effect if birthRate is not None: self.__dict__['BirthRate'] = newSignalRefd( self, 'BirthRate', numType, birthRate) #The rate in which the particle effect occurs if litterSize is not None: self.__dict__['LitterSize'] = newSignalRefd( self, 'LitterSize', numType, litterSize) #Number of particles per effect occcurance if lifeSpanBase is not None: self.__dict__['LifeSpanBase'] = newSignalRefd( self, 'LIfeSpanBase', numType, lifeSpanBase) #How long the particle effect stays on screen if terminalVelocityBase is not None: self.__dict__['TerminalVelocityBase'] = newSignalRefd( self, 'TerminalVelocityBase', numType, terminalVelocityBase) #how fast the particles move if amplitude is not None: self.__dict__['Amplitude'] = newSignalRefd( self, 'Amplitude', numType, amplitude) #amplitude is the spreading out of particles if amplitudeSpread is not None: self.__dict__['AmplitudeSpread'] = newSignalRefd( self, 'AmplitudeSpread', numType, amplitudeSpread ) #amplitude multiplier spreadings of particles. if position is not None: self.position.setBehavior(position) if hpr is not None: self.hpr.setBehavior(hpr) if color is not None: self.color.setBehavior(color) if endColor is not None: self.endColor.setBehavior(endColor) if parent is not render: self.__dict__['parent'] = parent.d.model p.reparentTo(render) p.start() #Had to use this hack because the refresh function kept restarting the particle effects. self.__dict__["started"] = True if duration != 0: self.react1(localTimeIs(duration), lambda m, v: m.exit())
def __init__(self, name = None, particleFile = "LikeFountainWater.py", defaultPath = True, parent = render, hpr = None, position = None, colorType = None, color = gray, endColor = None, size = None, birthRate = None, poolSize = None, litterSize = None, lineScaleFactor = None, lifeSpanBase = None, terminalVelocityBase = None, texture = None, amplitude = None, amplitudeSpread = None, emissionType = "ETRADIATE", radius = None, radiusSpread = None , duration = 0): """Initalizes the PEffect. PEffect __init__(self, name = 'PEffect', particleFile = "LikeFountainWater.py", defaultPath = True, parent = render, hpr = None, position = None, color = gray, startColor = None , endColor = None, headColor = None, tailColor = None, birthRate = None, poolSize = None, litterSize = None, lineScaleFactor = None, lifeSpanBase = None, terminalVelocityBase = None, amplitude = None, amplitudeSpread = None, particlePic = None ): """ if texture is not None: g.texture = loader.loadTexture(findTexture(texture)) if name is None: name = 'PEffect-%d' % PEffect.pid PEffect.pid += 1 Handle.__init__(self, name = name) self.d.colorType = colorType #pathname = "/lib/panda/lib/lib-original/particles/" base.enableParticles() p = ParticleEffect() self.__dict__[name] = p self.particleName = name self.d.model = p # ??? if defaultPath: # print particleFile p.loadConfig(Filename(g.pandaPath+"/particles/"+ particleFile)) else: p.loadConfig(Filename(particleFile)) pd = p.particlesDict["particles-1"] if emissionType is not None: if emissionType is "ETRADIATE": pd.emitter.setEmissionType(BaseParticleEmitter.ETRADIATE) #emitter type ETEXPICIT ETCUSTOM, ETRADIATE elif emissionType is "ETCUSTOM": pd.emitter.setEmissionType(BaseParticleEmitter.ETCUSTOM) if radius is not None: self.__dict__['radius'] = newSignalRef(self, 'radius', numType, radius) checkKeyType('PEffect', name, stringType, 'name') self.__dict__['position'] = newSignalRef(self, 'position', P3Type) # self.__dict__['color'] = newSignalRefd(self, 'color', ColorType,color) self.__dict__['hpr'] = newSignalRefd(self, 'hpr', HPRType, HPR(0,0,0)) self.__dict__['size'] = newSignalRefd(self, 'size', numType, 1) if size is not None: self.size.setBehavior(size) self.__dict__['color'] = newSignalRefd(self,'color',ColorType,color)# color at which the effect will start if endColor is None: endColor = color self.__dict__['endColor'] = newSignalRefd(self,'endColor',ColorType,endColor)# color at which the effect will end at self.color.setBehavior(color) if lineScaleFactor is not None: self.__dict__['LineScaleFactor'] = newSignalRefd(self,'LineScaleFactor',numType,lineScaleFactor) #how long a particle is if poolSize is not None: self.__dict__['PoolSize'] = newSignalRefd(self,'PoolSize',numType,poolSize) #Number of particles avaiable for the entire effect if birthRate is not None: self.__dict__['BirthRate'] = newSignalRefd(self,'BirthRate',numType,birthRate) #The rate in which the particle effect occurs if litterSize is not None: self.__dict__['LitterSize'] = newSignalRefd(self,'LitterSize',numType,litterSize) #Number of particles per effect occcurance if lifeSpanBase is not None: self.__dict__['LifeSpanBase'] = newSignalRefd(self,'LIfeSpanBase',numType,lifeSpanBase) #How long the particle effect stays on screen if terminalVelocityBase is not None: self.__dict__['TerminalVelocityBase'] = newSignalRefd(self,'TerminalVelocityBase',numType,terminalVelocityBase) #how fast the particles move if amplitude is not None: self.__dict__['Amplitude'] = newSignalRefd(self,'Amplitude', numType, amplitude)#amplitude is the spreading out of particles if amplitudeSpread is not None: self.__dict__['AmplitudeSpread'] = newSignalRefd(self,'AmplitudeSpread',numType,amplitudeSpread)#amplitude multiplier spreadings of particles. if position is not None: self.position.setBehavior(position) if hpr is not None: self.hpr.setBehavior(hpr) if color is not None: self.color.setBehavior(color) if endColor is not None: self.endColor.setBehavior(endColor) if parent is not render: self.__dict__['parent'] = parent.d.model p.reparentTo(render) p.start() #Had to use this hack because the refresh function kept restarting the particle effects. self.__dict__["started"] = True if duration != 0: self.react1(localTimeIs(duration), lambda m, v: m.exit())