Tuesday, February 9, 2016

Nuke - Calling python from TCL - File Name To Label

So trivial but always forgotten (by me). Rigth now I write it down for the eternity.

The most common situation when we might want to call python from TCL is using the label field on the given node's Node tab. If we put some text here like "maki"

 
it will appear below the node's name in the node graph.


If we use bracket "[ ]" to delimit the text it is interpreted as TCL command until it is valid command (otherwise it will be only text). So we can put something like this:

focal: [value focal]

It would look like this:


To call python we can to use the following syntax:

[python {python commands}]

To output the file name of the camera we can use the following expression:

[python {nuke.thisNode()['file'].value().split("/")[-1]}]

It would look like this: 


No comments:

Post a Comment