Python Interface

 

The Python interface for the plugin is at the alpha testing stage, and included in the plugin installer from release 3.1.2.29. You can modify anything in the Octane scene via python, however when you next update the scene in Nuke, the plugin will reload parts of the scene into Octane from Nuke, potentially overwriting your changes. Refer to C:\Program Files\Common Files\NUKE\[nuke version]\plugins\OctaneRender.bundle\octane.py for a complete list of the functions available.

To load the Octane module

import os  
os.chdir("C:/Program Files/Common Files/NUKE/9.0/plugins/OctaneRender.bundle")  
import octane

# Examples of accessing Octane information
if octane.IsStarted():
  # Pause rendering
  octane.PauseRendering()

  # Restart rendering - if paused
  octane.RestartRendering()

  # Restart rendering - reload the scene
  octane.RestartRendering()

  # Get the rendertarget node
  rendertargetNode = octane.GetRenderTargetNode()

  if bool(rendertargetNode) != 0:
    # Get the number of pin on the rendertarget node
    numPins = octane.GetPinCount(rendertargetNode)
    print "Rendertarget pin count = " + str(numPins)

  else:
    print "No rendertarget found"
else:
  print "No OctaneRender no loaded"