def updateItemSnaps( self ):
		#this method calculates itemSnapMode based on the
		#entries in the options.xml
		if ( WorldEditor.getOptionInt( "snaps/itemSnapMode" ) == 2 ):
			self.itemSnapMode = 2
		elif ( WorldEditor.getOptionInt( "snaps/itemSnapMode" ) == 1 ):
			self.itemSnapMode = 1
		else:
			self.itemSnapMode = 0
		self.enterItemSnapMode()
	def enterChunkVizMode( self ):
		t = WorldEditor.tool()
		if ( t != None ):
			curr = WorldEditor.getOptionInt( "render/chunk/vizMode" )
			t.delView( "chunkViz" )
			
			vizRes = 0;
			if t.functor == self.alphaTool.functor:
				vizRes = WorldEditor.terrainBlendsRes()
			elif t.functor == self.itemTool.functor or t.functor == self.heightTool.functor or t.functor == self.filterTool.functor:
				vizRes = WorldEditor.terrainHeightMapRes()
			elif t.functor == self.holeTool.functor:
				vizRes = WorldEditor.terrainHoleMapRes()
			
			if vizRes == 0:
				self.needsChunkVizUpdate = True
				vizRes = 1  # set it to some sensible value
			else:
				self.needsChunkVizUpdate = False
			
			if curr == 1:
				t.addView( self.chunkViz, "chunkViz" )
			elif curr == 2:
				self.vertexViz.numPerChunk = vizRes
				t.addView( self.vertexViz, "chunkViz" )
			elif curr == 3:
				self.meshViz.numPerChunk = vizRes
				t.addView( self.meshViz, "chunkViz" )
Esempio n. 3
0
	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 ):
		self.clickX = 0
		self.clickY = 0
		
		# 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

		if not self.mouseRevealer.size:
			# nothing to click on, start a marquee selection. This will take
			# care of clearing the selection if it's only a click.
			self.startDragSelect()
			return

		# Check if control is held down, it indicates that we want to toggle
		# what's pointed to in/out of the selection
		if (WorldEditor.isKeyDown( KEY_LCONTROL ) or WorldEditor.isKeyDown( KEY_RCONTROL )):
			# if we're pointing at a subset of the selection
			if set_issubset( self.selection, self.mouseRevealer):
				# remove the subset
				self.selection.rem( self.mouseRevealer )
				self.selUpdate()
				return
			else:
				# add the mouseRevealer to the selection
				set_union( self.selection, self.mouseRevealer )
				self.selUpdate()
				return
		else:
			# if the selection is totally different to what's under the mouse
			# specifically, if we're only pointing at a subset of the
			# selection, we don't want to set the selection to that, we want
			# to drag it instead (which happens below )
			#if not set_intersection_new( self.selection, self.mouseRevealer).size:
			if not set_issubset( self.selection, self.mouseRevealer ):
				# set the selection to what's under the mouse
				set_assign( self.selection, self.mouseRevealer )
				self.selUpdate()



		# nothing under the mouse, bail
		if not self.selection.size:
			return

		if not WorldEditor.getOptionInt( "dragOnSelect" ):
			if not WorldEditor.isKeyDown( KEY_V ):
				return

		# ok, it's drag time
		self.dragging = 1
Esempio n. 5
0
	def __call__( self ):
		oldValue = WorldEditor.getOptionInt( self.path )
		newValue = not oldValue
		WorldEditor.setOption( self.path, newValue )
		if self.postFunction:
			self.postFunction( newValue )
Esempio n. 6
0
def toggleBSP( self ):
	bd.showBSPMsg( WorldEditor.getOptionInt( "drawBSP" ) )
Esempio n. 7
0
def onOrthoMode( self ):
	if WorldEditor.getOptionInt( "camera/ortho" == 1 ):
		WorldEditor.changeToCamera(1)
	else:
		WorldEditor.changeToCamera(0)
Esempio n. 8
0
def updateUmbraDisabled(item):
    return BigWorld.getWatcher(
        "Render/Umbra/enabled") == "false" and WorldEditor.getOptionInt(
            "render/useUmbra") == 0
	def updateState( self, dTime ):
		"""This function forces an update to be called in World Editor. 
		Usually called everyframe, however it still recieves a dTime 
		value which informs the update function how much time has passed 
		since the last update call."""

		# detect a change of space, and act accordingly
		if self.currentSpace != WorldEditor.getOptionString( "space/mru0" ):
			self.currentSpace = WorldEditor.getOptionString( "space/mru0" )
			# make sure the chunk viz resolution is set correctly
			self.enterChunkVizMode()

		GUI.update( dTime )
		self.cc.update( dTime )
		WorldEditor.camera().update( dTime )
		if ( WorldEditor.tool() != None and not WorldEditor.tool().applying ):
			self.objInfo.overGizmo = WorldEditor.gizmoUpdate( WorldEditor.worldRay() )

		# update the WorldEditor
		WorldEditor.update( dTime )

		# update tool views
		base = dTime / 5
		self.alphaToolTextureView.rotation += base * (1 + (self.alphaTool.strength / 650))
		self.heightView.rotation += base * (1 + (self.heightTool.strength / 650))
		self.filterToolTextureView.rotation += base

		if self.nextTimeDoSelUpdate == 2:
			self.itemTool.functor.script.restoreOldSelection()
			self.nextTimeDoSelUpdate = 0
		elif self.nextTimeDoSelUpdate == 1:
			self.itemTool.functor.script.clearAndSaveSelection()
			self.nextTimeDoSelUpdate = 2

		if WorldEditor.isInPlayerPreviewMode() and not self.avatarMode:
			WorldEditor.addCommentaryMsg( "entered avatar walkthrough mode." )
			self.avatarMode = 1
		if self.avatarMode and not WorldEditor.isInPlayerPreviewMode():
			self.qDown = 0
			self.eDown = 0
			self.avatarMode = 0
		if self.avatarMode:
			value = WorldEditor.getOptionString( "camera/speed" )
			speed = 1
			if value == "Medium":
				speed = 2
			if value == "Fast":
				speed = 3
			if value == "SuperFast":
				speed = 4
			if self.qDown and WorldEditor.getOptionInt( "graphics/cameraHeight" ) - speed <= 2:
				WorldEditor.setOptionInt( "graphics/cameraHeight", 2 )
			if self.qDown and WorldEditor.getOptionInt( "graphics/cameraHeight" ) > 2:
				WorldEditor.setOptionInt( "graphics/cameraHeight", WorldEditor.getOptionInt( "graphics/cameraHeight" ) - speed )
			if self.eDown:
				WorldEditor.setOptionInt( "graphics/cameraHeight", WorldEditor.getOptionInt( "graphics/cameraHeight" ) + speed )

			WorldEditor.snapCameraToTerrain()

		if WorldEditor.tool() == bd.alphaTool:
			bd.alphaTool.size						= WorldEditor.getOptionFloat  ( "terrain/texture/size" )
			bd.alphaTool.strength					= WorldEditor.getOptionFloat  ( "terrain/texture/strength" )
			bd.alphaTool.functor.displayOverlay		= WorldEditor.getOptionInt    ( "terrain/texture/maskoverlay" )
		
			WorldEditor.setPaintLayer(bd.alphaTool.functor.lastPaintedLayer)
			WorldEditor.setPaintPos(bd.alphaTool.functor.lastPaintedPos)
			if bd.alphaTool.functor.hadEscapeKey != 0:
				WorldEditor.setTerrainPaintEscKey(bd.alphaTool.functor.hadEscapeKey)
				bd.alphaTool.functor.hadEscapeKey = 0

		bd.heightTool.size						= WorldEditor.getOptionFloat ( "terrain/height/size" )
		bd.heightTool.strength					= WorldEditor.getOptionFloat ( "terrain/height/strength" )
		bd.setHeightFunctor.height				= WorldEditor.getOptionFloat ( "terrain/height/height" )
		bd.setHeightFunctor.relative			= WorldEditor.getOptionInt   ( "terrain/height/relative" )
		bd.heightFunctor.falloff				= WorldEditor.getOptionInt   ( "terrain/height/brushFalloff" )
																		
		bd.filterTool.size						= WorldEditor.getOptionFloat ( "terrain/filter/size" )
		bd.filterTool.functor.index				= WorldEditor.getOptionInt   ( "terrain/filter/index" )
																		
		bd.holeTool.size						= WorldEditor.getOptionFloat ( "terrain/cutRepair/size" )
		bd.holeTool.functor.fillNotCut			= WorldEditor.getOptionInt   ( "terrain/cutRepair/brushMode" )
		
		if self.needsChunkVizUpdate:
			self.enterChunkVizMode()
		
		return 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 onMouseEvent( self, mx, my, mz ):
		handled = 0

		if mx or my:
			self.mouseMoved = 1

		legacyMouse = WorldEditor.getOptionInt( "input/legacyMouseWheel" )
		itemsRotated = 0
		cameraSpeedChanged = False
		
		if legacyMouse != 0:
			# if using legacy mouse
			if WorldEditor.isKeyDown( KEY_MOUSE1 ):
				# Change camera speed with right click
				self.handleWheelCameraSpeed( mz )
				cameraSpeedChanged = True
			elif WorldEditor.tool():
				# handle the tool
				handled = WorldEditor.tool().handleMouseEvent( mx, my, mz )
				itemsRotated = self.itemTool.functor.script.selection.size
		else: 
			# if using new mouse
			if WorldEditor.tool() and mz == 0:
				# handle the tool
				handled = WorldEditor.tool().handleMouseEvent( mx, my, mz )
			elif WorldEditor.isKeyDown( KEY_SPACE ):
				# Change camera speed with space
				self.handleWheelCameraSpeed( mz )
				cameraSpeedChanged = True
			elif ( WorldEditor.isKeyDown( KEY_LSHIFT ) or WorldEditor.isKeyDown( KEY_RSHIFT ) ) and WorldEditor.tool():
				# handle the tool with shift
				handled = WorldEditor.tool().handleMouseEvent( mx, my, mz )
				itemsRotated = self.itemTool.functor.script.selection.size
			elif mz != 0 and \
					( WorldEditor.isKeyDown( KEY_LCONTROL ) or WorldEditor.isKeyDown( KEY_RCONTROL ) ) and \
					self.itemTool.functor.script.selection.size > 0:
				WorldEditor.rotateSnap( self.itemTool.functor.script.selection, mz, self.itemTool.functor.script.mouseRevealer )
				itemsRotated = self.itemTool.functor.script.selection.size

		if not handled:
			handled = WorldEditor.camera().handleMouseEvent( mx, my, mz )
		
		if not handled and ( mz != 0 ) and not itemsRotated and not cameraSpeedChanged:
			# zoom using scroll wheel
			handled = 1
			view = WorldEditor.camera().view
			view.invert()
			mult = mz / 1200.0

			if WorldEditor.isCapsLockOn():
				mult = mult * WorldEditor.camera().turboSpeed
			else:
				mult = mult * WorldEditor.camera().speed
			
			forward = view.applyToAxis( 2 )
			
			view.translation = (
				view.translation[0] + forward[0] * mult,
				view.translation[1] + forward[1] * mult,
				view.translation[2] + forward[2] * mult )
			
			view.invert()
			WorldEditor.camera().view = view

		return handled
	def ownKeyEvent( self, key, modifiers ):
		
		if key == KEY_B:
			if (modifiers & MODIFIER_CTRL) == 0:
				curr = WorldEditor.getOptionInt( "drawBSP" )
				curr = ( curr + 1 ) % 2
				WorldEditor.setOptionInt( "drawBSP", curr )
				self.showBSPMsg( curr )
		
		elif key == KEY_M:
			curr = WorldEditor.getOptionInt( "dragOnSelect" )
			curr = ( curr + 1 ) % 2
			WorldEditor.setOptionInt( "dragOnSelect", curr )
			self.dragOnSelectMsg( curr )
	
		elif key == KEY_F8:
			curr = WorldEditor.getOptionString( "tools/coordFilter" )
			if curr == "World":
				curr = "Local"	
			elif curr == "Local":
				curr = "View"
			elif curr == "View":
				curr = "World"
			WorldEditor.setOptionString( "tools/coordFilter", curr )	
			WorldEditor.addCommentaryMsg( "Reference Coordinate System: %s" % curr )
		
		elif key == KEY_L:
			if modifiers & MODIFIER_CTRL:
				curr = WorldEditor.getOptionInt( "render/lighting" )
				curr = ( curr + 1 ) % 3
				WorldEditor.setOptionInt( "render/lighting", curr )
				self.lightingModeMsg( curr )
				
		elif key == KEY_G:
			curr = WorldEditor.getOptionInt( "snaps/xyzEnabled" )
			curr = ( curr + 1 )% 2
			WorldEditor.setOptionInt( "snaps/xyzEnabled", curr )
			self.objectSnapMsg( curr )

		elif key == KEY_1 and not modifiers:
			WorldEditor.setToolMode( "Objects" )
			
		elif key == KEY_2 and not modifiers:
			WorldEditor.setToolMode( "TerrainTexture" )
			
		elif key == KEY_3 and not modifiers:
			WorldEditor.setToolMode( "TerrainHeight" )
			
		elif key == KEY_4 and not modifiers:
			WorldEditor.setToolMode( "TerrainFilter" )
			
		elif key == KEY_5 and not modifiers:
			WorldEditor.setToolMode( "TerrainMesh" )
			
		elif key == KEY_6 and not modifiers:
			WorldEditor.setToolMode( "TerrainImpExp" )
			
		elif key == KEY_7 and not modifiers:
			WorldEditor.setToolMode( "Project" )
		
		t = WorldEditor.tool()

		sizeSection = ''
		strengthSection = ''
		minSizeSection = ''
		maxSizeSection = ''
		minStrengthSection = ''
		maxStrengthSection = ''
		if t == self.alphaTool:
			sizeSection = 'terrain/texture/size'
			minSizeSection = 'terrain/texture/minsizelimit'
			maxSizeSection = 'terrain/texture/maxsizelimit'
			strengthSection = 'terrain/texture/strength'
			minStrengthSection = 'terrain/texture/minstrengthlimit'
			maxStrengthSection = 'terrain/texture/maxstrengthlimit'
		elif t == self.heightTool:
			sizeSection = 'terrain/height/size'
			minSizeSection = 'terrain/height/minsizelimit'
			maxSizeSection = 'terrain/height/maxsizelimit'
			strengthSection = 'terrain/height/strength'
			minStrengthSection = 'terrain/height/minstrengthlimit'
			maxStrengthSection = 'terrain/height/maxstrengthlimit'
		elif t == self.filterTool:
			sizeSection = 'terrain/filter/size'
			minSizeSection = 'terrain/filter/minsizelimit'
			maxSizeSection = 'terrain/filter/maxsizelimit'
		elif t == self.holeTool:
			sizeSection = 'terrain/cutRepair/size'
			minSizeSection = 'terrain/cutRepair/minsizelimit'
			maxSizeSection = 'terrain/cutRepair/maxsizelimit'

		if sizeSection:
			size = WorldEditor.getOptionFloat( sizeSection )
			minSize = WorldEditor.getOptionFloat( minSizeSection )
			maxSize = WorldEditor.getOptionFloat( maxSizeSection )
			if key == KEY_RBRACKET:
				if not ( modifiers & MODIFIER_SHIFT ):
					size = size * 1.25 + 1
					if size > maxSize:
						size = maxSize
					t.size = size
					WorldEditor.setOptionFloat( sizeSection, size )
					WorldEditor.addCommentaryMsg( "Tool size %0.1f" % size )
			elif key == KEY_LBRACKET:
				if not ( modifiers & MODIFIER_SHIFT ):
					size = size * 0.8 - 1
					if size < minSize:
						size = minSize
					t.size = size
					WorldEditor.setOptionFloat( sizeSection, size )
					WorldEditor.addCommentaryMsg( "Tool size %0.1f" % size )
		if strengthSection:
			strength = WorldEditor.getOptionFloat( strengthSection )
			minStrength = WorldEditor.getOptionFloat( minStrengthSection )
			maxStrength = WorldEditor.getOptionFloat( maxStrengthSection )
			if key == KEY_RBRACKET and strength >= 0 or key == KEY_LBRACKET and strength < 0:
				if modifiers & MODIFIER_SHIFT:
					if strength >= 0:
						strength = strength * 1.25 + 1
					else:
						strength = strength * 1.25 - 1
					if strength > maxStrength:
						strength = maxStrength
					t.strength = strength
					WorldEditor.setOptionFloat( strengthSection, strength )
					WorldEditor.addCommentaryMsg( "Tool strength %0.1f" % strength )
			elif key == KEY_LBRACKET and strength >= 0 or key == KEY_RBRACKET and strength < 0:
				if modifiers & MODIFIER_SHIFT:
					if strength >= 0:
						strength = strength * 0.8 - 1
					else:
						strength = strength * 0.8 + 1
					if strength < minStrength:
						strength = minStrength
					t.strength = strength
					WorldEditor.setOptionFloat( strengthSection, strength )
					WorldEditor.addCommentaryMsg( "Tool strength %0.1f" % strength )
	def startDragSelect( self ):
		# add a drag select tool, which will pop itself and set our
		# selection when done.
		nt = WorldEditor.Tool()
		nt.locator = bd.itemTool.locator.subLocator
		nt.functor = Functor.ScriptedFunctor( DragSelectFunctor(nt, self) )
		WorldEditor.pushTool( nt )
		
	def dragDeltaExceeded( self ):
		return abs( self.clickX ) > self.dragStartDelta or abs( self.clickY ) > self.dragStartDelta

	def onMouseEvent( self, (dx,dy,dz), tool ):
		if dz != 0 \
			and ( WorldEditor.isKeyDown( KEY_LSHIFT ) \
				  or WorldEditor.isKeyDown( KEY_RSHIFT ) \
				  or WorldEditor.getOptionInt( "input/legacyMouseWheel" ) != 0 ) \
			and self.selection.size:
			rotateTool = WorldEditor.Tool()
			rotateTool.functor = Functor.WheelRotator()
			rotateTool.locator = Locator.OriginLocator()

			rotateTool.handleMouseEvent( dx, dy, dz )

			# Add the mousewheel rotate tool, it'll automatically pop itself
			WorldEditor.pushTool( rotateTool )

		if not WorldEditor.isKeyDown( KEY_MOUSE0 ):
			# just to make sure that leftMouseDown has a consistent value
			self.leftMouseDown = 0
		
		if self.dragging:
Esempio n. 14
0
def updateUmbraDisabled( item ):
	return BigWorld.getWatcher( "Render/Umbra/enabled") == "false" and WorldEditor.getOptionInt("render/useUmbra") == 0