本文整理汇总了Python中WorldEditor.getOptionString方法的典型用法代码示例。如果您正苦于以下问题:Python WorldEditor.getOptionString方法的具体用法?Python WorldEditor.getOptionString怎么用?Python WorldEditor.getOptionString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldEditor
的用法示例。
在下文中一共展示了WorldEditor.getOptionString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setObjectTab
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
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 )
示例2: update
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
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
示例3: handleWheelCameraSpeed
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
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
示例4: actSaveCameraPositionExecute
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
def actSaveCameraPositionExecute():
dir = WorldEditor.getOptionString( "space/mru0" )
dirDS = ResMgr.openSection( dir )
if not dirDS:
WorldEditor.addCommentaryMsg( "Unable to open local directory " + dir )
return
ds = dirDS["space.localsettings"]
if ds == None:
ds = dirDS.createSection( "space.localsettings" )
if ds == None:
WorldEditor.addCommentaryMsg( "Unable to create space.localsettings" )
return
m = WorldEditor.camera(0).view
m.invert()
ds.writeVector3( "startPosition", m.translation )
ds.writeVector3( "startDirection", (m.roll, m.pitch, m.yaw) )
ds.save()
WorldEditor.addCommentaryMsg( "Camera position saved" )
示例5: getBrowsePath
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
def getBrowsePath( self ):
#get model file out of the options.xml
return WorldEditor.getOptionString( "itemEditor/browsePath" )
示例6: updateState
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
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
示例7: onStart
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
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 )
#.........这里部分代码省略.........
示例8: ownKeyEvent
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
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
#.........这里部分代码省略.........
示例9: ualSelectFilterChange
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
def ualSelectFilterChange( value ):
if( WorldEditor.getOptionString( "tools/selectFilter" ) != value ):
WorldEditor.addCommentaryMsg( "Selection Filter: %s" % value )
WorldEditor.setOptionString( "tools/selectFilter", value )
setSelectionFilter( value )
示例10: cmbCoordFilterUpdate
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
def cmbCoordFilterUpdate():
return (WorldEditor.getOptionString( "tools/coordFilter" ), )
示例11: updateSelectionFilter
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
def updateSelectionFilter( item ):
if item.displayName == WorldEditor.getOptionString( "tools/selectFilter" ):
return 1
return 0
示例12: cmbSelectFilterUpdate
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
def cmbSelectFilterUpdate():
return (WorldEditor.getOptionString( "tools/selectFilter" ), )
示例13: brwObjectItemAdd
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
WorldEditor.setToolMode( "TerrainTexture" )
WorldEditor.setCurrentTexture( value )
def brwObjectItemAdd( ):
bd.itemTool.functor.script.addChunkItem()
def contextMenuGetItems( type, path ):
if path[-4:] == ".xml" and path.find( "particles" ) != -1:
return [ ( 1, "Edit in Particle Editor..." ) ]
elif path[-6:] == ".model":
return [ ( 2, "Edit in Model Editor..." ) ]
return []
def contextMenuHandleResult( type, path, command ):
if command == 1:
WorldEditor.launchTool( "particleeditor", "-o \"" + path + "\"" )
elif command == 2:
WorldEditor.launchTool( "modeleditor", "-o \"" + path + "\"" )
# set selection filter at launch
setSelectionFilter( WorldEditor.getOptionString( "tools/selectFilter" ) )
#--------------------------------------------------------------------------
# Section - PageChunkTexture related methods
#--------------------------------------------------------------------------
def setTerrainTextureParams( texture, uProjection, vProjection ):
"""This function changes the current texture used to paint the terrain."""
WorldEditor.setCurrentTextureFull( texture, uProjection, vProjection )
示例14: updateCamera
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import getOptionString [as 别名]
def updateCamera():
value = WorldEditor.getOptionString( "camera/speed" )
c = WorldEditor.camera()
c.speed = WorldEditor.getOptionFloat( "camera/speed/" + value, 60 )
c.turboSpeed = WorldEditor.getOptionFloat( "camera/speed/" + value + "/turbo", 120 )