Solving Using Python

If you have an interactive license (ocula_i and nuke_i), you can run O_Solver using Python. Running from the command line, with the -i argument for interactive licenses, allows you to automate the setup of O_Solver for different shots without having to open the UI and manually analyze frames.

Warning:  If there is an interruption between the license server and Ocula, rendering aborts with an exit code of 1. You can use the --cont command line argument to force Ocula to continue rendering on failure, producing black license failure frames rather than aborting the whole render.

Using Python, you can:

Scan the entire sequence automatically, adding keyframes when a change in camera is detected using analyseSequence.

# Create an O_Solver to analyze the whole sequence

def autoKeyOculaTree(filename, first_frame, last_frame):

 

# set up views

nuke.root()["setlr"].execute()

 

# create the read and set up for the frame range

reader = nuke.createNode("Read",inpanel=False)

reader.knob("file").setValue(filename)

reader.knob("first").setValue(first_frame)

reader.knob("last").setValue(last_frame)

 

# set up the O_Solver node and create a key

solver = nuke.createNode('O_Solver4_0',inpanel=False)

solver.setInput(0, reader)

solver['analyseSequence'].execute()

 

# set the file path and frame range

autoKeyOculaTree('/myFilePath/myFootage.####.sxr',1,206)

 

# save the script once complete

nuke.scriptSaveAs('/Users/OculaExpert/shot001.nk', True)

 

Script the analysis of a specific set of frames through python.

frameList = [25, 73, 123]

frameRanges = nuke.FrameRanges( frameList )

nuke.execute(solver, frameRanges)

O_Solver also has a Python tab in the Properties panel, allowing you to call Python functions automatically when various events happen in Nuke. See Help > Documentation > Python Developers Guide for more information.