本文整理汇总了Python中WorldEditor.isCapsLockOn方法的典型用法代码示例。如果您正苦于以下问题:Python WorldEditor.isCapsLockOn方法的具体用法?Python WorldEditor.isCapsLockOn怎么用?Python WorldEditor.isCapsLockOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldEditor
的用法示例。
在下文中一共展示了WorldEditor.isCapsLockOn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onMouseEvent
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import isCapsLockOn [as 别名]
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