Nuke Python - How to set values on XY_Knob individually?

aescript picture aescript · Feb 19, 2013 · Viewed 7.7k times · Source

Background

I am building a pretty cool tool in Python. Somehow I have been able to figure out all of the difficult parts thus far on my own, but this part has me!

Question Im trying to set the values (x, y) of an XY_Knob individually. Here are my issues:

if I type:

nuke.selectedNode()['pos1'].setValue(1205)

it will set both X and Y to 1205. If I type:

nuke.selectedNode()['pos1'].setValue(1205, 1740)

It does not give me an error, but simply prints Result: in the script editor, while changing nothing on the node.

Is it possible for anyone to add some insight?

Answer

aescript picture aescript · Feb 19, 2013

Figured it out - if anyone is wondering... the list of args is setValue(value, index, time, view) so to set x to 1250 and y to 650 it would go:

nuke.selectedNode()['pos1'].setValue(1250, 0)
nuke.selectedNode()['pos1'].setValue(650, 1)