Nuke TCL Snippets

Some usefull TCL snippets for nuke…


Get Values:

Getting a knob’s value of a specific node:

First frame of current read/write:

Getting a knob’s value of current node:

Return label value of the input node:

Name of the input node:

Name of the node before the group (Outside):

Return 1 if the node is on error otherwise 0:

Get the bounding Box from the input of the node:

Get the format from the input of the node:

Get the x position of the point #3 of the Bezier1 of the Roto1 node:

Return sample pixel value of the node Add1 reading in the red at position of knob Center:

Get the value of the channel of a node, at a specific pixelcoordinates (e.g.: 10,10):


Set Values:

Setting a knob’s value of a specific node:

Setting a variable, without returning that (useful in a textnode):


Path Manipulation:

Relative to script location file path:

Filepath without extension:

Filename only:

Filename only without extension:

Splits the uppermost node’s (probably a readnode) filepath by slashes and then joins together until a certain point, giving a directory few levels upper than the currrent path). “File split” does the splitting, making a list of directory names, “lrange … 0 7 “selects a range from the list, from the beginning to the 7. item, and “join … / ” joins by forward slashes (which I use always in paths):

This one can be used in a writenode fileknob to quickly convert the topmost readnode’s path to another format(tga). Similar to the previous, but splits path by “.” (different than previous file split), and gets the range from the beginning to 2 before the end, this way cutting off the extension and the counter (framecounter must have preceeded by a “.” )
(I use similar to make the comps writenode have the output path automatically getting from path of the nukescene ):



Example of “IF” in an expression:


String substitution and Compare:

Replace string in current node file knob with regex (string “proj” to “projects” in all occurences):

String map (replace multiple stringpairs)(this returns: xxffffxxyy):

Compare values:

Regexp matching:

©2010 Look-in | All Rights Reserved - Al images in this site are property of respective right owners