A few things that jumped out immediately:

1) No reason to use a function (I’m assuming this is running from a PyScript 
button). Right now you’re re-defining the function every time the code runs.
2) Set i to a string once and reuse it. Don’t re-cast your int to a string 
every line. i = str(int(math.floor(random.random()*999)))
3) Use string formatting instead of concatenation.
4) Try to avoid using nuke.toNode("nodeName"), as it is a shot in the dark. If 
you must use it, name your nodes something distinct.
5) Don’t mix calls to node.knob("knobName") with node["knobName"]. Be 
consistent one way or the other. The only time I would say mixing is acceptable 
is if you’re using subscript notation (the second form) and you need to test a 
node to see if a knob exists.


-Nathan
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to