I am trying to make a callback that is triggered when a rotopaint node gets 
created. It would, if a Tracker node is selected, add a layer to the rotopaint 
node that is linked to the tracker's transform.

I can't figure out how to set an expression on the translate, rotate and scale 
attributes of a layer in a rotopaint node, in order to link the value to the 
Tracker. 

I can set a keyframe on these values using the addTranslationKey() method of 
the Layer.getTransform() class, but there doesn't seem to be any reference in 
the class to setting an expression on one of these attributes. Is there a 
hidden secret way of doing this, or is it not possible?

Here is the code I have so far:

import nuke.rotopaint as rp

tracker_name = "Tracker1"

roto_node = nuke.selectedNode()
curves_knob = roto_node['curves']
stab_layer = rp.Layer(curves_knob)
stab_layer.name = "stab_"+tracker_name

# Define variable for accessing the getTransform()
transform_attr = stab_layer.getTransform()

# This returns a TypeError: a float is required
# transform_attr.addTranslationKey(1, '[value Tracker2.translate.x]', 4, 1)

# This sets a keyframe at frame 1 with a value of 4 in x and 4 in y. 
transform_attr.addTranslationKey(1, 4, 4, 1)
curves_knob.rootLayer.append(stab_layer)

Any help or guidance would be welcome! Thanks! 

_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to