This class models a viewport in the Compositor View that displays elements in an XY orientation.
Methods ¶
name()
→ string
Return the display name of the viewport.
draw()
Requests the viewport to redraw its contents. Multiple calls to draw()
within the same script execution will be coalesced into a single redraw operation for efficiency.
cameraToModelTransform()
→ hou.Matrix4
Returns the transformation matrix that converts coordinates from the viewport’s camera space into the local model space of the displayed elements.
mapToScreen(position)
→ hou.Vector2
Converts a world-space position to Compositor screen space coordinates as a hou.Vector2 object.
position
A hou.Vector3 representing the world-space position to convert.
mapToWorld(x, y)
→ tuple of (hou.Vector3, hou.Vector3)
Converts Compositor screen space position to world-space position. Returns a ray direction vector and a world position. The direction vector is computed from center view to world position.
x
The world-space X-position to convert.
y
The world-space Y-position to convert.
mapToBuffer(mouse_position)
→ hou.Vector2
Converts a mouse position to buffer coordinates as a hou.Vector2 object.
position
A hou.Vector2 representing cursor position.
geometry()
→ tuple of
int
Returns the position and dimensions of this viewport within the UI space. The tuple elements represent viewport coordinates relative to the lower-left corner of the Compositor Viewer.
Returned tuple:
-
X-coordinate of the lower-left corner.
-
Y-coordinate of the lower-left corner.
-
Width of the viewport.
-
Height of the viewport.