def onStart( self ): c = WorldEditor.camera() c.speed = WorldEditor.getOptionFloat( "app/cameraSpeed" ) c.turboSpeed = WorldEditor.getOptionFloat( "app/cameraSpeed2" ) self.alphafunc = Functor.TerrainTextureFunctor() self.guiview = View.AlphaGUITextureToolView( self.alphafunc ) viewmap = "" try: viewmap = WorldEditor.getOptionString( "tools/alphaTool" ) except: pass if viewmap == "": viewmap = "resources/maps/gizmo/disc.bmp" self.alphatool = WorldEditor.Tool( Locator.TerrainToolLocator(), View.TerrainTextureToolView( viewmap ), self.alphafunc ) vismap = "" try: vismap = WorldEditor.getOptionString( "tools/chunkVisualisation" ) except: pass if vismap == "": vismap = "resources/maps/gizmo/square.bmp" self.chunkvis = View.TerrainChunkTextureToolView( vismap ) scv = WorldEditor.getOptionString( "tools/showChunkVisualisation" ) if scv == "true": self.alphatool.addView( self.chunkvis, "chunkVisualisation" ) self.alphatool.addView( self.guiview, "alphaGUI" ) self.guiview.visible = 1 self.alphatool.size = WorldEditor.getOptionFloat( "tools/alphaToolSize" ) self.alphatool.strength = WorldEditor.getOptionFloat( "tools/alphaToolStrength" ) self.heightfunc = Functor.TerrainHeightFilterFunctor() # Create the ecotype tool self.ecotool = WorldEditor.Tool( Locator.TerrainChunkLocator(), View.TerrainChunkTextureToolView( vismap ), Functor.HeightPoleEcotypeFunctor() ); self.ecotool.size = 10000 # Create the object manipulation tool self.objtool = WorldEditor.Tool() self.objtool.functor = Functor.ScriptedFunctor( ChunkItemFunctor( self.objtool, self.objInfo ) ) # Make the closed captions commentary viewer self.cc = GUI.ClosedCaptions( WorldEditor.getOptionInt( "consoles/numMessageLines" ) ) self.onResume( 0 )
def onLeftMouse( self ): # first see if there's a gizmo in the house if self.objInfo.overGizmo: # if so, let it take care of things WorldEditor.gizmoClick() return # we have to compare what's under the cursor to our selection # if there's no selection then (for now) set it to that # and do nothing more if not self.selection.size: self.selection.add( self.mouseRevealer ) self.selUpdate() return # if there's a selection but nothing under the mouse, # clear the selection if self.selection.size and not self.mouseRevealer.size: self.selection.rem( self.selection ) self.selUpdate() return # if the selection is different to what's under the mouse, # change the selection diff = WorldEditor.ChunkItemGroup() diff.add( self.selection ) diff.rem( self.mouseRevealer ) # cumbersome I know if diff.size: self.selection.rem( self.selection ) self.selection.add( self.mouseRevealer ) self.selUpdate() return # ok the selection and what's under the mouse are the same, # start a drag of the selection # first make the tool nt = WorldEditor.Tool() nt.locator = self.mouseLocator nt.functor = Functor.MatrixMover( self.selection ) # and then push it onto the stack. it'll pop itself off when done WorldEditor.pushTool( nt )