Hi Marco,
I have actually struggled with the same problem, and I may have figured it out 
slightly more than you. I'm sure there are people on this forum much more 
knowledgeable than me, but here is what I have figured out: 

You are on the right track with the getAttributes method of the shape class. if 
you store your attributes to a variable and get help on it:

attr = shape.getAttributes()
help(attr)

As you figured out, you can get the value of the 'mbo' (Motion Blur On) 
attribute at frame 1: 
(As you also probably discovered, you can get a list of these 'attribute codes' 
at the end of the help for getAttributes().)
attr.getValue(1, 'mbo')

To set the value of the motion blur on checkbox, it seems that you can use 
either attr.set(), which seems to support setting a value of an attribute, or 
setting a keyframe on an attribute. 

attr.set('mbo', 0)

As you pointed out, the attr.setKey() method seems to be intended to do the 
same thing without the ability to set non-keyframe values. You are right, it 
does appear as thought the documentation is incomplete. I don't have a guess as 
to what the hash parameter is supposed to be for this method. Maybe this method 
is broken?

 |  setKey(...)
 |      self.setKey(time, attributeIndex, hash, value, view) -> None
 |      Set a key for an attribute. The time parameter is when the new key will 
be created for; the attributeIndex says which attribute to set the key for; the

Using the attr.set() method does not modify the value of a shape in-place in a 
roto node though. It seems that you have to modify the attribute values and 
then re-append the shape to the node like so: 
rotoCurves.rootLayer.append(shape)

If the shape already exists though, it seems to create another copy. I'm not 
sure if there is a different way to modify attributes of shapes or layers that 
already exist in the node. 

 I actually was struggling OVER HERE 
(http://forums.thefoundry.co.uk/phpBB2/viewtopic.php?t=8274) to find a way to 
set expressions on parameters of elements in a rotopaint node also. As you 
discovered, these methods seem only to accept integer values, so if you want to 
set an expression link on the transform of a layer, for example, it doesn't 
seem to be possible? If you or anyone else has any ideas about that I would 
love to hear them!



_______________________________________________
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