The following is a list of builtin Nuke commands. More...
Functions | |
safe_mode value password | |
turns on/off security features | |
push node | |
Add nodes to the top of the node stack. | |
node node | |
pop n | |
Remove node(s) from the top of the node stack. | |
stack index | |
Return contents of stack. | |
dup | |
index n | |
exch | |
roll n m | |
Rotate items on the stack. | |
addUserKnob id name keyword data... | |
Add a new knob to the user knob tab in a node panel. | |
knob_default class.knob value | |
Get or set the default value of a knob for a class of nodes. | |
knob_defaults | |
end_group | |
Changes the current group to the parent of the current group. | |
Root knob value | |
Set knob value in the root node. | |
expression expr | |
Parse a Nuke expression. | |
questionmark expression true_result false_result | |
Actual name is "?", return 1 of two strings. | |
in object command | |
Execute commands with a given node/knob/field as the "context". | |
value knob default_value | |
The value tcl command returns the current value of a knob. | |
numvalue knob default_value | |
The value tcl command returns the current value of a knob. | |
exists knob | |
True if the named item exists. | |
knob knob new_value | |
Returns or sets the entire state of a knob. | |
setkey knob time value | |
Set a value at a keyframe for a knob. | |
knobs -awdv node?values? | |
Get or set a list of knobs for a node. | |
values -ad node | |
Get a list of the current values for all knobs in a node. | |
nodes group | |
Return a tcl list of all the child nodes of the group. | |
clone node type args | |
Create a clone node that behaves identical to the original. | |
clone_selected action | |
Command to execute for the Clone menu item. | |
declone node | |
Make the node not be a clone. | |
show_info node... | |
display command nodecontext | |
Creates a dialog box showing the result of command. | |
show_dag groupnode | |
Show the tree view of one or more group nodes. | |
zoom group scale center_x center_y | |
Change the zoom and pan of a group's display. | |
connect_viewer n node | |
Connect a viewer input to a node. | |
autoplace nodelist | |
Automatically place nodes, so they do not overlap. | |
autoplace_snap nodelist | |
Move one or more nodes to the closest grid position. | |
input node number input_node | |
Return or set an input of a node. | |
inputs node new_number | |
selected_node | |
Returns the "node the user is thinking about". | |
selected_nodes | |
List all the selected nodes Returns a tcl list of the names of all selected nodes in the current group. An attempt is made to return them in "useful" order where inputs are done before the final node, so commands applied to this list go from top-down. Produces an error if there are no selected nodes. | |
dependencies nodelist | |
List all nodes referred to by these nodes. Return all nodes that the listed nodes read information from, that are not themselves in the list. You can use switches to select what types of referral are looked for:
| |
dependent_nodes nodelist | |
List all nodes that refer to these nodes Return all nodes that read information from any nodes in the list, that are not themselves in the list. You can use switches to select what types of referral are looked for:
| |
frame value | |
Return or set the current frame number. | |
make_timecode startcode, fps, startframe | |
Returns a timecode string in the format HH:MM:SS:FF. | |
x | |
delete nodelist | |
Delete nodes. | |
argv index | |
Returns command line arguments. | |
argc | |
Returns number of command line arguments. | |
filename_list | |
List all files in a directory the Nuke way. | |
recent_file index | |
Return a filename from the recent-files list. | |
add_recent_file filename | |
Add a file to the recent-files list. | |
load plugins... | |
Load a plugin. | |
plugins switches pattern... | |
Returns a list of plugins. | |
plugin_name | |
Returns the name of the plugin being currently loaded. | |
plugin_exists_tcl | |
Test for the existence of a plugin. | |
quit | |
Exit Nuke. | |
bytes amount | |
Convert large memory amounts into human readable format. | |
plugin_path | |
ofx_plugin_path | |
plugin_addpath path | |
plugin_appendpath path | |
execute nodes rangelist | |
Execute the current script for a specified frame range. | |
frames type | |
Return list of frames supplied on the command line to nuke. | |
filename group | |
Return the filename(s) this node or group is working with. | |
add_format w h x y r t pa name | |
Add a new image format to the Nuke script. | |
formats | |
Return all available formats in a script. | |
add_channel name | |
Add a named new channel to the Nuke script. | |
add_layer layer channel... | |
Add a new layer and channels to Nuke. | |
layers | |
List layers. | |
channels node | |
List channels. | |
sample node channel x y dx dy | |
Return pixel values from an image. | |
modified status | |
Get or set the 'modified' flag in a script. | |
byte string index | |
Utility function to extract single 8-bit values from a tcl string. Warning: if there are foreign letters this will return the bytes of the UTF-8 encoding. Use "string index \a string \a index" to get the UTF-8 character. | |
char unicode | |
Turn single character number into a string. | |
set_expression expression | |
Set the expression for the current Knob. | |
fltk_color color_code | |
Convert an FLTK color code into a packed RGBA. | |
add_timeout timeout node script | |
Add a timeout that will run a script after some elapsed time. | |
version testversion | |
Return the nuke version, or check a version number. | |
error_node | |
Return node that produced an error. | |
error_message | |
Return error message. | |
full_name node | |
Return fully-qualified name of node Print the name of the node and any groups enclosing it in "group.group.name" form. If the name does not appear to be a node, it is printed unchanged (allows "0" and deleted nodes to print something). | |
memory command arg | |
Get/set information about memory usage. | |
undo | |
python | |
Run a python command returning the result as a TCL string. | |
screen_width | |
Returns the width of a node in the DAG. | |
screen_height | |
Returns the height of a node in the DAG. | |
script_new name | |
Start a new script. | |
show_settings | |
Show the settings of the current group. | |
get_input prompt | |
Pops up a box that lets the user type in an arbitrary string. | |
get_filename prompt pattern default | |
Pops up a file chooser dialog box. | |
get_clipname prompt pattern default | |
Pops up a file chooser dialog box. | |
ask prompt | |
Show a Yes/No dialog. | |
message prompt | |
Show an info dialog box. | |
alert prompt | |
Show an alert dialog box. | |
menu name key icon tooltip command | |
Add a new menu item to a menu bar or replace it. | |
get_color prompt default | |
Show a color chooser dialog. | |
panel -w title list | |
Create a dialog box with multiple UI elements. | |
menubar name position size | |
Create a user menu bar in the DAG view. | |
animations | |
Returns a list of animatable things the user wants to work on. | |
animation_start | |
Return first frame of animation. | |
animation_end | |
Return last frame of animation. | |
animation_increment | |
Return frame interval. | |
animation name command... | |
Does operations on an animation curve. | |
script_open filename | |
Open an existing script. | |
script_save_as filename | |
Save the current script. | |
script_save filename | |
Save the current script. | |
script_exit | |
Exit Nuke. | |
script_close | |
Close the current script or group. | |
node_paste filename | |
Paste nodes from a script file or the clipboard. | |
node_copy filename | |
Copy all selected nodes into a file or the clipboard. | |
_node_delete filename | |
Delete all selected items in a DAG_View. |
The following is a list of builtin Nuke commands.
Nuke provides a great number of builtin script commands. This list contains all commands that are available to the user. If a command is not found in the list of builtin commands, Nuke will first search the plugin path for binary plugins with the same name. If none is found, the same path will be searched for tcl plugins. If neither was found, Nuke prints an error message.
safe_mode | ( | value | password |
turns on/off security features
"safe_mode" disables certain scripting features that can make loading an unknown script unsafe. It tries to prevent any automatically-executing code from modifying any files or other state of your computer. Currently it disables the tcl open and exec commands inside expressions on knobs. Note that buttons and menu items can still run arbitrary things, but require the user to push them.
Since this makes it impossible to do some operations (like having a knob return a value from a file), tcl procedures you write can turn it off as needed, using a password you set.
safe_mode defaults to off for back-compatibility. Installations may want to add code to init.tcl to turn it on and set a password, then add code to temporarily turn it off in any procedures that need it.
"safe_mode" returns 1 or 0 to indicate if it is on.
"safe_mode 1 password", turns it on and remembers the password. If it is already on it returns an error if the password is wrong.
"safe_mode 0 password" turns it off if the password matches. If the password is wrong it returns an error.
node | ( | node |
Returns the node's "internal name", this name will not change if the node is renamed and is unique to this node. This internal name can be used anywhere a node name is needed, including this function (in which case it returns the name unchanged). The internal name will change each time Nuke is run.
pop | ( | n |
stack | ( | index |
Return contents of stack.
The stack is used to parse scripts, the top items are used as inputs to the new nodes as they are created, and are popped and then the new node is pushed. It is also used interactively, as each click by the user on a node will push it on the stack (or move it to the top if it is already in the stack).
If an index is given, this returns the name of the node at that index in the stack, or throws an error if the index is out of range.
If no index is given, this returns a tcl list of the nodes in the stack.
This function does not modify the node stack.
dup | ( |
index | ( | n |
roll | ( | n | m |
addUserKnob | ( | id name keyword | data... |
Add a new knob to the user knob tab in a node panel.
Syntax: addUserKnob ?node node_name? knobID name ?keyword data...?
The following knob ID's are supported:
The following keywords+data are supported, only the first letter is checked:
knob_default | ( | class.knob | value |
Get or set the default value of a knob for a class of nodes.
Knob_default sets a default value for knobs in nodes that belong to the same class. All knobs with matching names, that are created after this command was issued, will default to the new value. If class. is missing or is "*." then this default applies to all nodes with such a knob. If several values are supplied, the first value which is valid will be used as the default.
knob_defaults | ( |
Returns a list of all defined knob_defaults. To find the value of one use [knob_default name ].
end_group | ( |
Changes the current group to the parent of the current group.
Does nothing if the current group is a Root (the main window of a script).
Root | ( | knob | value |
expression | ( | expr |
Parse a Nuke expression.
This command runs the same expression parser as is used by Animations. This is not the same as the tcl expr parser. The main differences are:
questionmark | ( | expression true_result | false_result |
Actual name is "?", return 1 of two strings.
This command is most useful for imbedding in square brackets into a string value to allow a choice between two strings based on the values of other knobs. Ie "[? root.proxy proxy_string fullsize_string]"
in | ( | object | command |
Execute commands with a given node/knob/field as the "context".
The command is executed with the object as the "context". This means that all names are evaluated relative to this object, and commands that modify "this" node will modify the given one.
If no arguments are given, this returns the name of the current context. Warning: this name may not give the exact same context if your nodes do not all have unique names.
value | ( | knob | default_value |
The value tcl command returns the current value of a knob.
Returns the current value of a knob. Unlike knob, this will evaluate animation at the current frame, and expand brackets and dollar signs in string knobs.
The optional default_value is returned if there is any error, such as that named knob not existing. This avoids the need for catch statments when producing status messages, it is faster to do this.
If you want to use the result in a math expression, you may want to use numvalue instead. That will always return a number instead of text.
numvalue | ( | knob | default_value |
The value tcl command returns the current value of a knob.
This is the same as the value command except it will always return a number. For enumerations this returns the index into the menu, starting at zero. For checkmarks this returns 0 for false and 1 for true. For all other knobs it attempts to atoi the string, returning 0 on failure.
The optional default_value is returned if there is any error, such as the named knob not existing. This avoids the need for catch statments when producing status messages, it is faster to do this.
exists | ( | knob |
True if the named item exists.
Returns true if the named knob or node exists. Returns false if it does not (including all syntax errors). This allows you to write more readable code than doing catch commands.
knob | ( | knob | new_value |
Returns or sets the entire state of a knob.
Each individual control on a control panel is called a "knob". A knob's name is a dot-separated list. An example of a fully-expanded name of a knob is "root.Group1.Blur1.size.w". "root" is the node name of the outermost group, "Group1" is a group inside that containing the blur operator, "Blur1" is the name of a blur operator, "size" is the name of the actual knob, and "w" is the name of the "field" (there are two fields in a blur size, "w" and "h").
You can omit a lot of this because all knob names are figured out relative to a "current knob" and "current node". These are set depending on the context of where the scripting is invoked. For menu items the current node is the group that contained the menu, and there is no current knob. For expressions typed into knob fields the current knob is that knob and the current node is the node the knob belongs to.
If a name does not start with "root" then a search upwards is done for the first word in the name, first against the fields in the current knob, then against the knobs in the current node, then against the nodes in the group containing the current node (or in it if it is a group), on up to the root.
The word "this" means the current knob or the current node.
The word "input" means the first (0 or B) input of a node. Ie "Blur1.input" returns the node connected to the input of Blur1, while "Blur1.input.input" returns the input of that node.
If you are getting the value for reporting to the user, you probably want to use the value or expression commands.
If the -t argument is specified, it will print out the type of the knob rathe than getting or setting the value. The type is an integer, using the same list as addUserKnob
If -c it will print out the type of the knob as a string, e.g. "Int_Knob", "Enumeration_Knob", "XY_Knob".
setkey | ( | knob time | value |
Set a value at a keyframe for a knob.
This turns on the animated control for that field (if not already on) and adds a single keyframe at the given time and value. See knob for how to name knobs and fields.
If you don't want to turn on animation, use the knob command instead.
knobs | ( | -awdv node?values? |
Get or set a list of knobs for a node.
If only a node is named, this outputs a list of the names of all the knobs in this node. The switches control exactly what is in the list:
The optional second argument is an alternating name + setting list as output by this command with -v, it then sets the knobs to the given settings.
values | ( | -ad | node |
Get a list of the current values for all knobs in a node.
Returns an alternating list of knob names and the current value of the knob. This is different than the knobs command in that knobs returns the expressions and curves, while values returns the evaluation of the expressions.
nodes | ( | group |
Return a tcl list of all the child nodes of the group.
If the group name is ommitted the current group (ie the group the user picked a menu item from the menubar of).
The returned list contains internal hexadecimal names, which are guaranteed to be unique for every node in the script. To get user-friendly names you should use "[knob $n.name]" where "$n" is each word returned by this command.
clone | ( | node type | args |
Create a clone node that behaves identical to the original.
A cloned node shares the exact same properties with its original. Clones share the same set of knobs and the same control panel. However they can have different positions and connections in the render tree. Any clone, including the original, can be deleted at any time without harming any of its clones.
This command will attempt to create a clone of the given node. This will fail if the original node does not exist or does not have the type specified. If it fails and a type is given, that type and args are used to create a normal node.
clone_selected | ( | action |
Command to execute for the Clone menu item.
This makes a clone of all selected nodes, preserving connections between them, and makes only the clones be selected.
declone | ( | node |
Make the node not be a clone.
nyi, the Node::declone method needs to be fixed!
show_info | ( | node... |
display | ( | command | nodecontext |
Creates a dialog box showing the result of command.
Creates a window showing the result of command. The command is executed in the "context" of the given node, so this and a knob name in expressions refer to that node. In the window is an "update" button which causes the command to be run again.
Example:
display {return "The color is [knob color]"} [selected_node]
show_dag | ( | groupnode |
Show the tree view of one or more group nodes.
zoom | ( | group scale center_x | center_y |
Change the zoom and pan of a group's display.
If the group name is ommitted the current group (ie the group the user picked a menu item from the menubar of).
If no other arguments are given this returns the current zoom factor.
If one argument is given, zoom is set to that factor, and the image is positioned so the mouse is pointing at the same point. A zero or negative value will perform a zoom-to-fit.
If two more arguments are given the image is zoomed and then centered on that pont You probably want to use something like "zoom 1 $node.xpos $node.ypos" to show a particular node.
connect_viewer | ( | n | node |
Connect a viewer input to a node.
Some viewer in the current group is found, if there are no viewers one is created. The viewer is then altered to have at least n+1 inputs and then input n is connected to the given node.
This command is used by the numeric shortcuts in the DAG view menu.
autoplace | ( | nodelist |
autoplace_snap | ( | nodelist |
input | ( | node number | input_node |
Return or set an input of a node.
Attempts to make illegal connections (loops, between groups, wrong type of node) will produce an error.
inputs | ( | node | new_number |
Get how many inputs the node has. Normally this is a constant but some nodes have a variable number, the user can keep connecting them and the count will increase.
Attempting to set the number will just disconnect all inputs greater or equal to new_number. For a variable input node this may decrease inputs to the new value. For most nodes this will have no effect on the value of inputs.
selected_node | ( |
Returns the "node the user is thinking about".
If several nodes are selected, this returns one of them. The one returned will be an "output" node in that no other selected nodes use that node as an input. If you are interested in exactly what order the user clicked on nodes use the stack command. [selected_node] is usually the same as [stack 0] but not always!
If no nodes are selected, then if the last thing typed was a hotkey this returns the node the cursor is pointing at. If none, or the last event was not a hotkey, this produces a "No node selected" error. Most GUI commands that want to work on a node should use this to find the node.
selected_nodes | ( |
List all the selected nodes Returns a tcl list of the names of all selected nodes in the current group. An attempt is made to return them in "useful" order where inputs are done before the final node, so commands applied to this list go from top-down. Produces an error if there are no selected nodes.
dependencies | ( | nodelist |
List all nodes referred to by these nodes. Return all nodes that the listed nodes read information from, that are not themselves in the list. You can use switches to select what types of referral are looked for:
dependent_nodes | ( | nodelist |
List all nodes that refer to these nodes Return all nodes that read information from any nodes in the list, that are not themselves in the list. You can use switches to select what types of referral are looked for:
frame | ( | value |
Return or set the current frame number.
Returns the current frame. Normally this is the frame number set in the root node, typically by the user moving the frame slider in a viewer.
The returned value actually depends on the "context". If you have a timewarp, doing "in TimeWarp1.input {frame}" will give you a different number. If you put "[frame]" into a function curve, then the expression "knobname(10)" will return 10, as frame will evaluate to the number passed to the expression. Unlocked viewers have local frame numbers, too.
If a number is given, it sets the current frame number to that number. If the current context is the root this changes the root frame.
make_timecode | ( | startcode | , |
fps | , | ||
startframe | |||
Returns a timecode string in the format HH:MM:SS:FF.
x | ( |
Return the current x value in Color/Math/Expression. This lets you embed tcl in square brackets into the expressions and have it produce a different value for each pixel.
Warning: calling tcl from inside Expression is really slow!
Return the current y value in Color/Math/Expression. This lets you embed tcl in square brackets into the expressions and have it produce a different value for each pixel.
Warning: calling tcl from inside Expression is really slow!
Return the current frame number.
delete | ( | nodelist |
Delete nodes.
The named node(s) are deleted. They can be recovered with an undo.
argv | ( | index |
Returns command line arguments.
Returns a string argument given on the command line when Nuke was invoked. The first word after the script name is [argv 0]
, the second is [argv 1]
, etc.
You can put [argv 0]
into a filename or other string so that the filenames are specified on the command line. If you put this in a file writer, be sure to set the "file type" back to blank if you want the user to be able to specify the file type by the extension of the filename. You can also use this command as part of a filename, for instance the reader can use "[argv 0]" and the writer can use "[file
rootname [argv 0]].jpeg" to force the output to be the same name as the input but with a ".jpeg" extension.
You can also put [argv n]
into math expressions. The argument must then be a number (unfortunately it cannot be an expression). An annoyance is that if the -F flag specifying a frame range is not given, Nuke treats all trailing arguments that consist of only digits, dash, comma, or slash as frame ranges for backwards compatibility with older versions and strips them off before argv gets a chance to look at them. The only way around this is to use -F to specify a frame range, design your command so that the last argument is not a number, or require your users to put a decimal point into the number so that it doesn't make sense as an old style frame range. Using -F to specify framerange is recommended.
You can run the script with "nuke -x \a scriptname \a argv0 \a argv1 \a frames" If no frames are given it will run the range given on the root settngs (to make the script more useful, change this range to 1,1 so that the default behavior is to do one frame). Unix users can make the script look like a program by turning on the executable bit, and perhaps editing the shebang (#!) line at the start of the file. Windows users can use a batch file for the same effect.
If the argument is missing it produces an error and the script will fail. This will happen even if the node is disabled or not used due to a switch, so to allow variable argument lists, a negative index does not fail but instead returns the string "0". This allows you to put in expressions for the index to avoid failures. For instance "[argv [argc]-1]" will give you the last argument, and you can use "[argc]" in switch expressions so that the script works.
argc | ( |
filename_list | ( |
List all files in a directory the Nuke way.
Returns a list of all files in a directory, but with "sequences" of names with sequential numbers in them reduced to the form that is used as filenames by file readers: "foo.%04d.rgb 1-10"
recent_file | ( | index |
Return a filename from the recent-files list.
add_recent_file | ( | filename |
Add a file to the recent-files list.
load | ( | plugins... |
Load a plugin.
You can force a certain plugin to load with this command. If the plugin has already been loaded nothing happens.
If there is no slash in the name then the plugin_path is searched for it. If there is a slash then the name is used directly as a filename, if it does not start with a slash the name is relative to the directory containing any plugin being currently loaded.
If no filename extension is provided, it will try appending ".so" (or whatever is appropriate for your OS) and then by trying to append ".tcl".
This command can also be used to make one plugin load another. This is useful if you have a plugin that defines more than one command. If a plugin defines the commands A and B you can name it "A.so" and then make "B.tcl" that says "load ./A".
On Linux the tcl command for loading tcl plugins has been renamed "tcl_load" so you can call it.
plugins | ( | switches | pattern... |
Returns a list of plugins.
Returns a list of every loaded plugin, or every plugin available. By default each plugin is returned as the full pathname of the plugin file.
You can give a glob-style matching pattern and only the plugins whose filenames (not path) match a glob pattern will be returned. You can give more than one glob pattern. If you want all the binary plugins you should use "all_plugins *.$plugin_ext".
You can put switches before the glob patterns. Currently supported:
-all = Return all plugins in each of the plugin_path directories, rather than only the currently loaded plugins.
-nodir = Just put the filenames in the list, not the full path. There may be duplicates.
-- = Stop looking for switches, allows a glob pattern to start with dash.
plugin_name | ( |
plugin_exists_tcl | ( |
Test for the existence of a plugin.
This command tells you if a plugin with the given name exists in the plugin path.
If there is no slash in the name then the plugin_path is searched for it. If there is a slash then the name is used directly as a filename, if it does not start with a slash the name is relative to the directory containing any plugin being currently loaded.
If no filename extension is provided, it will try appending ".linuxfc4_intel" (or whatever your system is) and then by trying to append ".tcl".
quit | ( |
bytes | ( | amount |
Convert large memory amounts into human readable format.
If amount is 1024 or greater, bytes will divide it by 1024 and append the letter k. It will append M and G for Megabyte and Gigabyte quantities respectively.
plugin_path | ( |
Returns a list of all the directories Nuke will search for plugins in.
The built-in default is ~/.nuke and the "plugins" directory from the same location the Nuke executable file is in. Setting the environment variable $NUKE_PATH to a colon-separated list of directories will insert those directories between them. You can further modify the plugin_path with plugin_addpath and plugin_appendpath, and often the init.tcl files in these directories will do so.
ofx_plugin_path | ( |
Returns a list of all the directories Nuke searched for OFX plugins in.
plugin_addpath | ( | path |
Adds all the paths to the beginning of the Nuke plugin path. If the path already exists in the list of plugin paths, it is moved to the start. If this command is executed inside an init.tcl then the init.tcl in the path will be executed.
plugin_appendpath | ( | path |
Add a filepath to the end of the Nuke plugin path. If the path already exists in the list of plugin paths, it will remain at its current position. The init.tcl is not executed in this.
execute | ( | nodes | rangelist |
Execute the current script for a specified frame range.
If Nuke is run with the GUI up, this will pop up a progress meter. If the user hits the cancel button this command will return a "cancelled" error.
If Nuke is run as a text command (with the -t switch) this prints a text percentage as it progresses. If the user types ^C (on Unix) it will return to the prompt, aborting all commands.
frames | ( | type |
Return list of frames supplied on the command line to nuke.
All trailing command-line arguments that start with a number are parsed as "frame ranges" by Nuke. This will return these arguments. If none are given this acts as though root.first_frame,root.last_frame were given as the frame range.
[frames first] returns the lowest number.
[frames last] returns the highest number.
[frames all] returns a list of all frame numbers, expanding the ranges into individual numbers.
[frames ranges] returns frame ranges in a form that can be passed to execute. If no command line ranges were given this returns an empty list, not the root frame range.
[frames when expression] returns frame ranges when expression is non-zero.
[frames when expression every n] returns every nth frame where expression is non-zero.
filename | ( | group |
Return the filename(s) this node or group is working with.
For a Read or Write operator (or anything else with a filename knob) this will return the current filename, based on the root.proxy settings and which of the fullsize/proxy filenames are filled in. All tcl expansion of commands and variables is done. However by default it will still have %04d sequences in it, use -v to get the actual filename with the current frame number.
If the node is a group, a search is done for executable (i.e. Write) operators and the value from each of them is returned. This will duplicate the result of calling execute on the group.
If no filenames are found, an empty string is returned.
add_format | ( | w h x y r t pa | name |
Add a new image format to the Nuke script.
tcl syntax: add_format { w h ?x y r t? ?pa? name}
Create a new image format, which will show up on the pull-down menus for image formats. You must give a width and height and name. The xyrt rectangle describes the image area, if it is smaller than the width and height (for Acadamy aperature, for example). The pixel aspect is the ratio of the width of a pixel to the height.
formats | ( |
Return all available formats in a script.
Formats are returned as a tcl list. Each format contains8 elements: { width height xorigin yorigin right top aspect name }
add_channel | ( | name |
add_layer | ( | layer | channel... |
Add a new layer and channels to Nuke.
tcl syntax: add_layer { name channel ... }
The full name of a Nuke channel consistes of the layer name, a dot, and one of the layer's channel names.
layers | ( |
List layers.
channels | ( | node |
List channels.
sample | ( | node channel x y dx | dy |
Return pixel values from an image.
Lets your tcl code look at pixel values. Notice that doing this requires the image to be calculated, so performance may be very bad if this is placed into an expression in a control panel.
The channel can be the name of a channel or an integer (starting at 1 for red).
x,y is the center of the area to sample. Note that integers are at the corners of pixels, to center on a pixel add .5 to both coordinates.
If the optional dx,dy are not given then the exact value of the square pixel that x,y lands in is returned. This is also called "impulse filtering".
dx and dy are the size of the area to sample, centered on x,y. This produces a cubic filtered result. Any sizes less than 1, including 0, produce the same filtered result, this is correct based on sampling theory.
modified | ( | status |
Get or set the 'modified' flag in a script.
Setting the value will turn the indicator in the title bar on/off and will start or stop the autosave timeout. If no argument is provided this returns the current modified state.
byte | ( | string | index |
Utility function to extract single 8-bit values from a tcl string. Warning: if there are foreign letters this will return the bytes of the UTF-8 encoding. Use "string index \a string \a index" to get the UTF-8 character.
char | ( | unicode |
Turn single character number into a string.
Any characters greater than 127 will turn into a multibyte UTF-8 string. However most parts of Nuke (such as labels and the Text node) and the tcl interpreter understand this.
Zero will turn into "\xc0\x80" which tcl understands. However most nuke operators will not draw this correctly.
set_expression | ( | expression |
Set the expression for the current Knob.
fltk_color | ( | color_code |
Convert an FLTK color code into a packed RGBA.
Packed RGBA are stored in an unsigned integer: 0xRRGGBB00
.
add_timeout | ( | timeout node | script |
Add a timeout that will run a script after some elapsed time.
version | ( | testversion |
Return the nuke version, or check a version number.
Just "version" will return a floating-point number describing the current nuke build. The number is M.nbbb, where M is the major number (4), n is the minor number (6), and bbb is the build number.
If you give an argument, a warning is produced if it is greater than this Nuke version. In addition smaller numbers are stored internally and may modify the parsing of scripts for back compatibility. This stored number is reset when the script is done loading.
Newer versions of Nuke - from 6.0v1 upwards - may specify an additional parameter for the release and phase numbers (e. g. v1b5) to allow version numbers to be unambiguous. Older versions of Nuke will ignore this additional parameter.
error_node | ( |
Return node that produced an error.
If in an expression node.error returned true, you can use this command to get the node that actually reported the error. This may be some input somewhere above the node named in the expression. If there is no error this returns 0.
error_message | ( |
Return error message.
If in an expression node.error returned true, you can use this command to get the error message. If there is no error this returns an empty string.
memory | ( | command | arg |
Get/set information about memory usage.
All amounts are in bytes. Use math like "n*1024*1024" to get megabytes, etc. The return value can be printed in a more user-friendly version by passing it as an argument to the bytes command.
Commands are:
undo | ( |
No arguments: perform the most recent undo
"undo count" : return how many undos there are
"undo cancel" : undoes the pending undo being created, thus returning the script to the state it was before the current tcl command was started.
"undo N" : return a string describing the n'th undo.
"undo -l N" : return a much longer description of the undo
python | ( |
Run a python command returning the result as a TCL string.
All the arguments are appended with spaces and the result sent to the python interpreter.
screen_width | ( |
Returns the width of a node in the DAG.
Note that this property is read only.
screen_height | ( |
Returns the height of a node in the DAG.
Note that this property is read only.
script_new | ( | name |
Start a new script.
Makes a new Untitled script and creates a new root node for it and displays the window. Currently this is implemented by forking a new copy of nuke, so the calling script will not be able to access the new script.
show_settings | ( |
Show the settings of the current group.
This opens the root or group setting Panel.
get_input | ( | prompt |
Pops up a box that lets the user type in an arbitrary string.
get_filename | ( | prompt pattern | default |
Pops up a file chooser dialog box.
get_clipname | ( | prompt pattern | default |
Pops up a file chooser dialog box.
ask | ( | prompt |
message | ( | prompt |
alert | ( | prompt |
menu | ( | name key icon tooltip | command |
Add a new menu item to a menu bar or replace it.
The menu item name is a slash-separated list of title and submenus, for instance "File/Execute this...". If '&' is given this makes a MicroSoft style underscored shortcut out of the next letter. To get a real '/', '\', or '&', use '\/', '\\', and '&&'.
The shortcut, if given, indicates a keyboard shortcut. "#A" means alt+A. "^A" means control+A. "A" means upper-case A. "a" means lower-case "a". "F1" is function key 1. There are also ways to bind the arrows and other keys but they are kind of obscure. Use "" if you want no shortcut.
The icon names an image to put to the left of the text. If you only want to see the icon, put "@;" before the last word of the name (as in "/menu/submenu/@;item"). Use "" if you want no icon.
The tooltip will be displayed when the user points the mouse at the item (currently only for top-level items). Use "" for no tooltip.
The command should be surrounded by '{' and '}' and is the scripting commands this item should execute.
get_color | ( | prompt | default |
Show a color chooser dialog.
panel | ( | -w title | list |
Create a dialog box with multiple UI elements.
This will pop up a modal dialog box with widgets the user can edit, and ok/cancel buttons on the bottom. If the cancel button is hit this returns an error. If ok is hit, the edited values are stored into tcl variables. You can use the same tcl variables to initialize the widgets.
tcl syntax: panel ?-w#? ?title? {{label var type args}...}
menubar | ( | name position | size |
Create a user menu bar in the DAG view.
This creates an additional menu bar anywhere around the main view. Menu bars can hold additonal commands and shortcuts, called menu items.
animations | ( |
Returns a list of animatable things the user wants to work on.
If this is a command being executed from a menu item in a curve editor, a list of the names of all selected curves is returned. If this list is empty a "No curves selected" error is produced.
If this is a command being executed from the pop-up list in a knob then a list of all the fields in the knob is returned.
If this is a command being executed from the right-mouse-button pop-up list in a field of a knob, the name of that field is returned.
Otherwise this produces an error indicating that the command requries a knob context. You can get such a context by doing "in <knob> {command}"
Also see the "selected" argument to the animation command.
animation_start | ( |
Return first frame of animation.
Returns the starting frame (or x value) for the currently selected animations.
animation_end | ( |
Return last frame of animation.
Returns the last frame (or x value) for the currently selected animations.
animation_increment | ( |
Return frame interval.
Returns a recommended interval between samples of the currently selected animation.
animation | ( | name | command... |
Does operations on an animation curve.
The following commands are supported:
index ?last_index?
removes all keyframes between index ans last_index?newvalue?
returns or sets the expression for the animation. The default is "curve" or "y" which returns the interpolation of the keys.start end increment field expression ?field expression? ...
generates an animation with start, end, and increment. Multiple field/expression pairs generate a keyframe. Possible field commands are:x
returns the index of the last key with x <= t, return -1 for none.field expression ?field expression?
replaces all selected keys in an animations with new ones as explained above in generate ?newvalue?
gets or sets the value of an animation.?newvalue?
gets or sets the horizontal postion of a key. If the animation contains an expression or keyframes, the new value will be overridden.script_open | ( | filename |
Open an existing script.
Opens a new script and root window containing the contents of the named file. Produces an error if the file does not exist or if it cannot be read.
If no script name is given, or the script name is a directory, Nuke will open a file chooser dialog.
script_save_as | ( | filename |
Save the current script.
If filename is missing or is the name of a directory, this pops up a file chooser. It then changes the name of the current script to this filename and writes it to disk.
If the file already exists, it will ask the user if they should overwrite it. If you don't want this question, you should instead set root.name to the file name and do script_save instead.
script_save | ( | filename |
Save the current script.
If filename is given, writes to that file, without changing the script name (use script_save_as to change the name). If no filename is given it writes the script's filename, and pops up a file chooser if the script is currently Untitled.
script_exit | ( |
Exit Nuke.
Checks all scripts and pops up save options dialogs if they were changes since the last save. If the user doesn't cancel, this will exit Nuke.
script_close | ( |
Close the current script or group.
This is for a "close" menu item. It asks if the user wants to save the changes and then clears out the script and replaces it with an untitled one. This is also called by the window close button except if it exits the program rather than clearing out the root.
node_paste | ( | filename |
Paste nodes from a script file or the clipboard.
This function executes the script stored in a file. It is assumed the script is the result of a node_copy command. The filename can be "%clipboard%" to paste the operating system's clipboard contents.
node_copy | ( | filename |
Copy all selected nodes into a file or the clipboard.
The filename can be "%clipboard%" to indicate the operating system's cut & paste buffer.
_node_delete | ( | filename |
Delete all selected items in a DAG_View.
Remove all selected nodes from the DAG. This method tries to keep arrows connected as well as possible.