PyViewer — Natron 2.5.0 documentation

# PyViewer

## Synopsis

A PyViewer is a wrapper around a Natron Viewer. See detailed description…

### Functions

- def `seek` (frame)

- def `getCurrentFrame` ()

- def `startForward` ()

- def `startBackward` ()

- def `pause` ()

- def `redraw` ()

- def `renderCurrentFrame` ([useCache=True])

- def `setFrameRange` (firstFrame,lastFrame)

- def `getFrameRange` ()

- def `setPlaybackMode` (mode)

- def `getPlaybackMode` ()

- def `getCompositingOperator` ()

- def `setCompositingOperator` (operator)

- def `getAInput` ()

- def `setAInput` (index)

- def `getBInput` ()

- def `setBInput` (index)

- def `setChannels` (channels)

- def `getChannels` ()

- def `setProxyModeEnabled` (enabled)

- def `isProxyModeEnabled` ()

- def `setProxyIndex` (index)

- def `getProxyIndex` ()

- def `setCurrentView` (viewIndex)

- def `getCurrentView` (channels)

## Detailed Description

This class is a wrapper around a Natron Viewer, exposing all functionalities available as user interaction to the Python API.

To get a PyViewer , use the `getViewer(scriptName)` function, passing it the script-name of a viewer node.

### Member functions description

NatronGui.PyTabWidget.seek(frame)
  Parameters

    frame – `int`

Seek the timeline to a particular frame. All other viewers in the project will be synchronized to that frame.

NatronGui.PyTabWidget.getCurrentFrame()
  Return type

    `int`

Returns the current frame on the timeline.

NatronGui.PyTabWidget.startForward()

Starts playback, playing the video normally.

NatronGui.PyTabWidget.startBackward()

Starts playback backward, like a rewind.

NatronGui.PyTabWidget.pause()

Pauses the viewer if the playback is ongoing.

NatronGui.PyTabWidget.redraw()

Redraws the OpenGL widget without actually re-rendering the internal image. This is provided for convenience as sometimes the viewer might need refreshing for OpenGL overlays.

NatronGui.PyTabWidget.renderCurrentFrame([useCache=True])
  Parameters

    useCache – `bool`

Renders the current frame on the timeline. If useCache is False, the cache will not be used and the frame will be completely re-rendered.

NatronGui.PyTabWidget.setFrameRange(firstFrame, lastFrame)
  Parameters

    - firstFrame – `int`

    - lastFrame – `int`

Set the frame range on the Viewer to be [firstFrame , lastFrame] (included).

NatronGui.PyTabWidget.getFrameRange()
  Return type

    `Tuple`

Returns a 2-dimensional tuple of `int` containing [firstFrame , lastFrame].

NatronGui.PyTabWidget.setPlaybackMode(mode)
  Parameters

    mode – `NatronEngine.Natron.PlaybackModeEnum`

Set the playback mode for the Viewer, it can be either bouncing, looping or playing once.

NatronGui.PyTabWidget.getPlaybackMode()
  Return type

    `NatronEngine.Natron.PlaybackModeEnum`

Returns the playback mode for this Viewer.

NatronGui.PyTabWidget.getCompositingOperator()
  Return type

    `NatronEngine.Natron.ViewerCompositingOperatorEnum`

Returns the current compositing operator applied by the Viewer.

NatronGui.PyTabWidget.setCompositingOperator(operator)
  Parameters

    operator – `NatronEngine.Natron.ViewerCompositingOperatorEnum`

Set the current compositing operator applied by the Viewer.

NatronGui.PyTabWidget.getAInput()
  Return type

    `int`

Returns the index of the input (the same index used by `getInput(index)`) used by the A choice of the Viewer.

NatronGui.PyTabWidget.setAInput(index)
  Parameters

    index – `int`

Set the index of the input (the same index used by `getInput(index)`) used by the A choice of the Viewer.

NatronGui.PyTabWidget.getBInput()
  Return type

    `int`

Returns the index of the input (the same index used by `getInput(index)`) used by the B choice of the Viewer.

NatronGui.PyTabWidget.setBInput(index)
  Parameters

    index – `int`

Set the index of the input (the same index used by `getInput(index)`) used by the B choice of the Viewer.

NatronGui.PyTabWidget.setChannels(channels)
  Parameters

    channels – `NatronEngine.Natron.DisplayChannelsEnum`

Set the channels to be displayed on the Viewer.

NatronGui.PyTabWidget.getChannels()
  Return type

    `NatronEngine.Natron.DisplayChannelsEnum`

Returns the current channels displayed on the Viewer.

NatronGui.PyTabWidget.setProxyModeEnabled(enabled)
  Parameters

    enabled – `bool`

Set the proxy mode enabled.

NatronGui.PyTabWidget.isProxyModeEnabled(enabled)
  Return type

    `bool`

Returns whether the proxy mode is enabled.

NatronGui.PyTabWidget.setProxyIndex(index)
  Parameters

    index – `int`

Set the index of the proxy to use. This is the index in the combobox on the graphical user interface, e.g. index = 0 will be 2

NatronGui.PyTabWidget.getProxyIndex()
  Return type

    `int`

Returns the index of the proxy in use. This is the index in the combobox on the graphical user interface, e.g. index = 0 will be 2

NatronGui.PyTabWidget.setCurrentView(viewIndex)
  Parameters

    viewIndex – `int`

Set the view to display the given viewIndex. This is the index in the multi-view combobox visible when the number of views in the project settings has been set to a value greater than 1.

NatronGui.PyTabWidget.getCurrentView()
  Parameters

    viewIndex – `int`

Returns the currently displayed view index. This is the index in the multi-view combobox visible when the number of views in the project settings has been set to a value greater than 1.