top of page
Search
  • Writer's pictureKevfx Studios

Houdini Python Viewer States

Updated: Sep 27, 2022

Users can interact with Houdini in viewport through Python Viewer States in the following ways:

  • Display handles

  • Interact with geometry

  • Display guide geometry

  • Interact with state parameters

  • Select geometry

  • Display a custom right-click menu

  • Interact using low-level UI events, like mouse, keyboard and tablet

  • Wrap changes in undo blocks

  • Run cross multiple context-levels

Interact using low-level UI events


UI Event Handlers

These are supported through ui_event, and they are:

  • onMouseEvent

  • onMouseDoubleClickEvent

  • onMouseWheelEvent

  • onKeyEvent

  • onKeyTransitEvent

  • onMenuAction

  • onMenuPreOpen

  • onParmChangeEvent

  • onNodeChangeEvent

  • onPlaybackChangeEvent

  • onCommand

Typical ui_event received via callback function's kwargs :

ui_event {
	<class hou.ViewerEvent>,
		'point': hou.Vector3(2.52767920,2.22849488,5.74832201),
		'dir': hou.Vector3(-0.63586962,0.45803502,-0.62118733),
		'hasQueuedEvents' :0, 
		'queuedEvents' : 0, 
		'value' :[0, 1524, ], 
		'reason' : hou.uiEventReason.Located, 
		'valueType' : hou.uiEventValueType.FloatArray,
		'device': {
			<class hou.UIEventDevice>,
				'isAltKey' : 0, 
				'isAutoRepeat' : 0, 
				'isKeyPressed' : 0, 
				'isKeyDown' : 0, 
				'isKeyUp' : 0,
				'isCapsLock' : 0, 
				'isCtrlKey' : 0, 
				'isKeyPad' : 0, 
				'isShiftKey' : 0, 
				'isFunctionKey' : 0,
				'isArrowDown' : 0, 
				'isArrowLeft' : 0, 
				'isArrowRight' : 0, 
				'isArrowUp' : 0, 
				'isLeftButton' : 0,
				'isMiddleButton' : 0, 
				'isRightButton' : 0, 
				'keyString' : '', 
				'keyValue' : 0, 
				'modifierString' : '',
				'mouseWheel' : 16.84, 
				'mouseX' : 0, 
				'mouseY' : 1524, 
				'isTablet' : 0, 
				'tabletAngle' : 0,
				'tabletPressure' : 1, 
				'tabletRoll' : 0, 
				'tabletTilt' : 90, 
				'time' : 573.8
		}
}

Lifecycle Event Handlers

  • onEnter

  • onInterrupt

  • onExit

  • onResume

  • onGenerate

Handle Event Handlers

  • onHandleToState

  • onStateToHandle

  • onBeginHandleToState

  • onEndHandleToState

Selection Event Handlers

  • onStartSelection

  • onSelection

  • onStopSelection

  • onLocateSelection

Drag & Drop Event Handlers

  • onDragTest

  • onDropGetOptions

  • onDropAccept

Drawing Event Handlers

  • onDraw

  • onDrawInterrupt



94 views0 comments

Recent Posts

See All

Comments


bottom of page