当前位置: 首页>>代码示例>>Python>>正文


Python WorldEditor.setOptionFloat方法代码示例

本文整理汇总了Python中WorldEditor.setOptionFloat方法的典型用法代码示例。如果您正苦于以下问题:Python WorldEditor.setOptionFloat方法的具体用法?Python WorldEditor.setOptionFloat怎么用?Python WorldEditor.setOptionFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WorldEditor的用法示例。


在下文中一共展示了WorldEditor.setOptionFloat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: actFreeSnapsExecute

# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import setOptionFloat [as 别名]
def actFreeSnapsExecute():
	newSnaps = ( 0.1, 0.1, 0.1 )
	WorldEditor.setOptionVector3( "snaps/movement", newSnaps )
	WorldEditor.setOptionFloat( "snaps/angle", 1 )
	WorldEditor.addCommentaryMsg( "Movement snaps are %f,%f,%f" % (newSnaps[0],newSnaps[1],newSnaps[2]) )
	WorldEditor.addCommentaryMsg( "Rotation snaps are %f" % WorldEditor.getOptionFloat( "snaps/angle" ) )
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:8,代码来源:ToolbarUIAdapter.py

示例2: ownKeyEvent

# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import setOptionFloat [as 别名]

#.........这里部分代码省略.........
			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 )
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:104,代码来源:WorldEditorDirector.py

示例3: actShellSnapsExecute

# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import setOptionFloat [as 别名]
def actShellSnapsExecute():
	WorldEditor.setOptionVector3( "snaps/movement", WorldEditor.getOptionVector3( "shellSnaps/movement" ) )
	WorldEditor.setOptionFloat( "snaps/angle", WorldEditor.getOptionFloat( "shellSnaps/angle" ) )
	newSnaps = WorldEditor.getOptionVector3( "snaps/movement" )
	WorldEditor.addCommentaryMsg( "Movement snaps are %f,%f,%f" % (newSnaps[0],newSnaps[1],newSnaps[2]) )
	WorldEditor.addCommentaryMsg( "Rotation snaps are %f" % WorldEditor.getOptionFloat( "snaps/angle" ) )
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:8,代码来源:ToolbarUIAdapter.py


注:本文中的WorldEditor.setOptionFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。