def loadParticleFile(name): global particleSearchPath if particleSearchPath == None: particleSearchPath = DSearchPath() if AppRunnerGlobal.appRunner: particleSearchPath.appendDirectory( Filename.expandFrom('$TT_3_5_ROOT/phase_3.5/etc')) elif not os.path.expandvars('$TOONTOWN'): pass basePath = './toontown' particleSearchPath.appendDirectory( Filename.fromOsSpecific(basePath + '/src/battle')) particleSearchPath.appendDirectory( Filename.fromOsSpecific(basePath + '/src/safezone')) particleSearchPath.appendDirectory(Filename('phase_3.5/etc')) particleSearchPath.appendDirectory(Filename('phase_4/etc')) particleSearchPath.appendDirectory(Filename('phase_5/etc')) particleSearchPath.appendDirectory(Filename('phase_8/etc')) particleSearchPath.appendDirectory(Filename('phase_9/etc')) particleSearchPath.appendDirectory(Filename('.')) pfile = Filename(name) found = vfs.resolveFilename(pfile, particleSearchPath) if not found: notify.warning('loadParticleFile() - no path: %s' % name) return None notify.debug('Loading particle file: %s' % pfile) effect = ParticleEffect() effect.loadConfig(pfile) return effect
def loadParticleFile(name): global particleSearchPath if particleSearchPath == None: particleSearchPath = DSearchPath() if AppRunnerGlobal.appRunner: particleSearchPath.appendDirectory(Filename.expandFrom('$TT_3_5_ROOT/phase_3.5/etc')) elif not os.path.expandvars('$TOONTOWN'): pass basePath = './toontown' particleSearchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/src/battle')) particleSearchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/src/safezone')) particleSearchPath.appendDirectory(Filename('phase_3.5/etc')) particleSearchPath.appendDirectory(Filename('phase_4/etc')) particleSearchPath.appendDirectory(Filename('phase_5/etc')) particleSearchPath.appendDirectory(Filename('phase_8/etc')) particleSearchPath.appendDirectory(Filename('phase_9/etc')) particleSearchPath.appendDirectory(Filename('.')) pfile = Filename(name) found = vfs.resolveFilename(pfile, particleSearchPath) if not found: notify.warning('loadParticleFile() - no path: %s' % name) return None notify.debug('Loading particle file: %s' % pfile) effect = ParticleEffect() effect.loadConfig(pfile) return effect
def loadParticleFile(name): global particleSearchPath if particleSearchPath == None: particleSearchPath = DSearchPath() # should look in dev env locations first, since they will be # updated before official TTMODELS 'phase' locations when you checkin basePath = os.path.expandvars('$TOONTOWN') or './toontown' particleSearchPath.appendDirectory( Filename.fromOsSpecific(basePath + '/src/battle')) particleSearchPath.appendDirectory( Filename.fromOsSpecific(basePath + '/src/safezone')) particleSearchPath.appendDirectory(Filename('phase_3.5/etc')) particleSearchPath.appendDirectory(Filename('phase_4/etc')) particleSearchPath.appendDirectory(Filename('phase_5/etc')) particleSearchPath.appendDirectory(Filename('phase_8/etc')) particleSearchPath.appendDirectory(Filename('phase_9/etc')) particleSearchPath.appendDirectory(Filename('.')) pfile = Filename(name) found = vfs.resolveFilename(pfile, particleSearchPath) if not found: notify.warning('loadParticleFile() - no path: %s' % name) return notify.debug('Loading particle file: %s' % pfile) effect = ParticleEffect() # print "particle filename = ", pfile.getFullpath() effect.loadConfig(pfile) return effect
def loadParticleFile(name): global particleSearchPath if particleSearchPath == None: particleSearchPath = DSearchPath() if AppRunnerGlobal.appRunner: # In the web-publish runtime, it will always be here: particleSearchPath.appendDirectory( Filename.expandFrom('$TT_3_5_ROOT/phase_3.5/etc')) else: # In other environments, including the dev environment, look here: basePath = os.path.expandvars('$TOONTOWN') or './toontown' particleSearchPath.appendDirectory( Filename.fromOsSpecific(basePath + '/src/battle')) particleSearchPath.appendDirectory( Filename.fromOsSpecific(basePath + '/src/safezone')) particleSearchPath.appendDirectory(Filename('phase_3.5/etc')) particleSearchPath.appendDirectory(Filename('phase_4/etc')) particleSearchPath.appendDirectory(Filename('phase_5/etc')) particleSearchPath.appendDirectory(Filename('phase_8/etc')) particleSearchPath.appendDirectory(Filename('phase_9/etc')) particleSearchPath.appendDirectory(Filename('.')) pfile = Filename(name) found = vfs.resolveFilename(pfile, particleSearchPath) if not found: notify.warning('loadParticleFile() - no path: %s' % name) return notify.debug('Loading particle file: %s' % pfile) effect = ParticleEffect() # print "particle filename = ", pfile.getFullpath() effect.loadConfig(pfile) return effect
def loadParticleFile(name): global particleSearchPath if particleSearchPath == None: particleSearchPath = DSearchPath() particleSearchPath.appendDirectory(Filename('/phase_3.5/etc')) particleSearchPath.appendDirectory(Filename('/phase_4/etc')) particleSearchPath.appendDirectory(Filename('/phase_5/etc')) particleSearchPath.appendDirectory(Filename('/phase_8/etc')) particleSearchPath.appendDirectory(Filename('/phase_9/etc')) pfile = Filename(name) found = vfs.resolveFilename(pfile, particleSearchPath) if not found: notify.warning('loadParticleFile() - no path: %s' % name) return else: notify.debug('Loading particle file: %s' % pfile) effect = ParticleEffect() effect.loadConfig(pfile) return effect
def loadParticleFile(name): global particleSearchPath if particleSearchPath == None: particleSearchPath = DSearchPath() if AppRunnerGlobal.appRunner: # In the web-publish runtime, it will always be here: particleSearchPath.appendDirectory( Filename.expandFrom('$TT_3_5_ROOT/phase_3.5/etc')) else: # In other environments, including the dev environment, look here: basePath = os.path.expandvars('$TOONTOWN') or './toontown' particleSearchPath.appendDirectory( Filename.fromOsSpecific(basePath + '/src/battle')) particleSearchPath.appendDirectory( Filename.fromOsSpecific(basePath + '/src/safezone')) particleSearchPath.appendDirectory(Filename('phase_3.5/etc')) particleSearchPath.appendDirectory(Filename('phase_4/etc')) particleSearchPath.appendDirectory(Filename('phase_5/etc')) particleSearchPath.appendDirectory(Filename('phase_8/etc')) particleSearchPath.appendDirectory(Filename('phase_9/etc')) particleSearchPath.appendDirectory(Filename('.')) pfile = Filename(name) found = vfs.resolveFilename(pfile, particleSearchPath) if not found: notify.warning('loadParticleFile() - no path: %s' % name) return notify.debug('Loading particle file: %s' % pfile) effect = ParticleEffect() # print("particle filename = ", pfile.getFullpath()) effect.loadConfig(pfile) # Don't render shadows on any particles. There are some particles that are # non-triangles (like points or lines). The shadow render shader does not # currently handle non-triangle geometry. OTPRender.renderShadow(False, effect) return effect
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())