def ownKeyEvent( self, key, modifiers ): handled = 0 if key == KEY_LBRACKET: if modifiers & MODIFIER_SHIFT: self.chunkTool.size -= 1000 else: self.chunkTool.size -= 100 if self.chunkTool.size < 100: self.chunkTool.size = 100 self.numChunks = self.chunkTool.size / 100 BigBang.addCommentaryMsg( \ "will create %0.0f x %0.0f chunks" % (self.numChunks, self.numChunks) ) elif key == KEY_RBRACKET: if modifiers & MODIFIER_SHIFT: self.chunkTool.size += 1000 else: self.chunkTool.size += 100 self.numChunks = self.chunkTool.size / 100 BigBang.addCommentaryMsg( \ "will create %0.0f x %0.0f chunks" % (self.numChunks, self.numChunks) ) elif key == KEY_RETURN: self.numChunks = self.chunkTool.size / 100 self.create() return handled
def ownKeyEvent(self, key, modifiers): handled = 0 if key == KEY_LBRACKET: if modifiers & MODIFIER_SHIFT: self.chunkTool.size -= 1000 else: self.chunkTool.size -= 100 if self.chunkTool.size < 100: self.chunkTool.size = 100 self.numChunks = self.chunkTool.size / 100 BigBang.addCommentaryMsg( \ "will create %0.0f x %0.0f chunks" % (self.numChunks, self.numChunks) ) elif key == KEY_RBRACKET: if modifiers & MODIFIER_SHIFT: self.chunkTool.size += 1000 else: self.chunkTool.size += 100 self.numChunks = self.chunkTool.size / 100 BigBang.addCommentaryMsg( \ "will create %0.0f x %0.0f chunks" % (self.numChunks, self.numChunks) ) elif key == KEY_RETURN: self.numChunks = self.chunkTool.size / 100 self.create() return handled
def createUniverse( self, universeName ): settingsFile = None pathName = "universes/" + universeName + "/" settingsFile = ResMgr.openSection( pathName + "universe.settings" ) if not settingsFile: settingsFile = self.createNewUniverseSettings( pathName ) if settingsFile != None: BigBang.addCommentaryMsg( "created new universe" )
def createNewUniverseSettings( self, universePath ): settingsFile = ResMgr.root.createSection( universePath + "universe.settings" ) if settingsFile != None: settingsFile.save() BigBang.addCommentaryMsg( "created universe.settings" ) return settingsFile else: BigBang.addCommentaryMsg( "error creating universe.settings", 2 ) return None
def createUniverse(self, universeName): settingsFile = None pathName = "universes/" + universeName + "/" settingsFile = ResMgr.openSection(pathName + "universe.settings") if not settingsFile: settingsFile = self.createNewUniverseSettings(pathName) if settingsFile != None: BigBang.addCommentaryMsg("created new universe")
def createNewUniverseSettings(self, universePath): settingsFile = ResMgr.root.createSection(universePath + "universe.settings") if settingsFile != None: settingsFile.save() BigBang.addCommentaryMsg("created universe.settings") return settingsFile else: BigBang.addCommentaryMsg("error creating universe.settings", 2) return None
def createNewSpaceSettings( self, spacePath ): settingsFile = ResMgr.root.createSection( spacePath + "space.settings" ) if settingsFile != None: settingsFile.writeString( "timeOfDay", "environments/sky.xml" ) settingsFile.writeString( "skyGradientDome", "environments/sky.xml" ) settingsFile.save(); BigBang.addCommentaryMsg( "created space.settings" ) return settingsFile else: BigBang.addCommentaryMsg( "error creating space.settings", 2 ) return None
def createNewSpaceSettings(self, spacePath): settingsFile = ResMgr.root.createSection(spacePath + "space.settings") if settingsFile != None: settingsFile.writeString("timeOfDay", "environments/sky.xml") settingsFile.writeString("skyGradientDome", "environments/sky.xml") settingsFile.save() BigBang.addCommentaryMsg("created space.settings") return settingsFile else: BigBang.addCommentaryMsg("error creating space.settings", 2) return None
def create( self ): if self.newUniverseName == "none": BigBang.addCommentaryMsg( "New Universe Name not set", 2 ) return if self.newSpaceName == "none": BigBang.addCommentaryMsg( "New Space Name not set", 2 ) return self.createUniverse( self.newUniverseName ) self.createSpace( self.newUniverseName, self.newSpaceName ) fullPathName = "universes/" + self.newUniverseName + "/" + self.newSpaceName + "/" self.createChunks( fullPathName, self.numChunks, self.numChunks ) pass
def create(self): if self.newUniverseName == "none": BigBang.addCommentaryMsg("New Universe Name not set", 2) return if self.newSpaceName == "none": BigBang.addCommentaryMsg("New Space Name not set", 2) return self.createUniverse(self.newUniverseName) self.createSpace(self.newUniverseName, self.newSpaceName) fullPathName = "universes/" + self.newUniverseName + "/" + self.newSpaceName + "/" self.createChunks(fullPathName, self.numChunks, self.numChunks) pass
def createSpace( self, universeName, spaceName ): settingsFile = None pathName = "universes/" + universeName + "/" settingsFile = ResMgr.openSection( pathName + "universe.settings" ) if settingsFile == None: settingsFile = self.createNewUniverseSettings( pathName ) if settingsFile != None: #create a space entry in the universes file spaceSect = settingsFile.has_key( spaceName ) if spaceSect == 0: settingsFile.writeString( spaceName, "" ) settingsFile.save() #create the space folder pathName += spaceName + "/" settingsFile = ResMgr.openSection( pathName + "space.settings" ) if settingsFile == None: settingsFile = self.createNewSpaceSettings( pathName ) if settingsFile != None: BigBang.addCommentaryMsg( "created new space" )
def createSpace(self, universeName, spaceName): settingsFile = None pathName = "universes/" + universeName + "/" settingsFile = ResMgr.openSection(pathName + "universe.settings") if settingsFile == None: settingsFile = self.createNewUniverseSettings(pathName) if settingsFile != None: #create a space entry in the universes file spaceSect = settingsFile.has_key(spaceName) if spaceSect == 0: settingsFile.writeString(spaceName, "") settingsFile.save() #create the space folder pathName += spaceName + "/" settingsFile = ResMgr.openSection(pathName + "space.settings") if settingsFile == None: settingsFile = self.createNewSpaceSettings(pathName) if settingsFile != None: BigBang.addCommentaryMsg("created new space")
def createChunk( self, pathName, x, y ): theChunk = pathName + self.chunkName(x,y) #create chunk file fullChunkName = theChunk + ".chunk" sect = ResMgr.openSection( fullChunkName ) if sect == None: sect = ResMgr.root.createSection( fullChunkName ) if sect != None: sect.writeStrings( "boundary", ("","","","","","") ) for i in xrange( 0, 6 ): self.writeBoundary( sect,x,y,i ) self.writeTerrain( sect,x,y ) self.writeBoundsAndTransform( sect,x,y ) sect.save() BigBang.addCommentaryMsg( "created " + fullChunkName ) else: BigBang.addCommentaryMsg( "chunk exists : - skipping" + fullChunkName, 1 ) #create terrain file fullTerrainName = theChunk[0:-1] + ".terrain" BigBang.createBlankTerrainFile( fullTerrainName ) BigBang.addCommentaryMsg( "created " + fullTerrainName )
def createChunk(self, pathName, x, y): theChunk = pathName + self.chunkName(x, y) #create chunk file fullChunkName = theChunk + ".chunk" sect = ResMgr.openSection(fullChunkName) if sect == None: sect = ResMgr.root.createSection(fullChunkName) if sect != None: sect.writeStrings("boundary", ("", "", "", "", "", "")) for i in xrange(0, 6): self.writeBoundary(sect, x, y, i) self.writeTerrain(sect, x, y) self.writeBoundsAndTransform(sect, x, y) sect.save() BigBang.addCommentaryMsg("created " + fullChunkName) else: BigBang.addCommentaryMsg( "chunk exists : - skipping" + fullChunkName, 1) #create terrain file fullTerrainName = theChunk[0:-1] + ".terrain" BigBang.createBlankTerrainFile(fullTerrainName) BigBang.addCommentaryMsg("created " + fullTerrainName)
def onResume( self, exitCode ): self.cc.addAsView() self.cc.visible = 1 BigBang.pushTool( self.chunkTool ) BigBang.addCommentaryMsg( "entered chunk management mode." )
def onResume(self, exitCode): self.cc.addAsView() self.cc.visible = 1 BigBang.pushTool(self.chunkTool) BigBang.addCommentaryMsg("entered chunk management mode.")