Scripting Viewports

Prerequisites

  • The following methods are exposed by the ViewportUtils object implemented by the module Thinkbox.Sequoia.Viewports
  • Before calling these methods, you must ensure the module is imported.
import Thinkbox.Sequoia.Viewports 1.0

Methods

<void> ViewportUtils.saveViewportImage ( <QUrl>fileName, [ <enum>imageMode ], [ <Bool>transparent ] )

  • Equivalent to the UI command Save Viewport Image.
  • Saves the active Viewport’s image to an image file.
  • The first argument is the image filename, where the extension will define the image format.
  • The second, optiona argument is the imageMode which defaults to Planar.

imageMode enums:

  • Planar
  • Cubic
  • Spherical
  • Panoramic
  • The third, optional argument controls the background transparency.
    • It defaults to False, which will cause the background gradient to be included in the saved image.
    • When set to True, the background will have black RGB and 0.0 Alpha.

<void> ViewportUtils.refreshViewport ( [ <String>documentId ], [ <CameraData>camera ] )

  • Redraws the specified Viewport.
  • The first, optional argument is the Document ID.
    • If not specified, the Active Document will be used.
  • The second, optional argument is the Camera associated with the Viewport to refresh.
    • If not specified, the Active Viewport will be refreshed.

<QVector3D> ViewportUtils.getViewportPosition ( [ <QString>documentId ] )

  • Returns the viewport position as a Vector3D value.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<void> ViewportUtils.setViewportPosition ( <QVector3D>pos [ , <QString>documentId ] )

  • Sets the viewport position to the Vector3D value specified by the first argument.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<QQuaternion> ViewportUtils.getViewportOrientation ( [ <QString>documentId ] )

  • Returns the viewport orientation as a Quaternion value.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<void> ViewportUtils.setViewportOrientation ( <QQuaternion>dir [, <QString>documentId ] )

  • Sets the viewport position to the Quaternion value specified by the first argument.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<double> ViewportUtils.getViewportFOVDegrees ( [ <QString>documentId ] )

  • Returns the viewport Field Of View as a Double value.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<void> ViewportUtils.setViewportFOVDegrees ( <double>value, [ <QString>documentId ] )

  • Sets the viewport Field Of View to the Double value specified by the first argument.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<double> ViewportUtils.getViewportFocusDistance ( [ <QString>documentId ] )

  • Returns the viewport Focus Distance as a Double value.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<void> ViewportUtils.setViewportFocusDistance ( <double>distance [ , <QString> documentId ] )

  • Sets the viewport Focus Distance to the Double value specified by the first argument.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<double> ViewportUtils.getViewportClippingNear ( [ <QString>documentId ] )

  • Returns the viewport Near Clip Distance as a Double value.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<void> ViewportUtils.setViewportClippingNear ( <double>value, [ <QString>documentId ] )

  • Sets the viewport Near Clip Distance to the Double value specified by the first argument.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<double> ViewportUtils.getViewportClippingFar ( [ <QString>documentId ] )

  • Returns the viewport Far Clip Distance as a Double value.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<void> ViewportUtils.setViewportClippingFar ( <double>value, [ <QString>documentId ] )

  • Sets the viewport Far Clip Distance to the Double value specified by the first argument.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<double> ViewportUtils.getViewportClippingRange ( [ <QString>documentId ] )

  • Returns the viewport Clipping Range as a Double value.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.

<void> ViewportUtils.setViewportClippingRange ( <double>value, [ <QString>documentId ] )

  • Sets the viewport Clipping Range to the Double value specified by the first argument.
  • The second, optional argument is the Document ID.
    • If not specified, the Active Document will be used.