本文整理汇总了Python中WorldEditor类的典型用法代码示例。如果您正苦于以下问题:Python WorldEditor类的具体用法?Python WorldEditor怎么用?Python WorldEditor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WorldEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: toggleItemSnaps
def toggleItemSnaps( self ):
if self.itemSnapMode == 1:
self.itemSnapMode = 0
else:
self.itemSnapMode = 1
WorldEditor.setOptionInt( "snaps/itemSnapMode", self.itemSnapMode )
self.updateItemSnaps()
示例2: enterChunkVizMode
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" )
示例3: startDragSelect
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 )
示例4: actUndoExecute
def actUndoExecute():
what = WorldEditor.undo(0)
if what:
WorldEditor.addCommentaryMsg( "Undoing: " + what )
WorldEditor.undo()
bd.itemTool.functor.script.selUpdate()
示例5: doRedo
def doRedo( item ):
what = WorldEditor.redo(0)
if what:
WorldEditor.addCommentaryMsg( "Redoing: " + what )
WorldEditor.redo()
bd.itemTool.functor.script.selUpdate()
示例6: render
def render( self, dTime ):
"""This function forces World Editor to render everything on the scene.
Usually called everyframe, however it still recieves a dTime value which
informs the renderer how much time has passed since the last render call."""
WorldEditor.camera().render( dTime )
WorldEditor.render( dTime )
GUI.draw()
return 1
示例7: onPause
def onPause( self ):
self.cc.visible = 0
self.cc.delAsView()
if ( WorldEditor.tool() != None ):
WorldEditor.popTool()
pass
示例8: doUndo
def doUndo( item ):
"""This function performs an undo operation."""
what = WorldEditor.undo(0)
if what:
WorldEditor.addCommentaryMsg( "Undoing: " + what )
WorldEditor.undo()
bd.itemTool.functor.script.selUpdate()
示例9: setObjectTab
def setObjectTab( self, tabName ):
if self.tabName != "":
# store the current selection
currentFilter = WorldEditor.getOptionString( "tools/selectFilter" )
prevSectionName = "object/" + self.tabName + "/selectFilter"
WorldEditor.setOptionString( prevSectionName, currentFilter )
self.tabName = tabName
currSectionName = "object/" + self.tabName + "/selectFilter"
return WorldEditor.getOptionString( currSectionName )
示例10: edtMiscSnapsXExit
def edtMiscSnapsXExit( value ):
if value[-2:] == "cm":
floatValue = float(value[:-2])/100.0
elif value[-1] == "m":
floatValue = float(value[:-1])
else:
floatValue = float(value)
ns = WorldEditor.getOptionVector3( "snaps/movement" )
WorldEditor.setOptionVector3( "snaps/movement", ( floatValue, ns[1], ns[2] ) )
示例11: edtFarPlaneExit
def edtFarPlaneExit( value ):
"""This function allows the farPlane distance to be set in centimetres and metres."""
if value[-2:] == "cm":
floatValue = float(value[:-2])/100.0
elif value[-1] == "m":
floatValue = float(value[:-1])
else:
floatValue = float(value)
WorldEditor.farPlane( floatValue )
示例12: updateItemSnaps
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()
示例13: handleWheelCameraSpeed
def handleWheelCameraSpeed( self, mz ):
# look at the rotator for changing the camera speed
c = WorldEditor.camera()
currentValue = WorldEditor.getOptionString( "camera/speed" )
speeds = ["Slow", "Medium", "Fast", "SuperFast"]
iSpeed = 0
if currentValue == speeds[1]:
iSpeed = 1
elif currentValue == speeds[2]:
iSpeed = 2
elif currentValue == speeds[3]:
iSpeed = 3
if mz > 0:
iSpeed = iSpeed + 1
if iSpeed > 3:
iSpeed = 3
elif mz < 0:
iSpeed = iSpeed - 1
if iSpeed < 0:
iSpeed = 0
value = speeds[iSpeed]
handled = 0
if value != currentValue:
c = WorldEditor.camera()
WorldEditor.setOptionString( "camera/speed", value )
c.speed = WorldEditor.getOptionFloat( "camera/speed/" + value )
c.turboSpeed = WorldEditor.getOptionFloat( "camera/speed/" + value + "/turbo" )
handled = 1
WorldEditor.addCommentaryMsg( "New camera speed %s" % value, 1 )
return handled
示例14: pgcTerrainTabSelect
def pgcTerrainTabSelect( value ):
if value == "tabTerrainTextures":
bd.enterMode( "TerrainTexture" )
elif value == "tabTerrainBrushes":
bd.enterMode( "TerrainHeight" )
elif value == "tabTerrainFilters":
bd.enterMode( "TerrainFilter" )
elif value == "tabTerrainTools":
bd.enterMode( "TerrainHoleCut" )
else:
WorldEditor.addCommentaryMsg( value + " unknown tab", 1 )
示例15: update
def update( self, dTime, tool ):
if self.currentSpace_ != WorldEditor.getOptionString( "space/mru0" ):
self.currentSpace_ = WorldEditor.getOptionString( "space/mru0" )
set_clear( self.selection )
self.selUpdate()
if self.objInfo.overGizmo:
self.mouseView.revealer = None
else:
self.mouseView.revealer = self.mouseRevealer
# TODO: Check if mouse button down and threshold crossed.
# If so start a drag with the current object
pass