Methods
Viewport framing
home()
homeAll()
Homes the viewport on all geometry objects.
homeSelected()
Homes the viewport on the selected geometry.
homeGrid()
Homes the viewport on the grid.
homeNonTemplated()
Homes the viewport on all non-templated geometry.
frameAll()
Frames the viewport on all geometry objects.
frameBoundingBox(bbox)
Frames the viewport on giving bounding box
frameSelected()
Frames the viewport on the selected geometry.
frameGrid()
Frames the viewport on the grid.
frameNonTemplated()
Frames the viewport on all non-templated geometry.
viewTransform()
Returns the transform matrix of the viewport.
viewPivot()
Returns the pivot of the viewport.
Cameras
camera()
→ ObjNode or None
Return the camera or light node that the viewport is looking through. Return None if the viewport is not looking through a camera or light node.
saveViewToCamera(camera_node)
Saves the viewport’s current view into the given camera node. It does this by setting the camera’s transform parameters to match the viewport’s view transform matrix.
setCamera(camera_node)
Makes the viewport look through the given camera node.
defaultCamera()
→ hou.GeometryViewportCamera
Query the current camera settings of the viewport. This may be the settings applied by an object if the viewport is looking through a camera (or light).
setDefaultCamera(cam_settings)
Set the current camera settings of the viewport to the settings stored in cam_setting
. If the viewport is looking through a camera and the view is not locked to the camera, it will be switched to "No camera". If the view is locked to the camera, the camera object will be updated instead.
useDefaultCamera()
Set the viewport camera to "No camera" and stop looking through a camera object (or light).
draw()
Request that the viewport redraw. Multiple draw()
calls within the same script will be merged into a single call.
Settings
isOpen()
name()
→ str
Query of the name of the viewport (persp1
, top1
, etc).
changeName(str)
Set the name of the viewport.
settings()
→ hou.GeometryViewportSettings
Set the name of the viewport. Setting the name does not affect its type, so naming a perspective view front
will be confusing. This is best used in conjunction with changeType()
.
type()
→ hou.geometryViewportType enum value
Query the viewport type (UV, 3D, top, left, etc).
changeType([Hom:hou.geometryViewportType])
Set the viewport type (hou.geometryViewportType). This method first attempts to restore a stashed view for the new viewport type, but failing that, will home the viewport.
Selection
queryNodeAtPixel(x, y)
→ hou.ObjNode, hou.SopNode, or None
Return the node draw at the specified pixel in the viewport, or None
if
there is nothing there. The type of node returned depends on the level of
the viewer.
queryPrimAtPixel(node, x, y)
→ hou.Prim or None
Return the primitive drawn at the specified pixel in the viewport, or
None
if there is nothing there. The primitive returned will be a
subclass of hou.Prim.
The parameter node is used to restrict the query to geometry within a particular node. If node is None, then the query is unrestricted.
queryInspectedGeometry()
→ hou.Geometry or None
Return the geometry currently being inspected in the viewport, or None
when nothing is being inspected or when called outside of an inspect
script.
queryInspectedPrim()
→ hou.Prim or None
Return the primitive currently being inspected in the viewport, or None
when nothing is being inspected or when called outside of an inspect
script. The primitive returned will be a subclass of hou.Prim.
mapToScreen(position)
→ hou.Vector2
Convert world coordinates to viewport coordinates.
position
A hou.Vector3 containing a world space position.
mapToWorld(x, y)
→ tuple of (hou.Vector3, hou.Vector3)
Convert viewport coordinates to world coordinates. Returns a ray (direction vector and an origin point).
mapFromMouseChop(x, y)
→ tuple of (int, int)
Convert from the Mouse CHOP’s X and Y screen values (which range from -1
to 1
) to viewport coordinates, where (0,0)
is the bottom left corner of
the viewport.
Replaces |