hou.ViewerEvent objects are used with Python states. Houdini will call event handlers with a dictionary containing various useful data, including a
ui_event key containing a
ViewerEvent object. You do not instantiate this type of object yourself.
See Python states for more information.
hou.ViewerEvent is a specialized hou.UIEvent class that you can used for accessing ray coordinates in a viewer.
Returns a tuple of two hou.Vector3 objects representing the origin point and a direction vector of a "pointing ray" in 3D world space corresponding to the underlying hou.UIEventDevice's mouse coordidnates in screen space.
The resulting ray can be used to shoot into the scene that passes through whatever is under the mouse. The method puts the ray origin at the mouse screen coordinates on the near plane and then maps the camera space position to world space. For a perspective projection, the near plane part of the frustum is usually small in world space, so the origin point will be pretty close to the camera position.
(origin_point, direction, snapped)
Same as hou.ViewerEvent.ray(), but the returned original point may be snapped with respect to the snapping controls in Houdini. The tuple returns the hou.Vector3 objects representing the origin point and a direction vector along with a
bool value (
snapped) representing the snap result.
True, the origin point corresponds to a snapped coordinate in 3D world space. If
False, the origin point is a regular "pointing ray".
snapped may be
False if snap is not enabled or the origin point doesn’t correspond to a snapped point.
Methods from hou.UIEvent
Returns an object containing input-device-specific event data.
For example, if this is a mouse click event, you can use
event.device().mouseX() to get the X coordinate in screen space, and
event.device().isLeftButton() to check whether the left mouse button was pressed.
if ui_event.device().isLeftButton(): ...
Returns true if this event contains queued device events.
If hou.UIEvent.hasQueuedEvents() returns True, this method returns the list of queued input device events.
Returns the "value" payload of this event. You can tell the C++ type of this value by calling hou.UIEvent.valueType().
Returns an enum value corresponding to the event value’s C++ type, or
hou.uiEventValueType.NoType if the event contains no single scalar value.