NUKE TCL PROCEDURES
This is a list of the TCL procedures in Nuke's plugins folder.
What are the TCL procedures?
If you have expirience with other programming languages common in VFX like Python or C++ you are probably used to creating function.
Here is a good explanation on the key differences.
So technically, TCL does not have functions. The closest thing to functions in TCL are procedures.
However, there is a subtle difference between functions and procedures in TCL.
In most programming languages, functions are first-class citizens. This means that they can be passed as arguments to other functions, and they can be returned by functions. Procedures in TCL are not first-class citizens. They cannot be passed as arguments to other procedures, and they cannot be returned by procedures.
This difference is mostly academic. In practice, procedures are used in TCL in the same way that functions are used in other programming languages.
The reason why TCL does not have true functions is historical. TCL was originally designed as a scripting language, and scripting languages typically do not have functions. However, TCL has evolved over time, and it is now used for a wider variety of tasks, including GUI development and system administration. As a result, there is a growing demand for functions in TCL.
Also, an example on how a simple procedure looks in TCL:
Where are the TCL procedures?
You can find the TCL procedures in the plugin folder where your Nuke app is installed.
Here is a little snippet you can run in the Script Editor to see them, just don't forget to update the "my_path" variable. Now you can find them!
Most of these TCL procedures has been replaced by a python function since.
Those functions are part of the nukescripts module.
However, there are cases where these procedures are still actively used and cases where the functions had been even removed too. Nonetheless, these procedures are still part of the
official Nuke package without extensive documentation.
How to use these procedures?
Many of the functions here are run when you are clicking somewhere in Nuke, but there are some that doesn't. These are standalone procedures you can run from Nuke's command line.
You can open it by pressing X over the NodeGraph.
Make sure you type them exactly as a procedure is called as TCL is case sensitive too.
Is this the full list?
No, as most of the TCL files in the plugins folders are merely there to load in nodes from which most of them are not active in the toolbar but hidden ( can find a list of those here ).
As of now, on Nuke v14.0 there are 237 TCL files in the plugins folder.
There are 97 of them which aren't in charge of node creation so the list is focusing on those.
Can I see if these are still the procedures that Nuke
is running when clicking on something?
In most cases - Yes, in the Script Editor.
1 Open Preferences and set up Script Editor / echo python commends ...
2 Now, when you run a command you will see if it's using a tcl() interpreter function to execute the command. If so it is most likely coming from the plugin folder.
Keep in mind that not every TCL procedure in the pugin folder active in the app, many has been replaced with a python function.
Of course, you can also find a menu.py in your plugins folder in which you can see that there are 13 commands that are still running tcl procedures:
Why making this list?
First of all, want to make clear that the procedure codes here are the property of The Foundy.
The reasons I am making this list:
1 To have a better understanding on how Nuke works under the hood.
2 There aren't many Nuke related TCL resources on this level of complexity so it can help to offer new solutions for people to specific problems.
That said there are two useful documentations on Nukepedia that are under Foundry ownership:
Nuke tcl commands
Native tcl functions commonly used in Nuke
You can also open these sites from Nuke from Help / Documentation / TCL Scripting.
The List
- A -
achannels
Shows a list of all available channels in the script. Basically, the same same as what channels does.
allchars
Display a string of characters.
animation_expressions
Opens the Curve Editor's Edit / Edit Expression window.
⚠ You can't use this proc in the command line, only inside a knob!
The way to do that you need to type this proc inside square bracket inside the knob's
expression window. If you do that it immediately shows another expression window:
Although, this is a possbility to open this window this way it makes little sense to do so as it opens the expression window that is property of the Curve Editor as it is a window you can create there when you select a curve and go "right click / Edit / Edit Expression ". Also it will mess up the actual animation.
animation_filter
Runs the Curve Editor's Interpolation / Smooth function.
⚠ You can't use this proc in the command line, only inside a knob!
⚠ Applies on the curve as soon as you typed in the expression!
animation_generate
Runs the Curve Editor's Edit/ Generate... function.
⚠ You can't use this proc in the command line, only inside a knob!
⚠ Opens as soon as you typed in the expression!
animation_loop
Runs the Curve Editor's Predefined / Loop function.
⚠ Opens as soon as you typed in the expression!
Oddly, when creating a Loop manually it ecoes the python code nukescripts.animation_loop()
instead of calling the TCL code that is part of tha package too but it works just as well if you run nuke.tcl('animation_loop')
animation_move
Runs the Curve Editor's Edit / Move... function.
⚠ You can't use this proc in the command line, only inside a knob!
⚠ Opens as soon as you typed in the expression!
Oddly, the python function technically exist that is suppose to replace this procedure, nukescripts.animation_move() - but it seems like it didn't get finished as it only has the original TCL code commented under it.So when using the Move it runs nuke.tcl('animation_move')
animation_negate
Runs the Curve Editor's Predefined / Negate function.
⚠ You can't use this proc in the command line, only inside a knob!
This might be broken as instead of using the negative values it makes the expression line longer the following way but not modifying the values:
Looking at the result I just want to:
When using athe Negate manually it echoes a python code nukescripts.animation_negate()
animation_reverse
Runs the Curve Editor's Predefined / Reverse function.
⚠ You can't use this proc in the command line, only inside a knob!
This might be broken as instead of producing a reverse curve it doesn't seem to have any effect on the animation.
When using athe Reverse manually it echoes a python code nukescripts.animation_reverse()
auto_connect
This procedure is most likely an earlier version of an improved current function.
You can find it under Edit / Node / Connect or can use the Y shortcut to connect the
last selected nodes.
The function that it runs called connectNodes which has a not too detailed entry in the API.
So let's dive into here what happens when using this function.
In the following examples I select first Blur1 then Blur2:
nuke.connectNodes(False, False)
Connects the node selected first to the one selected second.
nuke.connectNodes(True, False)
Connects the node selected second to the one selected first.
nuke.connectNodes(False, True)
Connects the node selected first to the one selected second using the node's second input.
autocolor
This procedure is most likely an earlier solution of how the node's got their colour from the
that was set up in the preferences. Unfortunately, the name of the knobs are still changing as it used to be called "NodeColourClass<ID>" but on version14 it is "NodeColourSlot<ID>".
autocolor_add
autocolor_node
autolabel
This procedure used to be in charge of featuring certain values on the node's name on the NodeGraph.
It is replaced now with the autolabel.py that can be find in the same plugins folder. This is the file that defines the values you can see displayed on certain nodes ( like the letters, representing operations when using ChannelMerge ).
Autolabel is also a very handy callback that you can modify in case you want to display certain values without using the `value` function on the label.
This is a cool callback!
autolabel_node
- B -
basename
Results as a base filename which is matching with what Read nodes displaying by default. You need to define the argument as a filename.
branch
- C -
cache_clear
This procedure is supposed to clear cache but unfortunately, it isn't working anymore.
More interestingly this has a python function that has been removed from the package since version14.
So this might run on earlier versions but if you try to run it on versions above version14 you'll get the following error message "AttributeError: module 'nukescripts' has no attribute 'cache_clear'".
nukescripts.cache_clear()
If you'd like to delete all cache you can do it manually at Cache / Clear All or use the
clearAllCaches function:
nukescripts.clearAllCaches()
cache_report
cam_ver_panel
This procedure ( and the following ones ) are part of a system not used much these days but brings up a popup window with a cool name - Versionator. 😎
camera_down
camera_up
camera_ver
color_nodes
This procedure brings up a colour palette when there are nodes selected and the chosen colour became the new tile_color for the selected nodes.
Can also find in the menu at Edit / Node / Color... or with the Ctrl+Shift+C shortcut.
It also has a python function with a shared source code.
nukescripts.color_nodes()
copy_gizmo_to_group
This procedure should be a TCL version of the "Edit / Node / Group / Copy Gizmo To Group " or Ctrl+Shift+G function that you can also find in the API.
To run it you select a Gizmo first then run nuke.Gizmo.makeGroup(nuke.selectedNode())
in the Script Editor.
The formula below to run the TCL version in the command line is:
[copy_gizmo_to_group [value IBKColourV3_1.name]]
copy_knobs
This procedure should be a an earlier TCL version of the "Edit / Paste Knob Values" or Ctrl+Alt+V function that you can also find in the API with a source code.
To run it you need to Copy a node first then run nukescripts.misc.copy_knobs(nuke.selectedNodes()) in the Script Editor while having one or multiple nodes with a same class selected.
copy_to_group
This is basically the repacked copy_gizmo_to_group procedure from above.
create_curve
This procedure creates the dialog window thatallows you to create a new curve in
the Project Settings / Color.
You can do that manually, when clicking on the + sign:
This procedure also has a python version with a shared source code.
So you can also run these in the Script Editor:
nukescripts.create.create_curve()
nuke.tcl('create_curve')
One thing to be aware of is that instead of creating a new curve this creates a new user knob on
the Project Settings panel. That user knob will be animated when using the python function and not animated if you create with a tcl procedure:
create_read
This procedure opens a file browser to create a Read node.
This one also has a python version with a shared source code.
So you can also run these in the Script Editor:
nukescripts.create.create_read()
nuke.tcl('create_read')
You can see that a python version is more advanced, a great extra feature there is that if you have a Read node selected it opens a file path already filled with that node's file value.
- D -
date
This procedure results in a current date.
The code very kindly includes different variables that can be useful to summon differenttime formats.
declone
This procedure also has a python version with a shared source code.
So you can also run these in the Script Editor:
nukescripts.misc.declone(nuke.selectedNode())
nuke.tcl('[declone [knob Blur1.name]]')
default_font_pathname
This tcl procedure runs a python function that gets the path to Nuke's default font..
drop
This procedure is (probably) not active anymore as it also has a python version that you can see running when manually dropping an asset into the NodeGraph:
- E -
execute_panel
This tcl procedure runs a python function ( for which we have a source code for ) and opens the
execute dialog for a list of nodes. Can run the TCL procedure in the following ways:
[execute_panel [selected_node]]
[execute_panel [value Write1.name]]
The result should be this window:
And here is the way to run the python function in the Sript Editor:
nukescripts.execute.execute_panel(nuke.selectedNodes())
export_ascii
Runs the Curve Editor's File / Export Ascii... function.
This is one of those cases where Nuke still runs this tcl procedure so there is no python version.
⚠ You can't use this proc in the command line, only inside a knob!
⚠ Opens as soon as you typed in the expression!
export_chan
⚠ You can't use this proc in the command line, only inside a knob!
⚠ Opens as soon as you typed in the expression!
export_chan_file
export_chan_menu
export_discreet_lut
extract
This procedure also has a python version with a shared source code that is funnily enough just
points to a different function.
So you can also run these in the Script Editor:
nukescripts.edit.extract()
nuke.extractSelected()
nuke.tcl('extract')
When you run this procedure / function you are removing a selected node/nodes from the pipe:
- F -
filter_multiple
Runs the Curve Editor's Edit/ Filter function.
⚠ You can't use this proc in the command line, only inside a knob!
⚠ Opens as soon as you typed in the expression!
fixclone
flipbook
In interesting old way to open a Flipbook. Wish I could use it!
formats
This procedure hasn't survived as a python function in this form, but instead got a different approach on how Formats are handled with python in Nuke. ( Just don't forget the parenthesis after print even if the Foundry did ) ;)
- G -
get_reads
This procedure also has a python version with a shared source code that also mentiones the accepted methods.
So you can also run these in the Script Editor:
nukescripts.reads.get_reads('file')
nukescripts.reads.get_reads('dir')
nukescripts.reads.get_reads('long')
getenv
This procedure shows the value of specific environment variables.
You can find other useful info about environment variables here.
Let's use NUKE_TEMP_DIR as an example.
Here's a python version to get the same value using the Script Editor:
import os
os.environ['NUKE_TEMP_DIR']
You can also feature these values in different places:
goofy_title
This procedure also has a python version with a shared source code, unfortunately that doesn't include the list of goofy titles but expects you to create a txt file with them. But you can run this too:
nukescripts.goofy_title()
goto_frame
This procedure brings up a dialog window asking for a frame number to move the viewer to. Also has a python version with a shared source code,
nukescripts.goto_frame()
- I -
import_action
import_adobe_lut
import_ascii
Runs the Curve Editor's File / Import Ascii.. function.
⚠ Opens as soon as you typed in the expression!
import_boujou
This procedure from Nuke v5.0 brings up a file search window to select a .txt file.
How to use this procedure is also mentioned on the official website, also on Nuke v6'.3s manual.
Also has a python version with a shared source code, so you can also run thisin the Script Editor:
nukescripts.import_boujou()
import_chan
import_chan_button
import_chan_button
import_chan_menu
This is a procedure that runs when you click on Import chan file on a Camera:
It needs a node value so to run in the Script Editor would look like this:
nuke.tcl("import_chan_menu [node Camera1]")
import_discreet
This procedure is (probably) an older version of the following "import_discreet_lut".
⚠ Opens as soon as you typed in the expression!
import_discreet_lut
When running this procedure a file search window open expecting a .lut file.
import_sequence
This is the procedure that gets executed when clicking on the Read node's import sequence to load in .edl file:
infoviewer
This procedure brings up a window showing information about a single selected node.
You can also press "i" to open this window.
Also has a python version with a shared source code, - it shows that it is basically another function that gathers the info so if you don't need a pop up window can also use that:
nukescripts.getallnodeinfo()
nukescripts.infoviewer()
init
invert
- L -
load_all_plugins
This procedure is an outdated version of the following python function
( see also at "update_all_plugin_menu") :
nukescripts.update_plugin_menu("All plugins")
The procedure meant to load in all plugins in the Other menu on the Toolset:
Instead it is resulting in the following error message:
lset
- M -
makescratch
max_curve
min_curve
- N -
nfb_this
node_copypaste
This procedure also has a python version with a shared source code
nukescripts.node_copypaste()
node_cutpaste
node_delete
This procedure also has a python version with a shared source code
nukescripts.node_delete()
The previous function ( and procedure ) deletes the selected nodes but there is a
more commonly used delete function, that needs a node as an argument:
for n in nuke.selectedNodes():
nuke.delete(n)
node_status
nukev
This procedure creates a new Viewer, with a name NukeViewer.
- P -
parray
paste_to_selected
- R -
read_file
remove_inputs
This procedure disconnects the selected nodes' first input. Also has a python version with a shared source code.
So you can also run this in the Script Editor:
nukescripts.remove_inputs()
As this procedure/function's use is limited it's recommended to use a newer function,
extractSelected() instead.
- S -
script_command
This procedure bring up a script command window. Also has a python version with a shared source code.
So you can also run this in the Script Editor to bring up the Command window:
nukescripts.script_command('')
Running the TCL procedure shows the number of threads by default:
script_data
This procedure brings up certain data about the script. This is a 2 part procedure where "get_script_data" is fetching the info and "script_data" organising on a prop up window that has a scroll too. So it has two python versions. One if you want to result in a popup window with a source code, and one if want to see the result in a Script Editor with source code.
nukescripts.script_data()
nukescripts.get_script_data()
script_data
This very touching mother's day present results in a script's and all the elements' location.
script_version_up
This procedure versions up your script. It also has a python function with a shared source code.
nukescripts.script_version_up()
scroll_scr
Founding the result of this procedure is rather confusing. Feels like people had little faith that Nuke will have higher versions than 3 at the time. 😅
search_plugins
search_replace
This procedure replaces parts of string on selected node's file path value. You can find this feature on the Edit / Node / Filename / Search and Replace.... It also has a python function with a
shared source code.
nukescripts.search_replace()
search_by_name
This procedure brings up a Search pop up window and let's you add a string and based on that value selects nodes. You can use the " / " shortcut too. It also has a shared source code. You can see that under the hood it runs another function ( selectPattern ) so can use either of these:
nukescripts.select_by_name()
nuke.selectPattern()
select_similar
This procedure is the origin of a function that allows you to select similar nodes based on Color, Class or Label. You can find this function under the Edit / Select Similar menu.
It also has a shared source code too, but as it's mentioned in the description too it is recommended to use another function ( selectSimilar using one of the following arguments: nuke.MATCH_CLASS, nuke.MATCH_LABEL, nuke.MATCH_COLOR) instead:
nuke.selectSimilar(nuke.MATCH_CLASS)
setenv
showname
This procedure brings up a pop up window that shows the project's name value and a selected node's file value. It also has a shared source code. You can also get the same value from the root's name knob:
nukescripts.showname()
print(nuke.toNode('root')['name'].value())
start
This procedure opens a website in your default browser. It also has a shared source code.
( Which oddly also runs the TCL code under the hood. )
nukescripts.start('https://www.gatimedia.co.uk/tutorials')
swapAB
This procedure swaps the first two inputs of a node that's given as a value. It also has a shared source code which also considers if the node is a Group and the "lock all connection" knob is enabled.
nukescripts.swapAB(nuke.selectedNode())
- T -
toggle
This procedure toggles checkbox values on selected nodes.
It also has a python function with a shared source code.
nukescripts.toggle("disable")
toolbar
This procedure defines toolbar elements.
It has broken down to different functions under nukescripts.toolbars with shared sourcecodes.
Main one being setup_toolbars that isn't in use anymore.
There's also a newer function available, nuke.toolbar() .
topnode
This procedure returns the top node of the pipe where it's called
Unfortuntely, this clever procedure doesn't have an official python function version.
Luckily Anthony Tan has a super useful python tutorial series and he makes one in one of the episodes!
Kudos sir!
- U -
UIchooser
This is a fun procedure that basically allows you to choose between different Preferences settings.
I first heard about this one from Mads Hagbarth on a Foundry forum.
The package originally comes with two different UI options - Standard and Silver, however as the description of the code tells it you can save as many UIs as you want.
You just need to save your preferences file in your .nuke folder with a name that starts with "UI_".
Let's share here first the ones that comes with the app and some additional ones that you can use if you'd like:
unsetenv
update_plugin_menu
This procedure can update the menu. Using the "All plugins" argument reloads the Node menu and with that all the older nodes. You can find out more of those here.
It also has a python function with a shared source code.
nukescripts.update_plugin_menu("All plugins")
By the way, I really like the honest error message that would just print "AArrgghh"!
- V -
version_down
This procedure versions down the selected assets.
Can also find in the menu at Edit / Node / Filename / Version Down or
with the Alt+Down shortcut.
It also has a python function with a shared source code.
nukescripts.version_down()
version_get
This procedure uses a regex code that gets you a version number from the file value.
It also has a python function with a shared source code.
And hy wouldn't you use it if Digital Domain is using it ( and Weta, apparently ). 😜
nukescripts.version_get(nuke.selectedNode()['file'].value(), 'v')[1]
Can be also useful to show version number on the node's label with using either of the following examples:
Version with TCL: v[version_get [value file] v]
Version with Python: v[python {nukescripts.version_get(nuke.thisNode()['file'].value(), 'v')[1]}]
version_latest
This procedure versions up the selected Read nodes to the highest available version number.
Can also find in the menu at Edit / Node / Filename / Version to latest (Reads Only) or with the Alt+Shift+Up shortcut.
It also has a python function with a shared source code.
nukescripts.version_latest()
version_up
This procedure versions up the selected assets.
Can also find in the menu at Edit / Node / Filename / Version Up or
with the Alt+Up shortcut.
It also has a python function with a shared source code.
nukescripts.version_up()
- W -
write_file
Hope you will find it useful!