Package nuke
[hide private]
[frames] | no frames]

Package nuke

source code

This module provides all the Nuke-specific functions and Classes.

Submodules [hide private]

Classes [hide private]
  AColor_Knob
AColor_Knob
  AnimationCurve
AnimationCurve
  AnimationKey
A control point for an animation curve.
  Array_Knob
A knob which holds an array of values.
  Axis_Knob
A knob which descibes a 3D affine transformation, by combining rotations around each principal axis, scaling, translation, skew and a pivot point.
  BBox_Knob
A knob which holds a bounding box.
  BackdropNode
  BeginTabGroup_Knob
Begin a group of tabs.
  Bitmask_Knob
Bitmask_Knob
  Boolean_Knob
A knob which holds a boolean value.
  Box
A 2-dimensional rectangle.
  Box3_Knob
A 3-dimensional box.
  CancelledError
  CascadingEnumeration_Knob
Stores a single value between 0 and some maximum, and manages a set of keywords visible to the user.
  ChannelMask_Knob
ChannelMask_Knob
  Channel_Knob
A knob which lets you select a layer and enable or disable individual channels.
  ColorChip_Knob
A knob which holds a single unsigned int that describes a user interface colour.
  Color_Knob
A knob which holds a color.
  ColorspaceLookupError
an excpetion that should be thrown when looking up the colorspace
  Disable_Knob
A knob which holds a boolean value representing the disabled state of a node.
  Double_Knob
A knob which holds one or more double-precision floating point values.
  EditableEnumeration_Knob
Stores a single value between 0 and some maximum, and manages a set of Radio Buttons visible to the user.
  EndTabGroup_Knob
End a group of tabs.
  Enumeration_Knob
Stores a single value between 0 and some maximum, and manages a set of keywords visible to the user.
  EvalString_Knob
A string-valued knob which evaluates it's value as a TCL expression.
  Eyedropper_Knob
Eyedropper_Knob
  File_Knob
A knob which holds a filename.
  FnPySingleton
  Font_Knob
A knob for choosing a font.
  Format
A format.
  Format_Knob
Format_Knob
  FrameRange
A frame range, with an upper and lower bound and an increment.
  FrameRanges
A sequence of FrameRange objects with convenience functions for iterating over all frames in all ranges.
  FreeType_Knob
A knob which holds a font family and style name.
  GeoSelect_Knob
A knob which allows selection of parts of a 3D object.
  Gizmo
  GlobalsEnvironment
Dictionary-style object holding global Nuke state.
  Group
  Hash
A hash value for any number of objects.
  Help_Knob
Help_Knob
  Histogram_Knob
Histogram_Knob
  IArray_Knob
IArray_Knob
  Info
An info object stores x, y, w and h values.
  Int_Knob
A knob which holds one or more integer values.
  Keyer_Knob
Keyer_Knob
  Knob
A modifiable control that appears (unless hidden) in the panel for a node.
  KnobType
Constants for use in parameters which require a knob type.
  Layer
A layer is a set of channels.
  Link_Knob
Link_Knob
  LinkableKnobInfo
A linkable knob description.
  LiveGroup
  LookupCurves_Knob
Provide a set of user-editable lookup curves.
  Lut
Lut
  Menu
Menu
  MenuBar
MenuBar
  MenuItem
MenuItem
  MultiView_Knob
MultiView_Knob
  Multiline_Eval_String_Knob
A knob which evaluates it's string value as a TCL expression.
  Node
  NodeConstructor
NodeConstructor
  Nodes
Nodes
  Obsolete_Knob
For internal use only.
  OneView_Knob
OneView_Knob
  OutputContext
Describes a context in which expressions can be evaluated.
  Panel
Panel
  PanelNode
PanelNode
  ParticleChannels_Knob
ParticleChannels_Knob
  Password_Knob
A knob which holds a password string value.
  Precomp
  ProgressTask
ProgressTask
  Pulldown_Knob
Pulldown_Knob
  PyCustom_Knob
PyCustom_Knob
  PyScript_Knob
PyScript_Knob(name, label=None, command=None) A button that executes a Python script.
  PythonCustomKnob
PythonCustomKnob
  PythonKnob
A string-valued knob which evaluates its value as a Python expression.
  Radio_Knob
Stores a single value between 0 and some maximum, and manages a set of Radio Buttons visible to the user.
  Range_Knob
A knob which the minimum and maximum for a range of values.
  Root
  RunInMainThread
RunInMainThread
  Scale_Knob
Scale_Knob
  SceneGraph_Knob
Displays a list of items as a hierarchy.
  SceneView_Knob
Displays a list of items as a hierarchy.
  Script_Knob
A button which executes a TCL script.
  String_Knob
A knob which holds a string value.
  Tab_Knob
Groups subsequent knobs onto a tab.
  Text_Knob
A knob which holds a string value.
  ToolBar
ToolBar
  Transform2d_Knob
Transform2d_Knob
  UV_Knob
A knob which describes a texture coordinate.
  Undo
Undo
  Unsigned_Knob
A knob which holds one or more unsigned integer values.
  View
A named view.
  ViewView_Knob
ViewView_Knob
  Viewer
  ViewerProcess
ViewerProcess
  ViewerWindow
ViewerWindow
  WH_Knob
A knob which holds width and height values.
  XYZ_Knob
A knob which holds a 3D coordinate.
  XY_Knob
A knob which describes a 2D position.
Functions [hide private]
 
__filterNames(name) source code
ViewerWindow
activeViewer()
Return an object representing the active Viewer panel.
 
addAfterBackgroundFrameRender(call, args=(), kwargs={})
Add code to execute after each frame of a background render.
source code
 
addAfterBackgroundRender(call, args=(), kwargs={})
Add code to execute after any background renders.
source code
 
addAfterFrameRender(call, args=(), kwargs={}, nodeClass='Write')
Add code to execute after each frame of a render
source code
 
addAfterRecording(call, args=(), kwargs={}, nodeClass='Viewer')
Add code to execute after viewer recording
source code
 
addAfterRender(call, args=(), kwargs={}, nodeClass='Write')
Add code to execute after any renders
source code
 
addAfterReplay(call, args=(), kwargs={}, nodeClass='Viewer')
Add code to execute after viewer replay
source code
None
addAutoSaveDeleteFilter(filter)
Add a function to modify the autosave filename before Nuke attempts delete the autosave file.
source code
None
addAutoSaveFilter(filter)
Add a function to modify the autosave filename before Nuke saves the current script on an autosave timeout.
source code
None
addAutoSaveRestoreFilter(filter)
Add a function to modify the autosave restore file before Nuke attempts to restores the autosave file.
source code
 
addAutolabel(call, args=(), kwargs={}, nodeClass='*')
Add code to execute on every node to produce the text to draw on it in the DAG.
source code
 
addBeforeBackgroundRender(call, args=(), kwargs={})
Add code to execute before starting any background renders.
source code
 
addBeforeFrameRender(call, args=(), kwargs={}, nodeClass='Write')
Add code to execute before each frame of a render
source code
 
addBeforeRecording(call, args=(), kwargs={}, nodeClass='Viewer')
Add code to execute before viewer recording
source code
 
addBeforeRender(call, args=(), kwargs={}, nodeClass='Write')
Add code to execute before starting any renders
source code
 
addBeforeReplay(call, args=(), kwargs={}, nodeClass='Viewer')
Add code to execute before viewer replay
source code
 
addDefaultColorspaceMapper(call, args=(), kwargs={}, nodeClass='*')
Add a function to modify default colorspaces before Nuke passes them to Readers or Writers.
source code
None
addFavoriteDir(name, directory, type, icon, tooltip, key)
Add a path to the file choosers favorite directory list.
 
addFilenameFilter(call, args=(), kwargs={}, nodeClass='*')
Add a function to modify filenames before Nuke passes them to the operating system.
source code
Format or None
addFormat(s)
Create a new image format, which will show up on the pull-down menus for image formats.
 
addKnobChanged(call, args=(), kwargs={}, nodeClass='*', node=None)
Add code to execute when the user changes a knob The knob is availble in nuke.thisKnob() and the node in nuke.thisNode().
source code
None
addNodePresetExcludePaths(paths)
@param paths Sequence of paths to exclude Adds a list of paths that will be excluded from Node preset search paths.
 
addOnCreate(call, args=(), kwargs={}, nodeClass='*')
Add code to execute when a node is created or undeleted
source code
 
addOnDestroy(call, args=(), kwargs={}, nodeClass='*')
Add code to execute when a node is destroyed
source code
 
addOnScriptClose(call, args=(), kwargs={}, nodeClass='Root')
Add code to execute before a script is closed
source code
 
addOnScriptLoad(call, args=(), kwargs={}, nodeClass='Root')
Add code to execute when a script is loaded
source code
 
addOnScriptSave(call, args=(), kwargs={}, nodeClass='Root')
Add code to execute before a script is saved
source code
 
addOnUserCreate(call, args=(), kwargs={}, nodeClass='*')
Add code to execute when user creates a node
source code
 
addRenderProgress(call, args=(), kwargs={}, nodeClass='Write')
Add code to execute when the progress bar updates during any renders
source code
 
addSequenceFileExtension(fileExtension)
Adds the input file extension to the list of extensions that will get displayed as sequences in the file browser.
None
addToolsetExcludePaths(paths)
@param paths Sequence of paths to exclude Adds a list of paths that will be excluded from Toolset search paths.
 
addUpdateUI(call, args=(), kwargs={}, nodeClass='*')
Add code to execute on every node when things change.
source code
 
addValidateFilename(call, args=(), kwargs={}, nodeClass='Write')
Add a function to validate a filename in Write nodes.
source code
None
addView(s)
Deprecated.
 
afterBackgroundFrameRender(context) source code
 
afterBackgroundRender(context) source code
 
afterFrameRender() source code
 
afterRecording() source code
 
afterRender() source code
 
afterReplay() source code
None
alert(prompt)
Show a warning dialog box.
List
allNodes(filter, group)
List of all nodes in a group.
None
animation(object, *commands)
Does operations on an animation curve.
float
animationEnd()
Returns the last frame (or x value) for the currently selected animations.
float
animationIncrement()
Returns a recommended interval between samples of the currently selected animation.
float
animationStart()
Returns the starting frame (or x value) for the currently selected animations.
tuple
animations()
Returns a list of animatable things the user wants to work on.
None
applyPreset(nodeName, presetName)
Applies a given preset to the current node.
None
applyUserPreset(nodeName, presetName)
Applies a given user preset to the current node.
bool
ask(prompt)
Show a Yes/No dialog.
bool
askWithCancel(prompt)
Show a Yes/No/Cancel dialog.
 
autoSaveDeleteFilter(filename)
Internal function.
source code
 
autoSaveFilter(filename)
Internal function.
source code
 
autoSaveRestoreFilter(filename)
Internal function.
source code
 
autolabel() source code
None
autoplace(n)
Deprecated.
None
autoplaceSnap(n)
Move node to the closest grid position.
None
autoplace_all()
Performs autoplace of all nodes in current context group.
None
autoplace_snap_all()
Performs autoplace snap of all nodes in current context group.
None
autoplace_snap_selected()
Performs autoplace snap of all selected nodes in current context group.
 
beforeBackgroundRender(context) source code
 
beforeFrameRender() source code
 
beforeRecording() source code
 
beforeRender() source code
 
beforeReplay() source code
int
cacheUsage()
Get the total amount of memory currently used by the cache.
True if the node can be created, or False if not
canCreateNode(name)
This function can be used to determine whether it is possible to create a node with the specified node class.
None
cancel()
Cancel an in-progress operation.
array with x, then y
center()
Return the center values of a group's display, these values are suitable to be passed to nuke.zoom as the DAG center point.
(string)
channels(n=None)
Deprecated.
index
choice(title, prompt, options, default= 0)
Shows a dialog box with the given title and prompt text, and a combo box containing the given options.
None
clearBlinkCache()
Clear the Blink cache for all devices.
None
clearDiskCache()
Clear the disk cache of all files.
None
clearRAMCache()
Clear the RAM cache of all files.
None
clearTabMenuFavorites()
Uncheck every favourite node in tab search menu.
None
clearTabMenuWeighting()
Set the weight of each node to 0 in tab search menu.
Node
clone(n, args, inpanel)
Create a clone node that behaves identical to the original.
bool
cloneSelected(action)
This makes a clone of all selected nodes, preserving connections between them, and makes only the clones be selected.
Group
collapseToGroup(show=True)
Moves the currently selected nodes to a new group, maintaining their previous connections.
Group
collapseToLiveGroup(show=True)
Moves the currently selected nodes to a new group, maintaining their previous connections.
None
connectNodes()
Deprecated.
None
connectViewer(inputNum, node)
Connect a viewer input to a node.
Node
createLiveInput()
Creates a new LiveInput and populates the "file" and "liveGroup" knobs according to the filename and LiveGroup name of the parent group
Node
createNode(node, args, inpanel)
Creates a node of the specified type and adds it to the DAG.
None
createScenefileBrowser(fileName, nodeName)
Pops up a scene browser dialog box.
None
createToolset(filename=None, overwrite=-1, rootPath= None)
Creates a tool preset based on the currently selected nodes.
None
critical(message)
Puts the message into the error console, treating it like an error.
None
debug(message)
Puts the message into the error console, treating it like a debug message, which only shows up when the verbosity level is high enough.
 
defaultColorspaceMapper(colorspace, dataTypeHint)
Called by libnuke.
source code
str
defaultFontPathname()
Get the path to Nukes default font.
int
defaultNodeColor(s)
Get the default node colour.
None
delete(n)
The named node is deleted.
None
deletePreset(nodeClassName, presetName)
Deletes a pre-created node preset
None
deleteUserPreset(nodeClassName, presetName)
Deletes a pre-created user node preset
None
deleteView(s)
Deprecated.
 
dependencies(nodes, what=15)
List all nodes referred to by the nodes argument.
source code
 
dependentNodes(what=15, nodes=[], evaluateAll=True)
List all nodes referred to by the nodes argument.
source code
None
display(s, node, title, width)
Creates a window showing the result of a python script.
None
duplicateSelectedNodes()
Creates a duplicate of all selected nodes in the current script context group @return None.
None
endGroup()
Deprecated.
None
error(message)
Puts the message into the error console, treating it like an error.
None
execute(nameOrNode, start, end, incr, views, continueOnError= False)
execute(nameOrNode, frameRangeSet, views, continueOnError = False) -> None.
None
executeBackgroundNuke(exe_path, nodes, frameRange, views, limits, continueOnError= False, flipbookToRun= , flipbookOptions= {})
Run an instance of Nuke as a monitored sub process.
 
executeInMainThread(call, args=(), kwargs={})
Execute the callable 'call' with optional arguments 'args' and named arguments 'kwargs' i n Nuke's main thread and return immediately.
source code
 
executeInMainThreadWithResult(call, args=(), kwargs={})
Execute the callable 'call' with optional arguments 'args' and named arguments 'kwargs' in Nuke's main thread and wait for the result to become available.
source code
None
executeMultiple(nodes, ranges, views, continueOnError=False)
Execute the current script for a specified frame range.
Bool
executing()
Returns whether an Executable Node is currently active or not.
bool
exists(s)
Check for the existence of a named item.
None
expandSelectedGroup()
Moves all nodes from the currently selected group node into its parent group, maintaining node input and output connections, and deletes the group.
float
expr(s)
Parse a Nuke expression.
float
expression(s)
Parse a Nuke expression.
None
extractSelected()
Disconnects the selected nodes in the group from the tree, and shifts them to the side.
str
filename(node, i)
Return the filename(s) this node or group is working with.
 
filenameFilter(filename) source code
bool
forceClone()
Returns: True if succeeded, False otherwise.
None
forceLoad(n)
Force the plugin to be fully instantiated.
 
fork(...)
Forks a new instance of Nuke optionally with the contents of the named file.
list
formats()
Returns: List of all available formats.
Current frame
frame(f)
Return or set the current frame number.
String
fromNode(n)
Return the Node n as a string.
None
getAllUserPresets()
gets a list of all current user presets
list of strings or string
getClipname(prompt, pattern=None, default=None, multiple=False)
Pops up a file chooser dialog box.
int
getColor(initial)
Show a color chooser dialog and return the selected color as an int.
 
getColorspaceList(colorspaceKnob)
Get a list of all colorspaces listed in an enumeration knob.
source code
None
getDeletedPresets()
gets a list of all currently deleted presets
str
getFileNameList(dir, splitSequences= False, extraInformation= False, returnDirs=True, returnHidden=False)
@param dir the directory to get sequences from @param splitSequences whether to split sequences or not @param extraInformation whether or not there should be extra sequence information on the sequence name @param returnDirs whether to return a list of directories as well as sequences @param returnHidden whether to return hidden files and directories.
list of strings or single string
getFilename(message, pattern=None, default=None, favorites=None, type=None, multiple=False)
Pops up a file chooser dialog box.
list of font families and styl
getFonts()
Return a list of all available font families and styles
(ranges, views)
getFramesAndViews(label, default=None, maxviews=0)
Pops up a dialog with fields for a frame range and view selection.
str
getInput(prompt, default)
Pops up a dialog box with a text field for an arbitrary string.
None
getNodeClassName()
gets the class name for the currently selected node
string list
getNodePresetExcludePaths()
Gets a list of all paths that are excluded from the search for node presets.
None
getNodePresetID()
gets the node preset identifier for the currently selected node
returns the list of OCIO colorspaces
getOcioColorSpaces()
Returns: list of strings
Dock
getPaneFor(panelName)
Returns the first pane that contains the named panel or None if it can't be found.
None
getPresetKnobValues()
gets a list of knob values for a given preset
None
getPresets()
gets a list of all presets for the currently selected node's class
Menu or None
getPresetsMenu(Node)
Gets the presets menu for the currently selected node.
knob
getReadFileKnob(node)
rief Gets the read knob for a node (if it exists).
Returns the progress of the render of a frame from 0 - 100 % complete
getRenderProgress()
Returns: The progress of the render.
string list
getToolsetExcludePaths()
Gets a list of all paths that are excluded from the search for node presets.
None
getUserPresetKnobValues()
gets a list of knob values for a given preset
None
getUserPresets(Node)
gets a list of all user presets for the currently selected node's class
str
hotkeys()
Returns the Nuke key assignments as a string formatted for use in nuke.display().
 
import_module(name, filterRule) source code
int
inputs(n, i)
Deprecated.
None
invertSelection()
Selects all unselected nodes, and deselects all selected ones.
None
knob(name, value, getType, getClass)
rief Returns or sets the entire state of a knob.
 
knobChanged() source code
str
knobDefault(classknob, value)
Set a default value for knobs in nodes that belong to the same class.
None
knobTooltip(classknob, value)
Set an override for a tooltip on a knob.
string list
layers(node=None)
Lists the layers in a node.
Shows information about licenses used by nuke
licenseInfo()
Returns: None
None
load(s)
Load a plugin.
None
loadToolset(filename=None, overwrite=-1)
Loads the tool preset with the given file name.
bool
localisationEnabled(knob)
Checks if localisation is enabled on a given Read_File_Knob.
This functionality has been removed, please check the documentation
localiseFiles(readKnobs)
Returns: None.
bool
localizationEnabled(knob)
Checks if localization is enabled on a given Read_File_Knob.
Group
makeGroup(show=True)
Creates a new group containing copies of all the currently selected nodes.
 
maxPerformanceInfo(...)
maxPerformanceInfo -> Get the max performance info for this session.
str or int
memory(cmd, value)
Get or set information about memory usage.
Menu
menu(name)
Find and return the Menu object with the given name.
None
message(prompt)
Show an info dialog box.
True if modified, False otherwise
modified(status)
Deprecated.
bool
nodeCopy(s)
Copy all selected nodes into a file or the clipboard.
True if any nodes were deleted, False otherwise
nodeDelete(s)
Removes all selected nodes from the DAG.
Node
nodePaste(s)
Paste nodes from a script file or the clipboard.
List
nodeTypes(force_plugin_load=False)
None
nodesSelected()
returns true if any nodes are currently selected
float
numvalue(knob, default=infinity)
The numvalue function returns the current value of a knob.
bool
oculaPresent()
Check whether Ocula is present.
None
ofxAddPluginAliasExclusion(fullOfxEffectName)
Adds the ofx effect name to a list of exclusions that will not get tcl aliases automatically created for them.
bool
ofxMenu()
Find all the OFX plugins (by searching all the directories below $OFX_PLUGIN_PATH, or by reading a cache file stored in $NUKE_TEMP_DIR), then add a menu item for each of them to the main menu.
String list
ofxPluginPath(nuke)
List of all the directories Nuke searched for OFX plugins in.
None
ofxRemovePluginAliasExclusion(fullOfxEffectName)
Remove an ofx plugin alias exclusion that was previously added with .
 
onCreate() source code
 
onDestroy() source code
 
onScriptClose() source code
 
onScriptLoad() source code
 
onScriptSave() source code
 
onUserCreate() source code
List
openPanels()
returns a list of Nodes which have panels open.The last item in the list is the currently active Node panel.
array with x, then y
pan()
Return the pan values of a group's display.
File to write performance profile to for this session
performanceProfileFilename()
Returns the profile filename if performance timers are in use, otherwise returns None.
 
pluginAddPath(args, addToSysPath=True)
Adds all the paths to the beginning of the Nuke plugin path.
source code
 
pluginAppendPath(args, addToSysPath=True)
Add a filepath to the end of the Nuke plugin path.
source code
True if found, or False if not
pluginExists(name)
This function is the same as load(), but only checks for the existence of a plugin rather than loading it.
string list
pluginInstallLocation()
The system-specific locations that Nuke will look in for third-party plugins.
string list
pluginPath()
List all the directories Nuke will search in for plugins.
list of str
plugins(switches=0, *pattern)
Returns a list of every loaded plugin or every plugin available.
str
recentFile(index)
Returns a filename from the recent-files list.
None
redo()
Perform the most recent redo.
None
registerFlipbook(s)
Register a flipbook application name into Nuke.
 
removeAfterBackgroundFrameRender(call, args=(), kwargs={})
Remove a previously-added callback with the same arguments.
source code
 
removeAfterBackgroundRender(call, args=(), kwargs={})
Remove a previously-added callback with the same arguments.
source code
 
removeAfterFrameRender(call, args=(), kwargs={}, nodeClass='Write')
Remove a previously-added callback with the same arguments.
source code
 
removeAfterRecording(call, args=(), kwargs={}, nodeClass='Viewer')
Remove a previously-added callback with the same arguments.
source code
 
removeAfterRender(call, args=(), kwargs={}, nodeClass='Write')
Remove a previously-added callback with the same arguments.
source code
 
removeAfterReplay(call, args=(), kwargs={}, nodeClass='Viewer')
Remove a previously-added callback with the same arguments.
source code
 
removeAutoSaveDeleteFilter(filter)
Remove a previously-added callback with the same arguments.
source code
 
removeAutoSaveFilter(filter)
Remove a previously-added callback with the same arguments.
source code
 
removeAutoSaveRestoreFilter(filter)
Remove a previously-added callback with the same arguments.
source code
 
removeAutolabel(call, args=(), kwargs={}, nodeClass='*')
Remove a previously-added callback with the same arguments.
source code
 
removeBeforeBackgroundRender(call, args=(), kwargs={})
Remove a previously-added callback with the same arguments.
source code
 
removeBeforeFrameRender(call, args=(), kwargs={}, nodeClass='Write')
Remove a previously-added callback with the same arguments.
source code
 
removeBeforeRecording(call, args=(), kwargs={}, nodeClass='Viewer')
Remove a previously-added callback with the same arguments.
source code
 
removeBeforeRender(call, args=(), kwargs={}, nodeClass='Write')
Remove a previously-added callback with the same arguments.
source code
 
removeBeforeReplay(call, args=(), kwargs={}, nodeClass='Viewer')
Remove a previously-added callback with the same arguments.
source code
 
removeDefaultColorspaceMapper(call, args=(), kwargs={}, nodeClass='*')
Remove a previously-added callback with the same arguments.
source code
None
removeFavoriteDir(name, type)
Remove a directory path from the favorites list.
 
removeFilenameFilter(call, args=(), kwargs={}, nodeClass='*')
Remove a previously-added callback with the same arguments.
source code
 
removeFilenameValidate(call, args=(), kwargs={}, nodeClass='Write')
Remove a previously-added callback.
source code
 
removeKnobChanged(call, args=(), kwargs={}, nodeClass='*', node=None)
Remove a previously-added callback with the same arguments.
source code
 
removeOnCreate(call, args=(), kwargs={}, nodeClass='*')
Remove a previously-added callback with the same arguments.
source code
 
removeOnDestroy(call, args=(), kwargs={}, nodeClass='*')
Remove a previously-added callback with the same arguments.
source code
 
removeOnScriptClose(call, args=(), kwargs={}, nodeClass='Root')
Remove a previously-added callback with the same arguments.
source code
 
removeOnScriptLoad(call, args=(), kwargs={}, nodeClass='Root')
Remove a previously-added callback with the same arguments.
source code
 
removeOnScriptSave(call, args=(), kwargs={}, nodeClass='Root')
Remove a previously-added callback with the same arguments.
source code
 
removeOnUserCreate(call, args=(), kwargs={}, nodeClass='*')
Remove a previously-added callback with the same arguments.
source code
 
removeRenderProgress(call, args=(), kwargs={}, nodeClass='Write')
Remove a previously-added callback with the same arguments.
source code
 
removeUpdateUI(call, args=(), kwargs={}, nodeClass='*')
Remove a previously-added callback with the same arguments.
source code
None
render(nameOrNode, start, end, incr, views, continueOnError= False)
execute(nameOrNode, frameRangeSet, views, continueOnError = False) -> None.
 
renderProgress() source code
None
rescanFontFolders()
Rebuild the font cache scanning all available font directories.
None
resetPerformanceTimers()
Clears the accumulated time on the performance timers.
None
restoreWindowLayout(i)
Restores a saved window layout.
None
resumePathProcessing()
Resume path processing.
node
root()
Get the DAG's root node.
bool
runIn(object, cmd)
Execute commands with a given node/knob/field as the 'context'.
float
sample(n, c, x, y, dx, dy)
Get pixel values from an image.
None
saveEventGraphTimers(filePath)
Save events in the event graph.
None
saveToScript(filename, fileContent)
Saves the fileContent with the given filename.
None
saveUserPreset(node, presetName)
Saves a node's current knob values as a user preset.
None
saveWindowLayout(i=-1)
Saves the current window layout.
 
scriptClear(...)
Clears a Nuke script and resets all the root knobs to user defined knob defaults.
 
scriptClose(...)
Close the current script or group.
 
scriptExit(...)
Exit Nuke.
String
scriptName()
Return the current script's file name
 
scriptNew(...)
Start a new script.
 
scriptOpen(...)
Opens a new script containing the contents of the named file.
 
scriptReadFile(...)
Read nodes from a file.
 
scriptReadText(...)
Read nodes from a string.
bool
scriptSave(filename=None)
Saves the current script to the current file name.
None
scriptSaveAndClear(filename=None, ignoreUnsavedChanges=False)
Calls nuke.scriptSave and nuke.scriptClear
source code
None
scriptSaveAs(filename=None, overwrite=-1)
Saves the current script with the given file name if supplied, or (in GUI mode) asks the user for one using the file chooser.
string
scriptSaveToTemp(string)
Saves the script to a file without modifying the root information or the original script
 
scriptSource(...)
Same as scriptReadFile().
 
script_directory() source code
None
selectAll()
Select all nodes in the DAG.
 
selectConnectedNodes()
Selects all nodes in the tree of the selected node.
source code
None
selectPattern()
Selects nodes according to a regular expression matching pattern, entered through an input dialog.
None
selectSimilar(matchType)
Selects nodes that match a node in the current selection based on matchType criteria.
Node
selectedNode()
Returns the 'node the user is thinking about'.
List
selectedNodes(filter)
Returns a list of all selected nodes in the current group.
None
setPreset(nodeClassName, presetName, knobValues)
Create a node preset for the given node using the supplied knob values
None
setReadOnlyPresets(readOnly)
Sets whether newly created presets should be added in read-only mode.
None
setUserPreset(nodeClassName, presetName, knobValues)
Create a node preset for the given node using the supplied knob values
None
show(n, forceFloat)
Opens a window for each named node, as though the user double-clicked on them.
None
showBookmarkChooser(n)
Show bookmark chooser search box.
void
showCreateViewsDialog(views)
Show a dialog to prompt the user to add or create missing views.
None
showDag(n)
Show the tree view of a group node or opens a node control panel.
str
showInfo(n)
Returns a long string of debugging information about each node and the operators it is currently managing.
None
showSettings()
Show the settings of the current group.
None
splayNodes()
Deprecated.
None
startEventGraphTimers()
Start keeping track of events in the event graph.
None
startPerformanceTimers()
Start keeping track of accumulated time on the performance timers, and display the accumulated time in the DAG.
None
stopEventGraphTimers()
Stop keeping track of events in the event graph.
None
stopPerformanceTimers()
Stop keeping track of accumulated time on the performance timers, and cease displaying the accumulated time in the DAG.
string
stripFrameRange(clipname)
Strip out the frame range from a clipname, leaving a file path (still possibly with variables).
None
suspendPathProcessing()
Suspend path processing.
 
tabClose(...)
Close the active dock tab.
 
tabNext(...)
Make the next tab in this dock active.
str
tcl(s, *args)
Run a tcl command.
None
thisClass()
Get the class name of the current node.
Group
thisGroup()
Returns the current context Group node.
Knob
thisKnob()
Returns the current context knob if any.
Node
thisNode()
Return the current context node.
the active pane
thisPane()
Returns the active pane.
Node
thisParent()
Returns the current context Node parent.
Root
thisRoot()
Returns the current context Root node.
str
thisView()
Get the name of the current view.
Node
toNode(s)
Search for a node in the DAG by name and return it as a Python object.
None
toggleFullscreen()
Toggles between windowed and fullscreen mode.
None
toggleViewers()
Toggles all the viewers on and off.
ToolBar
toolbar(name, create=True)
Find and return the ToolBar object with the given name.
None
tprint(value, sep=' ', end='\n', file=sys.stdout, ...)
Prints the values to a stream, or to stdout by default.
None
undo()
Perform the most recent undo.
 
updateUI() source code
returns true if using OCIO instead of Nuke LUTs
usingOcio()
Returns: bool
True if on, False if off
usingPerformanceTimers()
Return true if performance timers are in use.
 
validateFilename(filename) source code
string
value(knob, default)
The value function returns the current value of a knob.
List
views()
List of all the globally existing views.
str
waitForThreadsToFinish()
Returns true if Nuke should wait for any Python threads to finish before exitting.
None
warning(message)
Puts the message into the error console, treating it like a warning.
float
zoom(scale, center, group)
Change the zoom and pan of a group's display.
None
zoomToFitSelected()
Does a zoom to fit on the selected nodes in the DAG
Variables [hide private]
  ADD_VIEWS = 0
  AFTER_CONST = 21
  AFTER_LINEAR = 22
  ALL = 1
  ALWAYS_SAVE = 1048576
  BEFORE_CONST = 19
  BEFORE_LINEAR = 20
  BREAK = 18
  CATMULL_ROM = 3
  CONSTANT = 1
  CUBIC = 4
  DISABLED = 128
  DONT_CREATE_VIEWS = 2
  DONT_SAVE_TO_NODEPRESET = 549755813888
  DO_NOT_WRITE = 512
  ENDLINE = 8192
  EXE_PATH = '/workspace/workspace/Docs/0/bin/Nuke-12.2.112.2dev...
  EXPAND_TO_WIDTH = 68719476736
  EXPRESSIONS = 1
  FLOAT = 5
  FONT = 4
  GEO = 16
  GUI = False
  HIDDEN_INPUTS = 4
  HORIZONTAL = 17
  IMAGE = 1
  INPUTS = 2
  INT16 = 3
  INT8 = 2
  INTERACTIVE = True
  INVALIDHINT = -1
  INVISIBLE = 1024
  KNOB_CHANGED_RECURSIVE = 134217728
  LINEAR = 2
  LINKINPUTS = 8
  LIVEGROUP_CALLBACK_CAN_MAKE_EDITABLE = 'livegroup.can_make_edi...
  LIVEGROUP_CALLBACK_CAN_PUBLISH = 'livegroup.can_publish'
  LIVEGROUP_CALLBACK_MADE_EDITABLE = 'livegroup.made_editable'
  LIVEGROUP_CALLBACK_PUBLISHED = 'livegroup.published'
  LIVEGROUP_CALLBACK_RELOADED = 'livegroup.reloaded'
  LOG = 4
  MATCH_CLASS = 0
  MATCH_COLOR = 2
  MATCH_LABEL = 1
  MONITOR = 0
  NODIR = 2
  NO_ANIMATION = 256
  NO_CHECKMARKS = 1
  NO_MULTIVIEW = 1073741824
  NO_POSTAGESTAMPS = False
  NO_UNDO = 524288
  NUKE_VERSION_DATE = 'Jul 16 2020'
  NUKE_VERSION_MAJOR = 12
  NUKE_VERSION_MINOR = 2
  NUKE_VERSION_PHASE = ''
  NUKE_VERSION_PHASENUMBER = 603072
  NUKE_VERSION_RELEASE = 1
  NUKE_VERSION_STRING = '12.2v1'
  NUM_CPUS = 16
  NUM_INTERPOLATIONS = 5
  PLUGIN_EXT = 'so'
  PRECOMP_CALLBACK_OPENED = 'precomp.opened'
  PREPEND = 8
  PROFILE_ENGINE = 3
  PROFILE_REQUEST = 2
  PROFILE_STORE = 0
  PROFILE_VALIDATE = 1
  PYTHON = 32
  READ_ONLY = 268435456
  REPLACE = 1
  REPLACE_VIEWS = 1
  SAVE_MENU = 33554432
  SCRIPT = 2
  SMOOTH = 0
  STARTLINE = 4096
  STRIP_CASCADE_PREFIX = 4
  TABBEGINCLOSEDGROUP = 2
  TABBEGINGROUP = 1
  TABENDGROUP = -1
  TABKNOB = 0
  THREADS = 16
  TO_SCRIPT = 1
  TO_VALUE = 2
  USER_SET_SLOPE = 16
  VIEWER = 1
  VIEW_NAMES = 'input/view_names'
  WRITE_ALL = 8
  WRITE_NON_DEFAULT_ONLY = 16
  WRITE_USER_KNOB_DEFS = 4
  __package__ = 'nuke'
  afterBackgroundFrameRenders = []
  afterBackgroundRenders = []
  afterFrameRenders = {}
  afterRenders = {}
  autoSaveDeleteFilters = {'Root': [(<function onAutoSaveDelete ...
  autoSaveFilters = {'Root': [(<function onAutoSave at 0x7fabc81...
  autoSaveRestoreFilters = {'Root': [(<function onAutoSaveRestor...
  autolabels = {}
  beforeBackgroundRenders = []
  beforeFrameRenders = {}
  beforeRenders = {}
  defaultLUTMappers = {}
  env = {'64bit': True, 'ExecutablePath': '/workspace/workspace/...
  filenameFilters = {}
  knobChangeds = {'C_CameraSolver2_1': [(<function importKeysCal...
  nodes = <Nodes object at 0x7fac34103090>
  onCreates = {'C_Blender2_1': [(<function genericCreateCallback...
  onDestroys = {'C_CameraIngest2_1': [(<function cameraIngestDes...
  onScriptCloses = {}
  onScriptLoads = {}
  onScriptSaves = {}
  onUserCreates = {'C_CameraIngest2_1': [(<function cameraIngest...
  rawArgs = ['/workspace/workspace/Docs/0/bin/Nuke-12.2.112.2dev...
  renderProgresses = {}
  untitled = 'Untitled'
  updateUIs = {}
  validateFilenames = {}
Function Details [hide private]

activeViewer()

 

Return an object representing the active Viewer panel. This is not the same as the Viewer node, this is the viewer UI element.

Returns: ViewerWindow
Object representing the active ViewerWindow

addAfterBackgroundFrameRender(call, args=(), kwargs={})

source code 
Add code to execute after each frame of a background render.
The call must be in the form of:
def foo(context):
  pass

The context object that will be passed in is a dictionary containing the following elements:
id => The identifier for the task that's making progress
frame => the current frame number being rendered
numFrames => the total number of frames that is being rendered
frameProgress => the number of frames rendered so far.

Please be aware that the current Nuke context will not make sense in the callback (e.g. nuke.thisNode will return a random node).

addAfterBackgroundRender(call, args=(), kwargs={})

source code 
Add code to execute after any background renders.
The call must be in the form of:
def foo(context):
  pass

The context object that will be passed in is a dictionary containing the following elements:
id => The identifier for the task that's ended

Please be aware that the current Nuke context will not make sense in the callback (e.g. nuke.thisNode will return a random node).

addAutoSaveDeleteFilter(filter)

source code 

Add a function to modify the autosave filename before Nuke attempts delete the autosave file.

Look at rollingAutoSave.py in the nukescripts directory for an example of using the auto save filters.

Parameters:
  • filter - A filter function. The first argument to the filter is the current autosave filename. This function should return the filename to delete or return None if no file should be deleted.
Returns: None

addAutoSaveFilter(filter)

source code 

Add a function to modify the autosave filename before Nuke saves the current script on an autosave timeout.

Look at rollingAutoSave.py in the nukescripts directory for an example of using the auto save filters.

Parameters:
  • filter - A filter function. The first argument to the filter is the current autosave filename. The filter should return the filename to save the autosave to.
Returns: None

addAutoSaveRestoreFilter(filter)

source code 

Add a function to modify the autosave restore file before Nuke attempts to restores the autosave file.

Look at rollingAutoSave.py in the nukescripts directory for an example of using the auto save filters.

Parameters:
  • filter - A filter function. The first argument to the filter is the current autosave filename. This function should return the filename to load autosave from or it should return None if the autosave file should be ignored.
Returns: None

addAutolabel(call, args=(), kwargs={}, nodeClass='*')

source code 

Add code to execute on every node to produce the text to draw on it in the DAG. Any value other than None is converted to a string and used as the text. None indicates that previously-added functions should be tried

addBeforeBackgroundRender(call, args=(), kwargs={})

source code 
Add code to execute before starting any background renders.
The call must be in the form of:
def foo(context):
  pass

The context object that will be passed in is a dictionary containing the following elements:
id => The identifier for the task that's about to begin

Please be aware that the current Nuke context will not make sense in the callback (e.g. nuke.thisNode will return a random node).

addDefaultColorspaceMapper(call, args=(), kwargs={}, nodeClass='*')

source code 

Add a function to modify default colorspaces before Nuke passes them to Readers or Writers.

Functions should have the same positional argument as in the definition of defaultLUTMapper()

All added functions are called in backwards order.

addFavoriteDir(name, directory, type, icon, tooltip, key)

 

Add a path to the file choosers favorite directory list. The path name can contain environment variables which will be expanded when the user clicks the favourites button

Parameters:
  • name - Favourite path entry ('Home', 'Desktop', etc.).
  • directory - FileChooser will change to this directory path.
  • type - Optional bitwise OR combination of nuke.IMAGE, nuke.SCRIPT, nuke.FONT or nuke.GEO.
  • icon - Optional filename of an image to use as an icon.
  • tooltip - Optional short text to explain the path and the meaning of the name.
  • key - Optional shortcut key.
Returns: None
None.

addFilenameFilter(call, args=(), kwargs={}, nodeClass='*')

source code 

Add a function to modify filenames before Nuke passes them to the operating system. The first argument to the function is the filename, and it should return the new filename. None is the same as returning the string unchanged. All added functions are called in backwards order.

addFormat(s)

 

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 Academy aperture, for example). The pixel aspect is the ratio of the width of a pixel to the height.

Parameters:
  • s - String in TCL format "w h ?x y r t? ?pa? name".
Returns: Format or None
Format or None.

addKnobChanged(call, args=(), kwargs={}, nodeClass='*', node=None)

source code 

Add code to execute when the user changes a knob The knob is availble in nuke.thisKnob() and the node in nuke.thisNode(). This is also called with dummy knobs when the control panel is opened or when the inputs to the node changes. The purpose is to update other knobs in the control panel. Use addUpdateUI() for changes that should happen even when the panel is closed.

addNodePresetExcludePaths(paths)

 

@param paths Sequence of paths to exclude Adds a list of paths that will be excluded from Node preset search paths.

Returns: None
None.

addSequenceFileExtension(fileExtension)

 

Adds the input file extension to the list of extensions that will get displayed as sequences in the file browser.

Parameters:
  • fileExtension, the, new, file, extension., Valid, examples, are - 'exr', '.jpg'; invalid examples are: 'somefile.ext'

addToolsetExcludePaths(paths)

 

@param paths Sequence of paths to exclude Adds a list of paths that will be excluded from Toolset search paths.

Returns: None
None.

addUpdateUI(call, args=(), kwargs={}, nodeClass='*')

source code 

Add code to execute on every node when things change. This is done during idle, you cannot rely on it being done before it starts updating the viewer

addValidateFilename(call, args=(), kwargs={}, nodeClass='Write')

source code 

Add a function to validate a filename in Write nodes. The first argument is the filename and it should return a Boolean as to whether the filename is valid or not. If a callback is provided, it will control whether the Render button of Write nodes and the Execute button of WriteGeo nodes is enabled or not.

addView(s)

 

Deprecated. Use the Root node.

Adds a new view to the list of views.

Parameters:
  • s - View name.
Returns: None
None

alert(prompt)

 

Show a warning dialog box. Pops up a warning box and waits for the user to hit the OK button.

Parameters:
  • prompt - Present user with this message.
Returns: None
None

allNodes(filter, group)

 

List of all nodes in a group. If you need to get all the nodes in the script from a context which has no child nodes, for instance a control panel, use nuke.root().nodes().

Parameters:
  • filter - Optional. Only return nodes of the specified class.
  • group - Optional. If the group is omitted the current group (ie the group the user picked a menu item from the toolbar of) is used.
  • recurseGroups - Optional. If True, will also return all child nodes within any group nodes. This is done recursively and defaults to False.
Returns: List
List

animation(object, *commands)

 

Does operations on an animation curve.

The following commands are supported:

  • clear deletes all the keys from the animation.
  • erase index last_index removes all keyframes between index and last_index
  • expression newvalue returns or sets the expression for the animation. The default is 'curve' or 'y' which returns the interpolation of the keys.
  • generate 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 sets the frame number for the next keyframe
    • y sets the keyframe value
    • dy sets the left slope
    • ldy sets left and right slope to the same value
    • la and ra are the length of the slope handle in x direction. A value of 1 generates a handle that is one third of the distance to the next keyframe.
  • index x returns the index of the last key with x <= t, return -1 for none.
  • is_key return non-zero if there is a key with x == t. The actual return value is the index+1.
  • move field expression field expression replaces all selected keys in an animation with new ones as explained above in generate
  • name returns a user-friendly name for this animation. This will eliminate any common prefix between this animation and all other selected ones, and also replaces mangled names returned by animations with nice ones.
  • size returns the number of keys in the animation.
  • test errors if no points in the animation are selected
  • y index newvalue gets or sets the value of an animation.
  • x index newvalue gets or sets the horizontal postion of a key. If the animation contains an expression or keyframes, the new value will be overridden.

See also: animations

Parameters:
  • object - The animation curve.
  • commands - a varargs-style list of commands, where each command is one of those defined above.
Returns: None
None

animationEnd()

 

Returns the last frame (or x value) for the currently selected animations.

Returns: float
The end frame.

animationIncrement()

 

Returns a recommended interval between samples of the currently selected animation.

Returns: float
The recommended interval.

animationStart()

 

Returns the starting frame (or x value) for the currently selected animations.

Returns: float
The start frame.

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.

See also: animation, animationStart, animationEnd, animationIncrement

Returns: tuple
A tuple of animatable things.

applyPreset(nodeName, presetName)

 

Applies a given preset to the current node.

Parameters:
  • nodeName - Name of the node to apply the preset to.
  • presetName - Name of the preset to use.
  • node - (optional) a Node object to apply the preset to. If this is provided, the nodeName parameter is ignored.
Returns: None
bool.

applyUserPreset(nodeName, presetName)

 

Applies a given user preset to the current node.

Parameters:
  • nodeName - Name of the node to apply the preset to.
  • presetName - Name of the preset to use.
  • node - (optional) a Node object to apply the preset to. If this is provided, the nodeName parameter is ignored.
Returns: None
bool.

ask(prompt)

 

Show a Yes/No dialog.

Parameters:
  • prompt - Present the user with this message.
Returns: bool
True if Yes, False otherwise.

askWithCancel(prompt)

 

Show a Yes/No/Cancel dialog.

Parameters:
  • prompt - Present the user with this question.
Returns: bool
True if Yes, False if No, an exception is thrown if Cancel.

autoSaveDeleteFilter(filename)

source code 

Internal function. Use addAutoSaveDeleteFilter to add a callback

autoSaveFilter(filename)

source code 

Internal function. Use addAutoSaveFilter to add a callback

autoSaveRestoreFilter(filename)

source code 

Internal function. Use addAutoSaveRestoreFilter to add a callback

autoplace(n)

 

Deprecated. Use Node.autoplace.

Automatically place nodes, so they do not overlap.

Parameters:
  • n - Node.
Returns: None
None

autoplaceSnap(n)

 

Move node to the closest grid position.

Parameters:
  • n - Node.
Returns: None
None

autoplace_all()

 

Performs autoplace of all nodes in current context group.

Returns: None
None. May return exception it top context group has subgraph locked.

autoplace_snap_all()

 

Performs autoplace snap of all nodes in current context group.

Returns: None
None. May return exception it top context group has subgraph locked.

autoplace_snap_selected()

 

Performs autoplace snap of all selected nodes in current context group.

Returns: None
None. May return exception it top context group has subgraph locked.

cacheUsage()

 

Get the total amount of memory currently used by the cache.

Returns: int
Current memory usage in bytes.

canCreateNode(name)

 

This function can be used to determine whether it is possible to create a node with the specified node class.

Parameters:
  • name - Node name.
Returns: True if the node can be created, or False if not
True if the node can be created, or False if not.

cancel()

 

Cancel an in-progress operation. This has the same effect as hitting cancel on the progress panel.

Returns: None
None

center()

 

Return the center values of a group's display, these values are suitable to be passed to nuke.zoom as the DAG center point. Like so: center = nuke.center() zoom = nuke.zoom() print center[0] print center[1] ## move DAG back to center point without changing zoom. nuke.zoom( zoom, center )

Returns: array with x, then y
Array of x, y.

channels(n=None)

 

Deprecated. Use Node.channels.

List channels. The n argument is a Nuke node and if given only the channels output by this node are listed. If not given or None, all channels known about are listed.

Parameters:
  • n - Optional node parameter.
Returns: (string)
A list of channel names.

choice(title, prompt, options, default= 0)

 

Shows a dialog box with the given title and prompt text, and a combo box containing the given options.

Parameters:
  • title - Text to put in the dialog's title bar.
  • prompt - Text to display at the top of the dialog.
  • options - A list of strings for the user to choose from.
  • default - The index (starting from zero) of the option to select first.
Returns: index
An integer index (starting from zero) of the choice the user selected, or None if the dialog was cancelled.

clone(n, args, inpanel)

 

Create a clone node that behaves identical to the original. The node argument is the node to be cloned, args and inpanel are optional arguments similar to createNode. 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.

Parameters:
  • n - Node.
  • args - Optional number of inputs requested.
  • inpanel - Optional boolean.
Returns: Node
Node

cloneSelected(action)

 

This makes a clone of all selected nodes, preserving connections between them, and makes only the clones be selected.

Parameters:
  • action - Optional and if 'copy' it cuts the resulting clones to the clipboard.
Returns: bool
True if succeeded, False otherwise.

collapseToGroup(show=True)

 

Moves the currently selected nodes to a new group, maintaining their previous connections.

Parameters:
  • show - If show is True, the node graph for the new group is shown in the background.
Returns: Group
The new Group node.

collapseToLiveGroup(show=True)

 

Moves the currently selected nodes to a new group, maintaining their previous connections.

Parameters:
  • show - If show is True, the node graph for the new group is shown in the background.
Returns: Group
The new Group node.

connectNodes()

 

Deprecated. Use Group.connectSelectedNodes.

Returns: None
None

connectViewer(inputNum, node)

 

Connect a viewer input to a node. The argument i is the input number and n is either a Nuke node or None. 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 function is used by the numeric shortcuts in the DAG view menu.

Parameters:
  • inputNum - Input number.
  • node - The Node to connect to the input.
Returns: None
None

createLiveInput()

 

Creates a new LiveInput and populates the "file" and "liveGroup" knobs according to the filename and LiveGroup name of the parent group

Returns: Node
The new LiveInput_Node.

createNode(node, args, inpanel)

 

Creates a node of the specified type and adds it to the DAG.

Parameters:
  • node - Node class (e.g. Blur).
  • args - Optional string containing a TCL list of name value pairs (like "size 50 quality 19")
  • inpanel - Optional boolean to open the control bin (default is True; only applies when the GUI is running).
Returns: Node
Node.

createScenefileBrowser(fileName, nodeName)

 

Pops up a scene browser dialog box. Receives the path to an Alembic (abc) or Universal Scene Description (usd/usda/usdc/usdz) file, and displays a hierarchical tree of the nodes within the file. The user can select which nodes they are interested in, and nodes of the appropriate type will automatically. be created. If a valid scene file nodeName is specified, this node will be populated with the selected tree.

Parameters:
  • fileName - Path and filename for an alembic or usd/usda/usdc/usdz file.
  • nodeName - name of a valid scene file node to populate. If the node is invalid, new nodes will be automatically created
Returns: None

createToolset(filename=None, overwrite=-1, rootPath= None)

 
Creates a tool preset based on the currently selected nodes. 

@param filename: Saves the preset as a script with the given file name.
 @param overwrite: If 1 (true) always overwrite; if 0 (false) never overwrite; @param rootPath: If specified, use this as the root path to save the Toolset to. If not specified, save to the user's .nuke/Toolsets folder.  otherwise, in GUI mode ask the user, in terminal do same as False. Default  is -1, meaning 'ask the user'.

Returns: None

critical(message)

 

Puts the message into the error console, treating it like an error. Also pops up an alert dialog to the user, immediately.

Parameters:
  • message - String parameter.
Returns: None
None.

debug(message)

 

Puts the message into the error console, treating it like a debug message, which only shows up when the verbosity level is high enough.

Parameters:
  • message - String parameter.
Returns: None
None.

defaultColorspaceMapper(colorspace, dataTypeHint)

source code 

Called by libnuke.
Calls into Node-level callbacks first, then global callbacks

Arguments:
    colorspace   - the name string of the initial colorspace
    dataTypeHint - sometimes Readers/Writer request the default for a
                   particular data-type, i.e. int8, in16, float, etc.
Return:
    The return should be the transformed/modified colorspace name.
    None is the same as returning the string unchanged.

defaultFontPathname()

 

Get the path to Nukes default font.

Returns: str
Path to the font.

defaultNodeColor(s)

 

Get the default node colour.

Parameters:
  • s - Node class.
Returns: int
The color as a packed integer (0xRRGGBB00).

delete(n)

 

The named node is deleted. It can be recovered with an undo.

Parameters:
  • n - Node.
Returns: None
None

deletePreset(nodeClassName, presetName)

 

Deletes a pre-created node preset

Parameters:
  • nodeClassName - Name of the node class to create a preset for.
  • presetName - Name of the preset to create.
Returns: None
bool.

deleteUserPreset(nodeClassName, presetName)

 

Deletes a pre-created user node preset

Parameters:
  • nodeClassName - Name of the node class to create a preset for.
  • presetName - Name of the preset to create.
Returns: None
bool.

deleteView(s)

 

Deprecated. Use the Root node.

Deletes a view from the list of views.

Parameters:
  • s - View name.
Returns: None
None

dependencies(nodes, what=15)

source code 
List all nodes referred to by the nodes argument. 'what' is an optional integer (see below).
  You can use the following constants or'ed together to select the types of dependencies that are looked for:
         nuke.EXPRESSIONS = expressions
         nuke.LINKINPUTS = link knob inputs
         nuke.INPUTS = visible input pipes
         nuke.HIDDEN_INPUTS = hidden input pipes.
  The default is to look for all types of connections.
  
Example:
  n1 = nuke.nodes.Blur()
  n2 = nuke.nodes.Merge()
  n2.setInput(0, n1)
  deps = nuke.dependencies([n2], nuke.INPUTS | nuke.HIDDEN_INPUTS | nuke.EXPRESSIONS)

dependentNodes(what=15, nodes=[], evaluateAll=True)

source code 
List all nodes referred to by the nodes argument. 'what' is an optional integer (see below).
  You can use the following constants or'ed together to select what types of dependent nodes are looked for:
         nuke.EXPRESSIONS = expressions
         nuke.LINKINPUTS = link knob inputs
         nuke.INPUTS = visible input pipes
         nuke.HIDDEN_INPUTS = hidden input pipes.
  The default is to look for all types of connections.

  evaluateAll is an optional boolean defaulting to True. When this parameter is true, it forces a re-evaluation of the entire tree.
  This can be expensive, but otherwise could give incorrect results if nodes are expression-linked.

  
Example:
  n1 = nuke.nodes.Blur()
  n2 = nuke.nodes.Merge()
  n2.setInput(0, n1)
  ndeps = nuke.dependentNodes(nuke.INPUTS | nuke.HIDDEN_INPUTS | nuke.EXPRESSIONS, [n1])

  @param what: Or'ed constant of nuke.EXPRESSIONS, nuke.LINKINPUTS, nuke.INPUTS and nuke.HIDDEN_INPUTS to select the types of dependent nodes. The default is to look for all types of connections.
  @param evaluateAll: Specifies whether a full tree evaluation will take place. Defaults to True.
  @return: List of nodes. 

display(s, node, title, width)

 

Creates a window showing the result of a python script. The script is executed in the context of the given node, so this and a knob name in expressions refer to that node.

The window will have an 'update' button to run the script again.

Parameters:
  • s - Python script.
  • node - Node.
  • title - Optional title of window.
  • width - Optional width of window.
Returns: None
None.

duplicateSelectedNodes()

 

Creates a duplicate of all selected nodes in the current script context group @return None. May return exception it top context group has subgraph locked.

Returns: None

endGroup()

 

Deprecated. Use Group.run, Group.begin/Group.end pairs or (preferably) the with statement.

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).

Returns: None
None.

error(message)

 

Puts the message into the error console, treating it like an error.

Parameters:
  • message - String parameter.
Returns: None
None.

execute(nameOrNode, start, end, incr, views, continueOnError= False)

 

execute(nameOrNode, frameRangeSet, views, continueOnError = False) -> None.

Execute the named Write node over the specified frames.

There are two variants of this function. The first allows you to specify the frames to write range by giving the start frame number, the end frame number and the frame increment. The second allows you to specify more complicated sets of frames by providing a sequence of FrameRange objects.

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 'cancelled' error. If Nuke is run from the nuke command line (ie nuke was started with the -t switch) execute() prints a text percentage as it progresses. If the user types ^C it will aborting the execute() and return a 'cancelled' error.

Parameters:
  • nameOrNode - A node name or a node object.
  • start - Optional start frame. Default is root.first_frame.
  • end - Optional end frame. Default is root.last_frame.
  • incr - Optional increment. Default is 1.
  • views - Optional list of views. Default is None, meaning "all views".
Returns: None
None

executeBackgroundNuke(exe_path, nodes, frameRange, views, limits, continueOnError= False, flipbookToRun= , flipbookOptions= {})

 

Run an instance of Nuke as a monitored sub process. Returns an integer that's used as unique id for the started task. If it failed to launch this will be -1.

Parameters:
  • exe_path - Path to Nuke or a script that can take Nuke arguments. You probably want to supply nuke.EXE_PATH.
  • nodes - A list of nodes to execute.
  • frameRanges - List of frame ranges to execute.
  • views - A list of view names to execute.
  • limits - A dictionary with system limits, currently uses keys maxThreads and maxCache.
  • flipbookToRun - The name of the flipbook application to run after the render, or an empty string if not desired.
  • flipbookOptions - A dictionary with options to pass to the flipbook. These should include roi and pixelAspect.
Returns: None
Int.

executeMultiple(nodes, ranges, views, continueOnError=False)

 

Execute the current script for a specified frame range. The argument nodes is a sequence of Nuke nodes and ranges is a sequence of range lists. A Nuke range list is a sequence of 3 integers - first, last and incr ( e.g. nuke.execute((w,), ((1,100,1),)) ). The named nodes must all be Write or other executable operators. If no nodes are given then all executable nodes in the current group are executed. Note that DiskCache and Precomp nodes do not get executed with this call, unless explicitly specified.

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 raise a 'cancelled' error. If Nuke is run in terminal mode (with the -t switch) this prints a text percentage as it progresses.

If the user types ^C it will abort the execute() and raise a 'cancelled' error.

Parameters:
  • nodes - Node list.
  • ranges - Optional start frame. Default is root.first_frame.
  • views - Optional list of views. Default is None. Execute for all.
Returns: None
None

executing()

 

Returns whether an Executable Node is currently active or not.

Parameters:
  • f - Optional frame number.
Returns: Bool
Current bool.

exists(s)

 

Check for the existence of a named item. Function for backwards-compatibility with TCL.

Parameters:
  • s - Name of item.
Returns: bool
True if exists, False otherwise.

expandSelectedGroup()

 

Moves all nodes from the currently selected group node into its parent group, maintaining node input and output connections, and deletes the group. Returns the nodes that were moved, which will also be selected.

Returns: None
None

expr(s)

 

Parse a Nuke expression. Runs the same expression parser as is used by animations. This is not the same as the tcl expr parser. The main differences are:

  • Only floating point numbers are calculated. There are no strings, boolean, or integer values.
  • You can name any knob that returns a floating point value, with a dot-separated name, see knob for details on these names. You may follow the knob name with a time in parenthesis (like a function call) and if it is animated it will be evaluated at that time. If it is animated and no time is given, 'frame' is used.
  • The words 'frame', 't', and 'x' evaluate to the frame number of the context node, or the frame number this animation is being evaluated at.
  • The word 'y' in an animation expression evaluates to the value the animation would have if the control points were used and there was no expression. Outside an animation expression y returns zero.
Parameters:
  • s - The expression, as a string.
Returns: float
The result.

expression(s)

 

Parse a Nuke expression. Runs the same expression parser as is used by animations. This is not the same as the tcl expr parser. The main differences are:

  • Only floating point numbers are calculated. There are no strings, boolean, or integer values.
  • You can name any knob that returns a floating point value, with a dot-separated name, see knob for details on these names. You may follow the knob name with a time in parenthesis (like a function call) and if it is animated it will be evaluated at that time. If it is animated and no time is given, 'frame' is used.
  • The words 'frame', 't', and 'x' evaluate to the frame number of the context node, or the frame number this animation is being evaluated at.
  • The word 'y' in an animation expression evaluates to the value the animation would have if the control points were used and there was no expression. Outside an animation expression y returns zero.
Parameters:
  • s - The expression, as a string.
Returns: float
The result.

extractSelected()

 

Disconnects the selected nodes in the group from the tree, and shifts them to the side.

Returns: None
None

filename(node, i)

 

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 expansion of commands and variables is done. However by default it will still have %%04d sequences in it, use REPLACE 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.

Parameters:
  • node - Optional node.
  • i - Optional nuke.REPLACE. Will replace %%04d style sequences with the current frame number.
Returns: str
Filename, or None if no filenames are found.

forceClone()

 
Returns: bool
True if succeeded, False otherwise.

forceLoad(n)

 

Force the plugin to be fully instantiated.

Parameters:
  • n - Optional node argument. Default is the current node.
Returns: None
None

formats()

 
Returns: list
List of all available formats.

frame(f)

 

Return or set the current frame number. Deprecated. Use Root.frame.

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. 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.

Parameters:
  • f - Optional frame number.
Returns: Current frame
Current frame.

fromNode(n)

 

Return the Node n as a string. This function is most useful when combining Python and TCL scripts for backwards compatibility reasons.

Parameters:
  • n - A Node.
Returns: String
String.

getAllUserPresets()

 

gets a list of all current user presets

Returns: None
a list of tuples containing all nodename/presetname pairs.

getClipname(prompt, pattern=None, default=None, multiple=False)

 

Pops up a file chooser dialog box. You can use the pattern to restrict the displayed choices to matching filenames, normal Unix glob rules are used here. getClipname compresses lists of filenames that only differ by an index number into a single entry called a 'clip'.

Parameters:
  • prompt - Present the user with this message.
  • pattern - Optional file selection pattern.
  • default - Optional default filename and path.
  • multiple - Optional boolean convertible object to allow for multiple selection.
Returns: list of strings or string
If multiple is True, the user input is returned as a list of strings, otherwise as a single string. If the dialog is cancelled, the return value is None.

getColor(initial)

 

Show a color chooser dialog and return the selected color as an int.

The format of the color values is packed 8bit rgb multiplied by 256 (ie in hex: 0xRRGGBB00).

Parameters:
  • initial - Optional initial color. Integer with components packed as above.
Returns: int
The selected color.

getColorspaceList(colorspaceKnob)

source code 

Get a list of all colorspaces listed in an enumeration knob. This will strip family names if the knob has the STRIP_CASCADE_PREFIX flag set.

getDeletedPresets()

 

gets a list of all currently deleted presets

Returns: None
a pyDict containing all nodename/presetname pairs.

getFileNameList(dir, splitSequences= False, extraInformation= False, returnDirs=True, returnHidden=False)

 

@param dir the directory to get sequences from @param splitSequences whether to split sequences or not @param extraInformation whether or not there should be extra sequence information on the sequence name @param returnDirs whether to return a list of directories as well as sequences @param returnHidden whether to return hidden files and directories. Retrieves the filename list .

Returns: str
Array of files.

getFilename(message, pattern=None, default=None, favorites=None, type=None, multiple=False)

 

Pops up a file chooser dialog box. You can use the pattern to restrict the displayed choices to matching filenames, normal Unix glob rules are used here.

Parameters:
  • message - Present the user with this message.
  • pattern - Optional file selection pattern.
  • default - Optional default filename and path.
  • favorites - Optional. Restrict favorites to this set. Must be one of 'image', 'script', or 'font'.
  • type - Optional the type of browser, to define task-specific behaviors; currently only 'save' is recognised.
  • multiple - Optional boolean convertible object to allow for multiple selection. If this is True, the return value will be a list of strings; if not, it will be a single string. The default is
Returns: list of strings or single string
If multiple is True, the user input is returned as a list of strings, otherwise as a single string. If the dialog was cancelled, the return value will be None.

getFonts()

 

Return a list of all available font families and styles

Returns: list of font families and styl
List of font families and style.

getFramesAndViews(label, default=None, maxviews=0)

 

Pops up a dialog with fields for a frame range and view selection.

Parameters:
  • label - User message.
  • default - Optional value for the input field.
  • maxviews - Optional max number of views.
Returns: (ranges, views)
List of ranges and views.

getInput(prompt, default)

 

Pops up a dialog box with a text field for an arbitrary string.

Parameters:
  • prompt - Present the user with this message.
  • default - Default value for the input text field.
Returns: str
String from text field or None if dialog is cancelled.

getNodeClassName()

 

gets the class name for the currently selected node

Returns: None
a string containing the name.

getNodePresetExcludePaths()

 

Gets a list of all paths that are excluded from the search for node presets.

Returns: string list
List of paths.

getNodePresetID()

 

gets the node preset identifier for the currently selected node

Returns: None
a string containing the ID.

getOcioColorSpaces()

 
Returns: returns the list of OCIO colorspaces
list of strings

getPaneFor(panelName)

 

Returns the first pane that contains the named panel or None if it can't be found. Note that the panelName must be exact as described in the layout.xml file or the panel ID. For example, 'Properties.1' or 'Viewer.1 or 'co.uk.thefoundry.WebBrowser'

Returns: Dock
The pane or None.

getPresetKnobValues()

 

gets a list of knob values for a given preset

Parameters:
  • nodeClassName - Name of the node class to get values for.
  • presetName - Name of the preset to get values for.
Returns: None
a pyDict containing all knob name/value pairs.

getPresets()

 

gets a list of all presets for the currently selected node's class

Returns: None
a pyList containing all nodename/presetname pairs.

getPresetsMenu(Node)

 

Gets the presets menu for the currently selected node.

Returns: Menu or None
The menu, or None if it doesn't exist.

getReadFileKnob(node)

 

rief Gets the read knob for a node (if it exists).

Parameters:
  • node - The node to get the knob for.
Returns: knob
A PyObject containing the read knob if it exists, NULL otherwise

getRenderProgress()

 
Returns: Returns the progress of the render of a frame from 0 - 100 % complete
The progress of the render. Can be 0 if there is no progress to report.

getToolsetExcludePaths()

 

Gets a list of all paths that are excluded from the search for node presets.

Returns: string list
List of paths.

getUserPresetKnobValues()

 

gets a list of knob values for a given preset

Parameters:
  • nodeClassName - Name of the node class to get values for.
  • presetName - Name of the preset to get values for.
Returns: None
a pyDict containing all knob name/value pairs.

getUserPresets(Node)

 

gets a list of all user presets for the currently selected node's class

Returns: None
a pyList containing all nodename/presetname pairs.

hotkeys()

 

Returns the Nuke key assignments as a string formatted for use in nuke.display().

Returns: str
A formatted string.

inputs(n, i)

 

Deprecated. Use Node.inputs.

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 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.

Parameters:
  • n - Node.
  • i - Optional number of inputs requested.
Returns: int
Number of inputs.

invertSelection()

 

Selects all unselected nodes, and deselects all selected ones.

Returns: None
None.

knob(name, value, getType, getClass)

 

rief 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 getType argument is specified and is True, it will print out the type of the knob rather than getting or setting the value. The type is an integer, using the same list as addUserKnob.

If the getClass argument is specified and is True, it will print out the type of the knob as a string, e.g. 'Int_Knob', 'Enumeration_Knob', 'XY_Knob'.

If both the getType and getClass arguments are present and are True, getType takes precedence.

Parameters:
  • name - The name of the knob.
  • value - Optional argument. If this is present, the value will be stored into the knob.
  • getType - Optional boolean argument. If True, return the class ID for the knob instead of the knob itself. The class ID is an int.
  • getClass - Optional boolean argument. If True, return the class name for the knob instead of the knob itself. The class name is a string.
Returns: None

knobDefault(classknob, value)

 

Set 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. knobDefault can be used to specify file format specific knobs. These are knobs that are added to Read, Write and other file format dependent nodes when the file name changes. To specify defaults, use the class name, followed by the file format extension, followed by the knob name, all separated by periods. An example is shown below.

Example: nuke.knobDefault("Blur.size", "20")

Example: nuke.knobDefault("Read.exr.compression", "2")

Parameters:
  • classknob - String in the form "class.knob" where "class" is the class of Node, i.e. Blur, and "knob" is the name of the knob. This can also include a file extension, as in "class.extension.knob"
  • value - Optional string to convert to the default value.
Returns: str
None or String with the default value.

knobTooltip(classknob, value)

 
Set an override for a tooltip on a knob.

Example:

   nuke.knobTooltip('Blur.size', '[some text]')

@param classknob: String in the form "class.knob" where "class" is the class of Node, i.e. Blur, and "knob" is the name of the knob.
@param value: String to use as the tooltip
@return: None

Returns: None

layers(node=None)

 

Lists the layers in a node. If no node is provided this will list all known layer names in this script.

Parameters:
  • node - Optional node parameter.
Returns: string list
A list of layer names.

licenseInfo()

 
Returns: Shows information about licenses used by nuke
None

load(s)

 

Load a plugin. You can force a certain plugin to load with this function. If the plugin has already been loaded nothing happens. If there is no slash in the name then the pluginPath() 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 your OS dynamic library extension is) and finding nothing will also try to append '.tcl' and '.py'.

Parameters:
  • s - Plugin name or filename.
Returns: None
None
Raises:
  • RuntimeError - if the plugin couldn't be loaded for any reason.

loadToolset(filename=None, overwrite=-1)

 

Loads the tool preset with the given file name.

Parameters:
  • filename - name of preset script file to load
Returns: None

localisationEnabled(knob)

 

Checks if localisation is enabled on a given Read_File_Knob.

[DEPRECATION WARNING] function will be removed in Nuke 12 use 'localizationEnabled' instead.

Parameters:
  • knob - The Read_File_Knob to check.
Returns: bool
true if enabled, false otherwise

localiseFiles(readKnobs)

 
Returns: This functionality has been removed, please check the documentation
None.

localizationEnabled(knob)

 

Checks if localization is enabled on a given Read_File_Knob.

Parameters:
  • knob - The Read_File_Knob to check.
Returns: bool
true if enabled, false otherwise

makeGroup(show=True)

 

Creates a new group containing copies of all the currently selected nodes. Note that this creates duplicates of the selected nodes, rather than moving them.

Parameters:
  • show - If show is True, the node graph for the new group is shown.
Returns: Group
The new Group node.

maxPerformanceInfo(...)

 

maxPerformanceInfo -> Get the max performance info for this session.

Returns a struct containing the max performance info if performance timers are in use, otherwise returns None.

memory(cmd, value)

 
Get or set information about memory usage.

The value parameter is optional and is only used by some of the commands (see below).

The cmd parameter specifies what memory information to retrieve. It can be one of the following values:
- info [node-name]                           Return a string describing current memory usage. Can optionally provide it for a specific node.
- infoxml [format_bytes] [node-name]         Return current memory usage as above, but in XML format. Can optionally provide if bytes should be formatted to be human readable, and also a specific node
- allocator_info [format_bytes]              Return current allocator usage in XML format. Can optionally provide if bytes should be formatted to be human readable
- free [size]                                Free as much memory as possible. If a size is specified, if will stop trying to free memory when usage drops below the size.
- usage                                      Return the amount of memory currently in use.
- max_usage [size]                           If no size is specified, returns the current size of the memory limit.  If a size is given, then set this size as the memory limit.
- total_ram                                  Return the total amount of RAM.
- total_vm                                   Return the total virtual memory.
- free_count [num]                           Get or set the free count.
- new_handler_count [num]                    Get or set the new handler count.

Returns: str or int

menu(name)

 

Find and return the Menu object with the given name. Current valid menus are:

'Nuke' the application menu 'Pane' the UI Panes & Panels menu 'Nodes' the Nodes toolbar (and Nodegraph right mouse menu) 'Properties' the Properties panel right mouse menu 'Animation' the knob Animation menu and Curve Editor right mouse menu 'Viewer' the Viewer right mouse menu 'Node Graph' the Node Graph right mouse menu 'Axis' functions which appear in menus on all Axis_Knobs.

Parameters:
  • name - The name of the menu to get. Must be one of the values above.
Returns: Menu
The menu.
Raises:
  • RuntimeError - if Nuke isn't in GUI mode.

message(prompt)

 

Show an info dialog box. Pops up an info box (with a 'i' and the text message) and waits for the user to hit the OK button.

Parameters:
  • prompt - Present user with this message.
Returns: None
None

modified(status)

 

Deprecated. Use Root.modified and Root.setModified.

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.

Parameters:
  • status - Optional boolean value. If this is present the status will be set to this value; otherwise it will be retrieved instead.
Returns: True if modified, False otherwise
True if modified, False otherwise.

nodeCopy(s)

 

Copy all selected nodes into a file or the clipboard.

Parameters:
  • s - The name of a clipboad to copy into. If s is the string '%clipboard%' this will copy into the operating systems clipboard.
Returns: bool
True if any nodes were selected, False otherwise.

nodeDelete(s)

 

Removes all selected nodes from the DAG.

Returns: True if any nodes were deleted, False otherwise
True if all nodes were deleted, False if at least one wasn't.

nodePaste(s)

 

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 nodeCopy command. The 's' argument can be '%clipboard%' to paste the operating system's clipboard contents.

Parameters:
  • s - The 's' argument can be '%clipboard%' to paste the operating system's clipboard contents.
Returns: Node
Node

nodeTypes(force_plugin_load=False)

 
Parameters:
  • force_plugin_load, bool, True, to, force, loading, all, plugins, on, the, path, before, querying, node, types, (default - False) @return list of all loaded node types
Returns: List

numvalue(knob, default=infinity)

 

The numvalue function 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.

Parameters:
  • knob - A knob.
  • default - Optional default value to return if the knob's value cannot be converted to a number.
Returns: float
A numeric value for the knob, or the default value (if any).

oculaPresent()

 

Check whether Ocula is present.

Returns: bool
True if Ocula is present, False if not.

ofxAddPluginAliasExclusion(fullOfxEffectName)

 

Adds the ofx effect name to a list of exclusions that will not get tcl aliases automatically created for them. For example, if there is an ofx plugin with a fully qualified name of: 'OFXuk.co.thefoundry.noisetools.denoise_v100'. Nuke by default would automatically alias that so that nuke.createNode('Denoise') will create that node type. By calling nuke.ofxAddPluginAliasExclusion('OFXuk.co.thefoundry.noisetools.denoise_v100'), you'd be changing that such that the only way to create a node of that type would be to call nuke.createNode('OFXuk.co.thefoundry.noisetools.denoise_v100') This does not change saving or loading of Nuke scripts with that plugin used in any way.

Parameters:
  • fullOfxEffectName - The fully qualified name of the ofx plugin to add to the exclusion list.
Returns: None
None.

ofxMenu()

 

Find all the OFX plugins (by searching all the directories below $OFX_PLUGIN_PATH, or by reading a cache file stored in $NUKE_TEMP_DIR), then add a menu item for each of them to the main menu.

Returns: bool
True if succeeded, False otherwise.

ofxPluginPath(nuke)

 

List of all the directories Nuke searched for OFX plugins in.

Returns: String list
String list

ofxRemovePluginAliasExclusion(fullOfxEffectName)

 

Remove an ofx plugin alias exclusion that was previously added with . Example: nuke.ofxRemovePluginAliasExclusion('OFXuk.co.thefoundry.noisetools.denoise_v100')

Parameters:
  • fullOfxEffectName - The fully qualified name of the ofx plugin to remove from the exclusion list.
Returns: None
None.

pan()

 

Return the pan values of a group's display. This function is deprecated and will be removed in a future version. You probably want to use nuke.center().

n = nuke.pan() print n[0] print n[1]

Returns: array with x, then y
Array of x, y.

pluginAddPath(args, addToSysPath=True)

source code 

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.py then the init.py in the path will be executed. It also adds the paths to the sys.path, if addToSysPath is True.

pluginAppendPath(args, addToSysPath=True)

source code 

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. It also appends the paths to the sys.path, if addToSysPath is True.

pluginExists(name)

 

This function is the same as load(), but only checks for the existence of a plugin rather than loading it. If there is no slash in the name then the pluginPath() 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 your OS dynamic library extension is) and finding nothing will also try to append '.tcl' and '.py'.

Parameters:
  • name - Plugin name or filename.
Returns: True if found, or False if not
True if found, or False if not.

pluginInstallLocation()

 

The system-specific locations that Nuke will look in for third-party plugins.

Returns: string list
List of paths.

pluginPath()

 

List all the directories Nuke will search in for plugins.

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 replace the ~/.nuke with your own set of directories, but the plugins directory is always on the end.

Returns: string list
List of paths.

plugins(switches=0, *pattern)

 
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 the pattern will be returned. You can give more than one glob pattern if desired.

You can also put options 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.

If you don't specify any switches, the default behaviour is to return a list
with the full paths of all loaded plugins.

@param switches: Optional parameter. Bitwise OR of nuke.ALL, nuke.NODIR.
@param pattern: Zero or more glob patterns.
@return: List of plugins.

Returns: list of str

recentFile(index)

 

Returns a filename from the recent-files list.

Parameters:
  • index - A position in the recent files list. This must be a non-negative number.
Returns: str
A file path.
Raises:
  • ValueError - if the index is negative.
  • RuntimeError - if there is no entry in the recent files list for the specified index.

redo()

 

Perform the most recent redo.

Returns: None
None

registerFlipbook(s)

 

Register a flipbook application name into Nuke.

Parameters:
  • s - Name of the flipbook application to be registered.
Returns: None
None

removeFavoriteDir(name, type)

 

Remove a directory path from the favorites list.

Parameters:
  • name - Favourite path entry ('Home', 'Desktop', etc.).
  • type - Optional bitwise OR combination of nuke.IMAGE, nuke.SCRIPT, nuke.FONT or nuke.GEO.
Returns: None
None

render(nameOrNode, start, end, incr, views, continueOnError= False)

 

execute(nameOrNode, frameRangeSet, views, continueOnError = False) -> None.

Execute the named Write node over the specified frames.

There are two variants of this function. The first allows you to specify the frames to write range by giving the start frame number, the end frame number and the frame increment. The second allows you to specify more complicated sets of frames by providing a sequence of FrameRange objects.

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 'cancelled' error. If Nuke is run from the nuke command line (ie nuke was started with the -t switch) execute() prints a text percentage as it progresses. If the user types ^C it will aborting the execute() and return a 'cancelled' error.

Parameters:
  • nameOrNode - A node name or a node object.
  • start - Optional start frame. Default is root.first_frame.
  • end - Optional end frame. Default is root.last_frame.
  • incr - Optional increment. Default is 1.
  • views - Optional list of views. Default is None, meaning "all views".
Returns: None
None

rescanFontFolders()

 

Rebuild the font cache scanning all available font directories.

Returns: None
None.

restoreWindowLayout(i)

 

Restores a saved window layout.

Parameters:
  • i - Layout number
Returns: None
None

resumePathProcessing()

 

Resume path processing. Use prior to performingmultiple node graph modifications, to avoid repeated path processing.

Returns: None
None.

root()

 

Get the DAG's root node. Always succeeds.

Returns: node
The root node. This will never be None.

runIn(object, cmd)

 

Execute commands with a given node/knob/field 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.

Parameters:
  • object - Name of object.
  • cmd - Command to run.
Returns: bool
True if succeeded, False otherwise.

sample(n, c, x, y, dx, dy)

 

Get pixel values from an image. Deprecated, use Node.sample instead.

This requires the image to be calculated, so performance may be very bad if this is placed into an expression in a control panel. Produces a cubic filtered result. Any sizes less than 1, including 0, produce the same filtered result, this is correct based on sampling theory. 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'.

Parameters:
  • n - Node.
  • c - Channel name.
  • x - Centre of the area to sample (X coordinate).
  • y - Centre of the area to sample (Y coordinate).
  • dx - Optional size of the area to sample (X coordinate).
  • dy - Optional size of the area to sample (Y coordinate).
Returns: float
Floating point value.

saveEventGraphTimers(filePath)

 

Save events in the event graph.

Parameters:
  • filePath - specify the file path where the event graph profiling data should be saved to.
Returns: None

saveUserPreset(node, presetName)

 

Saves a node's current knob values as a user preset.

Parameters:
  • presetName - Name of the preset to create.
Returns: None
bool.

saveWindowLayout(i=-1)

 

Saves the current window layout.

Parameters:
  • i - Optional layout index. If this is omitted or set to a negative value, save as the default layout.
Returns: None
None.

scriptClear(...)

 

Clears a Nuke script and resets all the root knobs to user defined knob defaults. To reset to compiled in defaults only pass in resetToCompiledDefaults=True.

scriptClose(...)

 

Close the current script or group. Returns True if successful.

scriptNew(...)

 

Start a new script. Returns True if successful.

scriptSave(filename=None)

 

Saves the current script to the current file name. If there is no current file name and Nuke is running in GUI mode, the user is asked for a name using the file chooser.

Parameters:
  • filename - Save to this file name without changing the script name in the project (use scriptSaveAs() if you want it to change).
Returns: bool
True if the file was saved, otherwise an exception is thrown.

scriptSaveAndClear(filename=None, ignoreUnsavedChanges=False)

source code 

Calls nuke.scriptSave and nuke.scriptClear

Parameters:
  • filename - Save to this file name without changing the script name in the project.
  • ignoreUnsavedChanges - Optional. If set to True scripSave will be called, ignoring any unsaved changes
Returns: None
True when sucessful. False if the user cancels the operation. In this case nuke.scripClear will not be called

scriptSaveAs(filename=None, overwrite=-1)

 

Saves the current script with the given file name if supplied, or (in GUI mode) asks the user for one using the file chooser. If Nuke is not running in GUI mode, you must supply a filename.

Parameters:
  • filename - Saves the current script with the given file name if supplied, or (in GUI mode) asks the user for one using the file chooser.
  • overwrite - If 1 (true) always overwrite; if 0 (false) never overwrite; otherwise, in GUI mode ask the user, in terminal do same as False. Default is -1, meaning 'ask the user'.
Returns: None

selectAll()

 

Select all nodes in the DAG.

Returns: None
None

selectPattern()

 

Selects nodes according to a regular expression matching pattern, entered through an input dialog. The pattern can include wildcards ('?' and '*') as well as regular expressions. The expressions are checked against the node name, label, class, and associated file names.

Returns: None
None

selectSimilar(matchType)

 

Selects nodes that match a node in the current selection based on matchType criteria.

Parameters:
  • matchType - One of nuke.MATCH_CLASS, nuke.MATCH_LABEL, nuke.MATCH_COLOR.
Returns: None
None.

selectedNode()

 

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 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.

Returns: Node
Node.

selectedNodes(filter)

 

Returns a list 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.

Parameters:
  • filter - Optional class of Node. Instructs the algorithm to apply only to a specific class of nodes.
Returns: List
The list of selected nodes.

setPreset(nodeClassName, presetName, knobValues)

 

Create a node preset for the given node using the supplied knob values

Parameters:
  • nodeClassName - Name of the node class to create a preset for.
  • presetName - Name of the preset to create.
  • knobValues - A dictionary containing a set of knob names and preset values.
Returns: None
bool.

setReadOnlyPresets(readOnly)

 

Sets whether newly created presets should be added in read-only mode. Read-only presets can be applied to a node, but can't be overwritten or deleted.

Returns: None

setUserPreset(nodeClassName, presetName, knobValues)

 

Create a node preset for the given node using the supplied knob values

Parameters:
  • nodeClassName - Name of the node class to create a preset for.
  • presetName - Name of the preset to create.
  • knobValues - A dictionary containing a set of knob names and preset values.
Returns: None
bool.

show(n, forceFloat)

 

Opens a window for each named node, as though the user double-clicked on them. For normal operators this opens the control panel, for viewers it opens the viewer, for groups it opens the control panel.

Parameters:
  • n - Optional node argument. Default is the current node.
  • forceFloat - Optional python object. If it evaluates to True it will open the window as a floating panel. Default is False.
Returns: None
None

showBookmarkChooser(n)

 

Show bookmark chooser search box.

Returns: None
None

showCreateViewsDialog(views)

 

Show a dialog to prompt the user to add or create missing views.

Parameters:
  • views - List of views to be created.
Returns: void
An integer value representing the choice the user selected: nuke.ADD_VIEWS, nuke.REPLACE_VIEWS or nuke.DONT_CREATE_VIEWS

showDag(n)

 

Show the tree view of a group node or opens a node control panel.

Parameters:
  • n - Optional Group.
Returns: None
None

showInfo(n)

 

Returns a long string of debugging information about each node and the operators it is currently managing. You should not rely on its contents or format being the same in different versions of Nuke.

Parameters:
  • n - Optional node argument.
Returns: str
String.

showSettings()

 

Show the settings of the current group.

Returns: None
None

splayNodes()

 

Deprecated. Use Group.splaySelectedNodes.

Returns: None
None

stripFrameRange(clipname)

 

Strip out the frame range from a clipname, leaving a file path (still possibly with variables).

Parameters:
  • clipname - The clipname.
Returns: string
The name without the frame range.

suspendPathProcessing()

 

Suspend path processing. Use prior to performingmultiple node graph modifications, to avoid repeated path processing.

Returns: None
None.

tabClose(...)

 

Close the active dock tab. Returns True if successful.

tabNext(...)

 

Make the next tab in this dock active. Returns True if successful.

tcl(s, *args)

 

Run a tcl command. The arguments must be strings and passed to the command. If no arguments are given and the command has whitespace in it then it is instead interpreted as a tcl program (this is deprecated).

Parameters:
  • s - TCL code.
  • args - The arguments to pass in to the TCL code.
Returns: str
Result of TCL command as string.

thisClass()

 

Get the class name of the current node. This equivalent to calling nuke.thisNode().Class(), only faster.

Returns: None
The class name for the current node.

thisGroup()

 

Returns the current context Group node.

Returns: Group
The group node.

thisKnob()

 

Returns the current context knob if any.

Returns: Knob
Knob or None

thisNode()

 

Return the current context node.

Returns: Node
The node.

thisPane()

 

Returns the active pane. This is only valid during a pane menu callback or window layout restoration.

Returns: the active pane
The active pane.

thisParent()

 

Returns the current context Node parent.

Returns: Node
A node.

thisRoot()

 

Returns the current context Root node.

Returns: Root
The root node.

thisView()

 

Get the name of the current view.

Returns: str
The current view name as a string.

toNode(s)

 

Search for a node in the DAG by name and return it as a Python object.

Parameters:
  • s - Node name.
Returns: Node
Node or None if it does not exist.

toggleFullscreen()

 

Toggles between windowed and fullscreen mode.

Returns: None
None

toggleViewers()

 

Toggles all the viewers on and off.

Returns: None
None

toolbar(name, create=True)

 

Find and return the ToolBar object with the given name. The name of the built-in nodes toolbar is 'Nodes'.

A RuntimeException is thrown if not in GUI mode.

Parameters:
  • name - The name of the toolbar to find or create.
  • create - Optional parameter. True (the default value) will mean that a new toolbar gets created if one with the given name couldn't be found; False will mean that no new toolbar will be created.@return: The toolbar, or None if no toolbar was found and 'create' was False.
Returns: ToolBar

tprint(value, sep=' ', end='\n', file=sys.stdout, ...)

 

Prints the values to a stream, or to stdout by default.

Parameters:
  • value - A python object
  • file - a file-like object (stream); defaults to stdout.
  • sep - string inserted between values, default a space.
  • end - string appended after the last value, default a newline.
Returns: None
None

undo()

 

Perform the most recent undo.

Returns: None
None

usingOcio()

 
Returns: returns true if using OCIO instead of Nuke LUTs
bool

value(knob, default)

 

The value function returns the current value of a knob. The knob argument is a string referring to a knob and default is an optional default value to be returned in case of an error. Unlike knob(), this will evaluate animation at the current frame, and expand brackets and dollar signs in string knobs.

Returns: string

views()

 

List of all the globally existing views.

Returns: List
List

waitForThreadsToFinish()

 

Returns true if Nuke should wait for any Python threads to finish before exitting.

Returns: str
True or False.

warning(message)

 

Puts the message into the error console, treating it like a warning.

Parameters:
  • message - String parameter.
Returns: None
None.

zoom(scale, center, group)

 

Change the zoom and pan of a group's display. The scale argument is the new zoom factor. If the scale is given, but not the center, the zoom is set to that factor and the view is positioned so the cursor is pointing at the same place it was before zooming. A zero or negative scale value will cause a zoom-to-fit.

If both scale and center arguments are given, the view is zoomed and then centered on the specified point.

The new scale factor will be returned, or None if the function is run in a non-GUI context.

Parameters:
  • scale - New zoom factor.
  • center - Optional 2-item tuple specifying the center coordinates.
  • group - Optional Group. This is ignored at present.
Returns: float
Current zoom factor or None if not in a GUI context.

zoomToFitSelected()

 

Does a zoom to fit on the selected nodes in the DAG

Returns: None
None.

Variables Details [hide private]

EXE_PATH

Value:
'/workspace/workspace/Docs/0/bin/Nuke-12.2.112.2dev.603072-Release--re\
lease/Nuke12.2'

LIVEGROUP_CALLBACK_CAN_MAKE_EDITABLE

Value:
'livegroup.can_make_editable'

autoSaveDeleteFilters

Value:
{'Root': [(<function onAutoSaveDelete at 0x7fabc8174b18>,
           (),
           {},
           None)]}

autoSaveFilters

Value:
{'Root': [(<function onAutoSave at 0x7fabc8174a28>, (), {}, None)]}

autoSaveRestoreFilters

Value:
{'Root': [(<function onAutoSaveRestore at 0x7fabc8174c08>,
           (),
           {},
           None)]}

env

Value:
{'64bit': True, 'ExecutablePath': '/workspace/workspace/Docs/0/bin/Nuk\
e-12.2.112.2dev.603072-Release--release/Nuke12.2', 'ExternalPython': F\
alse, 'LINUX': True, 'MACOS': False, 'NukeLibraryPath': '/workspace/wo\
rkspace/Docs/0/bin/Nuke-12.2.112.2dev.603072-Release--release/libnuke-\
12.2.1.so', 'NukeVersionDate': 'Jul 16 2020', 'NukeVersionMajor': 12, \
'NukeVersionMinor': 2, 'NukeVersionPhase': None, 'NukeVersionPhaseNumb\
er': 603072, 'NukeVersionRelease': 1, 'NukeVersionString': '12.2v1', '\
PluginExtension': 'so', 'PluginsVerbose': False, 'WIN32': False, 'assi\
...

knobChangeds

Value:
{'C_CameraSolver2_1': [(<function importKeysCallback2_1 at 0x7fabcbc7c\
ed8>,
                        (),
                        {},
                        None)],
 'C_ColourMatcher2_1': [(<function importKeysCallback2_1 at 0x7fabcbc7\
ced8>,
                         (),
...

onCreates

Value:
{'C_Blender2_1': [(<function genericCreateCallback2_1 at 0x7fabcbc7ce6\
0>,
                   (),
                   {},
                   None)],
 'C_CameraIngest2_1': [(<function genericCreateCallback2_1 at 0x7fabcb\
c7ce60>,
                        (),
...

onDestroys

Value:
{'C_CameraIngest2_1': [(<function cameraIngestDestroyCallback2_1 at 0x\
7fabcbc7cd70>,
                        (),
                        {},
                        None)],
 'C_GlobalWarp2_1': [(<function globalWarpDestroyCallback2_1 at 0x7fab\
cbc7cb18>,
                      (),
...

onUserCreates

Value:
{'C_CameraIngest2_1': [(<function cameraIngestUserCreateCallback2_1 at\
 0x7fabcbc7cb90>,
                        (),
                        {},
                        None)],
 'C_VerticalAligner2_1': [(<function verticalAlignerUserCreateCallback\
2_1 at 0x7fabcbc7cde8>,
                           (),
...

rawArgs

Value:
['/workspace/workspace/Docs/0/bin/Nuke-12.2.112.2dev.603072-Release--r\
elease/Nuke12.2',
 '-t',
 '/workspace/workspace/Docs/0/doc_src/src/nuke_epydoc.py',
 '/workspace/workspace/Docs/0/epydoc/bin',
 '--config',
 '/workspace/workspace/Docs/0/doc_src/src/nuke_epydoc.cfg',
 '-o',
...