Houdini 19.0 Python scripting hou hou.GeometryViewport

hou.GeometryViewport class

A viewport within a Scene Viewer pane, for viewing the scene at the Object or SOP level.

On this page

Overview

A viewer is a type of pane that shows the scene. The viewer’s contents is conceptually divided into viewports. By default, the scene viewer shows a single viewport, the Perspective view. However, you can use the view layout controls to, for example, split the view into four viewports (Perspective, Top, Front, and Right views). Viewports are the parts of the interface that actually display the scene to the user.

To access a viewport, you must first get a reference to a Scene Viewer pane tab. See the following methods:

hou.ui.paneTabOfType()

Use hou.ui.paneTabOfType(hou.paneTabType.SceneViewer) to get a reference to a Scene Viewer pane tab in the current pane layout. If the current layout has no Scene Viewer pane tab, this returns None.

To be more precise about which viewer you grab in a possible multi-viewer layout, see also hou.ui.curDesktop() to get a hou.Desktop object representing the current pane layout, and hou.Desktop.sceneViewers to get a list of scene viewer pane tabs in the current layout.

Once you have a reference to a hou.SceneViewer pane object, you can use it to access the viewer pane’s viewport or viewports. See the following methods:

hou.SceneViewer.viewports()

Returns a list of the viewports in the viewer pane.

hou.SceneViewer.findViewport()

Gets a single viewport by name, for example "Top".

hou.SceneViewer.selectedViewport()

Gets the currently “selected” viewport. The user can select a viewport by pressing Space + N in the viewport. The view menus in the upper right corner are drawn brighter in the selected viewport.

Methods

Viewport framing

In general, homing resets the view direction to the default view, while framing keeps the current view direction and just moves the viewpoint.

Viewpoint and cameras

  • Unlike some other 3D packages, in Houdini the view is not always linked to an actual Camera object. The may be “locked” to a camera (so changing the view tumbles/moves the camera), or it may be a “free” (“No camera”) view not tied to a camera, or it may be temporarily looking through a camera (or light), but the view is not locked to the camera (so changing the view will not affect the camera). The user interface for these settings is the camera menu in the top right corner of each viewport, and the Lock Camera button on the view toolbar.

    Most of the methods in this section are not affected by the difference. For example, if the view is “free”, the defaultCamera() method will return an object that manipulates just the view, but if the view is locked to a camera, it will return an object that manipulates the linked camera.

  • You can tell if the view is currently looking through a camera/light if the result of camera() is not None. This does not tell you whether the view is locked to the camera or not.

  • The following talks about the camera representing the “viewpoint” as a shorthand, however the viewport camera stores many settings besides the viewpoint position and direction, including pivot, aspect ratio, clipping planes, and so on.

Settings

Selection

Callbacks

hou.GeometryViewport