hou.ViewerDragger class provides various methods to help implementing mouse dragging functionality
without worrying about many details like constraining the mouse movement or making sure drag coordinates
are computed relative to a specific origin.
A dragger operation can be divided in three parts:
start: This step configures the dragger for a specific drag operation.
drag: This actually executes the drag operation interactively as configured in step #1.
end: Ends the operation and cleanup the dragger.
Drag operations like translating a geometry along a plane, along a line or rotating a geometry around an axis can all be accomplished with a dragger.
Enables the dragger for moving the mouse anywhere in the viewport from a specific position.
startDrag from onMouseIndirectEvent with MMB, the dragger computes the
handle position relative to the world-space position under the mouse.
A hou.ViewerEvent object holding UI event information. This is typically the object
Houdini passes to a python handle or python state’s
A hou.Vector3 object describing the start position of the drag operation. For instance, this could be a python handle pivot.
startDragAcrossFloor(ui_event, start_pos, mouse_offset)
This method enables the dragger to move the mouse along the construction plane or the viewport reference plane grid.
startDragAlongLine(ui_event, line_origin, line_dir)
Configures the dragger to move the mouse along a line defined with a start point and a direction vector. When the line is picked and the mouse is moving, the dragger will constrain the mouse movement in the direction of the line.
startDragAlongPlane(ui_event, plane_point, plane_normal)
Configures the dragger to move the mouse along a plane defined with an origin point and a normal
vector. When the
LMB is down and the mouse is moving, the dragger will constrain the mouse
position to the plane.
startDragRotate(ui_event, center_pos, radius, rotate_axis, orient)
Configures the dragger to drag a “ring” around an axis.
A hou.Vector3 object representing the center of the rotation.
The radius of the rotation ring.
A hou.Vector3 vector representing the axis of rotation. This is typically a normalized vector used as the rotation plane normal.
A hou.Matrix3 object representing the orientation matrix of the axis.
Performs a drag operation based on the
start method previously called. Raises
hou.OperationFailed if the dragger was not initialized with a
Call this method when the mouse is being dragged. All dragger operations are done in world space
and can perform snapping (except for
rotation) if the dialog has the option enabled.
A hou.Vector3 vector representing the delta mouse position related to the drag start position.
A hou.Vector3 vector representing the absolute mouse position in world coordinates.
This dictionary is returned for the Drag Rotate operation:
A hou.Vector3 vector representing the delta angle in radians related to the rotation start position.
A hou.Vector3 vector representing the total angle in radians related to the rotation start position.
A hou.Vector3 vector representing the rotation ring absolute position related to the rotation start position.
A hou.Matrix3 matrix representing the delta rotation matrix related to the
Ends the current drag operation by releasing any drag cache and other settings performed by the dragger.
Returns True if the dragger is ready to use or False otherwise. One of the dragger
must be called first to make a dragger usable.
Returns the name of the dragger.
Returns the start position used for configuring the current drag operation. For the Drag Rotate operation, the returned value refers to the center of rotation.
Returns the start direction used for configuring the current drag operation.
Returns the start position on the rotation ring for the Drag Rotate operation.
Returns the current viewport.