def load(self): """ load the hood models and dna storage """ assert (self.notify.debug("load()")) # Load the neighborhood specific models and textures if self.storageDNAFile: loader.loadDNAFile(self.dnaStore, self.storageDNAFile) # Overwrite dna storage with holiday specific models # We might not have a newsManager if we are running in the dev # environment without an AI server. newsManager = base.cr.newsManager if newsManager: holidayIds = base.cr.newsManager.getDecorationHolidayId() for holiday in holidayIds: for storageFile in self.holidayStorageDNADict.get(holiday, []): loader.loadDNAFile(self.dnaStore, storageFile) if (ToontownGlobals.HALLOWEEN_COSTUMES not in holidayIds) or (not self.spookySkyFile): # Load the sky model so we will have it in memory for the entire hood self.sky = loader.loadModel(self.skyFile) #self.sky.setColorScale(Vec4(Vec3(self.skyLightScale), 1.0)) self.sky.setTag("sky", "Regular") self.sky.setScale(1.0) self.sky.setFogOff() else: self.sky = loader.loadModel(self.spookySkyFile) #self.sky.setColorScale(Vec4(Vec3(self.skyLightScale), 1.0)) self.sky.setTag("sky", "Halloween") if not newsManager: # Load the sky model so we will have it in memory for the entire hood self.sky = loader.loadModel(self.skyFile) self.sky.setTag("sky", "Regular") self.sky.setScale(1.0) #self.sky.setColorScale(Vec4(Vec3(self.skyLightScale), 1.0)) # Normally, fog is turned off for the sky. This will prevent # the sky from being contaminated by the trolley tunnel shadow # if we jump on the trolley. Hoods like DD that require fog # will specifically turn fog on for the sky. self.sky.setFogOff() self.sky.setLightOff() OTPRender.renderShadow(False, self.sky)
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