def onOrthoMode( self ): if WorldEditor.getOptionInt( "camera/ortho" == 1 ): WorldEditor.changeToCamera(1) else: WorldEditor.changeToCamera(0)
def onHideOrthoMode(item): WorldEditor.setOptionInt("camera/ortho", 0) WorldEditor.changeToCamera(0)
def onShowOrthoMode(item): WorldEditor.setOptionInt("camera/ortho", 1) WorldEditor.changeToCamera(1)
def onStart( self ): # create chunk viz self.chunkViz = View.TerrainChunkTextureToolView( "resources/maps/gizmo/square.dds" ) self.chunkViz.numPerChunk = 1 # create vertex viz self.vertexViz = View.TerrainChunkTextureToolView( "resources/maps/gizmo/vertices.dds" ) self.vertexViz.numPerChunk = 25 # create terrain mesh viz self.meshViz = View.TerrainChunkTextureToolView( "resources/maps/gizmo/quads.dds" ) self.meshViz.numPerChunk = 25 # create alpha tool self.alphaTool = WorldEditor.Tool() self.alphaTool.functor = Functor.TerrainTextureFunctor() self.alphaTool.locator = Locator.TerrainToolLocator() self.alphaToolTextureView = View.TerrainTextureToolView( "resources/maps/gizmo/alphatool.tga" ) self.alphaTool.addView( self.alphaToolTextureView, "stdView" ) self.alphaTool.size = 30 self.alphaTool.strength = 1000 # create height filter tool self.heightFunctor = Functor.TerrainHeightFilterFunctor() self.heightFunctor.index = 0 # this index must match the filters.xml file self.heightFunctor.strengthMod = 1 self.heightFunctor.framerateMod = 1 self.heightFunctor.constant = 1.0 self.heightFunctor.falloff = 2 self.setHeightFunctor = Functor.TerrainSetHeightFunctor() self.setHeightFunctor.height = 0 self.setHeightFunctor.relative = 0 self.heightView = View.TerrainTextureToolView( "resources/maps/gizmo/heighttool.tga" ) self.setHeightView = View.TerrainTextureToolView( "resources/maps/gizmo/squaretool.dds" ) self.heightTool = WorldEditor.Tool() self.heightTool.locator = Locator.TerrainToolLocator() self.heightTool.functor = Functor.TeeFunctor( self.heightFunctor, self.setHeightFunctor, KEY_LCONTROL ) self.heightToolTextureView = View.TeeView( self.heightView, self.setHeightView, KEY_LCONTROL ) self.heightTool.addView( self.heightToolTextureView, "stdView" ) self.heightTool.size = 30 # create general filter tool self.filterTool = WorldEditor.Tool() self.filterTool.locator = Locator.TerrainToolLocator() self.filterTool.functor = Functor.TerrainHeightFilterFunctor() self.filterTool.functor.strengthMod = 1 self.filterTool.functor.constant = 0.0 self.filterToolTextureView = View.TerrainTextureToolView( "resources/maps/gizmo/filtertool.tga" ) self.filterTool.addView( self.filterToolTextureView, "stdView" ) self.filterTool.size = 30 # create a hole cutter self.holeTool = WorldEditor.Tool() self.holeTool.locator = Locator.TerrainHoleToolLocator() view = View.TerrainTextureToolView( "resources/maps/gizmo/squaretool.dds" ) view.showHoles = True self.holeTool.addView( view, "stdView" ) self.holeTool.functor = Functor.TerrainHoleFunctor() self.holeTool.size = 30 # create the item tool self.itemTool = WorldEditor.Tool() self.itemToolXZLocator = Locator.ItemToolLocator() self.itemTool.locator = Locator.TerrainToolLocator() self.itemToolTextureView = View.TerrainTextureToolView( "resources/maps/gizmo/cross2.dds" ) self.itemToolModelView = View.ModelToolView( "resources/models/pointer.model" ) self.itemToolPlaneView = View.ModelToolView( "resources/models/freepointer.model" ) self.itemTool.addView( self.itemToolTextureView, "stdView" ) # This changes our locator to a ChunkItemLocator self.itemTool.functor = Functor.ScriptedFunctor( ChunkItemFunctor( self.itemTool, self.objInfo ) ) # Setup the correct subLocator for the ChunkItemLocator self.itemTool.locator.subLocator = self.itemToolXZLocator self.itemTool.size = 1 # Make the closed captions commentary viewer self.cc = GUI.ClosedCaptions( WorldEditor.getOptionInt( "consoles/numMessageLines", 5 ) ) self.cc.addAsView() self.cc.visible = 1 if ( WorldEditor.getOptionInt( "tools/showChunkVisualisation" ) == 1 ): WorldEditor.setOptionInt( "render/chunk/vizMode", 1) self.enterChunkVizMode() self.enterMode( self.modeName, 1 ) # initialise the mouse move camera # load up the start position from space.localsettings startPos = (0,1.85,0) startDir = (0,0,0) dir = WorldEditor.getOptionString( "space/mru0" ) dirDS = ResMgr.openSection( dir ) ds = dirDS["space.localsettings"] if ds != None: startPos = ds.readVector3( "startPosition", startPos ) startDir = ds.readVector3( "startDirection", startDir ) m = WorldEditor.camera(0).view m.setIdentity() m.setRotateYPR( (startDir[2], startDir[1], startDir[0]) ) m.translation = startPos m.invert() WorldEditor.camera(0).view = m # select the camera as specified in the options WorldEditor.changeToCamera( WorldEditor.getOptionInt( "camera/ortho" ) ) # read the initial item snap mode self.updateItemSnaps();
def onHideOrthoMode( item ): WorldEditor.setOptionInt( "camera/ortho", 0 ) WorldEditor.changeToCamera(0)
def onShowOrthoMode( item ): WorldEditor.setOptionInt( "camera/ortho", 1 ) WorldEditor.changeToCamera(1)