nuke.Precomp¶
-
class
nuke.
Precomp
¶ Bases:
Group
Methods
- return
Class of node.
Specific callback type can be find in the documentation of the related type or function.
Add knob k to this node or panel.
Get a list of all knobs in this node, including nameless knobs.
Automatically place nodes, so they do not overlap.
Bounding box of the node.
All python code that follows will be executed in the context of node.
Check whether the output of ‘node’ can be connected to input i.
List channels output by this node.
Clear the custom icon set for the node.
- return
Number of clones.
Connect the output of ‘node’ to the i’th input or the next available unconnected input.
Connect the selected nodes.
Return pixel values from a deep image.
Return number of samples for a pixel on a deep image.
List all nodes referred to by this node. ‘what’ is an optional integer (see below). You can use the following constants or’ed together to select what types of dependencies are looked for: nuke.EXPRESSIONS = expressions nuke.LINKINPUTS = link knobs nuke.INPUTS = visible input pipes nuke.HIDDEN_INPUTS = hidden input pipes. The default is to look for all types of connections.
List all nodes that read information from this node. ‘what’ is an optional integer:
All python code that follows will no longer be executed in the context of node.
True if the node or any in its input tree have an error, or False otherwise.
self.executeCallback(string) -> Executes the callback, if exists related to the specified event.
Moves all nodes from the group node into its parent group, maintaining node input and output connections, and deletes the group.
- param start
first frame
First frame in frame range for this node.
- return
None
Force the node to validate itself, updating its hash.
Format of the node.
Frame range for this node.
Get the name of this node and any groups enclosing it in ‘group.group.name’ form.
self.numKnobs() -> The number of knobs.
True if the node itself has an error, regardless of the state of the ops in its input tree, or False otherwise.
Height of the node.
- return
Help for the node.
- return
None
- param i
Input number.
- return
Number of the highest connected input + 1. If inputs 0, 1, and 3 are connected, this will return 4.
- return
True if the node allows cloning, False otherwise.
- return
true if the Localization source file has changed
- return
bool
Returns the current selection state of the node.
- param p
A string or an integer.
Get a dictionary of (name, knob) pairs for all knobs in this node.
Last frame in frame range for this node.
Returns a list of any knobs that may be linked to from the node as well as some meta information about the knob.
- return
float, between 0.0 (not localized) and 1.0 (localized)
self.maximumInputs() -> Maximum number of inputs this node can have.
self.maximumOutputs() -> Maximum number of outputs this node can have.
- return
Maximum number of inputs this node can have.
- return
Maximum number of outputs this node can have.
Return the metadata item for key on this node at current output context, or at optional time and view.
self.minimumInputs() -> Minimum number of inputs this node can have.
- return
Minimum number of inputs this node can have.
- return
Name of node.
Locate a node by name.
List of nodes in group.
- return
The number of knobs.
Number of nodes in group.
Returns a list of hash values, one for each op in this node.
- return
Number of first optional input.
Return output node of group.
@category: performance category ( optional ).A performance category, must be either nuke.PROFILE_STORE, nuke.PROFILE_VALIDATE, nuke.PROFILE_REQUEST or nuke.PROFILE_ENGINE The default is nuke.PROFILE_ENGINE which gives the performance info of the render engine.
Pixel Aspect ratio of the node.
- return
True if proxy is enabled, False otherwise.
Read the knobs from a string (TCL syntax).
Force a redraw of the node.
Precomp Node reload() :return: None
Remove knob k from this node or panel.
Reset all the knobs to their default values.
Execute in the context of node.
Class method.
Return pixel values from an image.
Height of the node when displayed on screen in the DAG, at 1:1 zoom, in pixels.
Width of the node when displayed on screen in the DAG, at 1:1 zoom, in pixels.
Set this node to be the only selection, as if it had been clicked in the DAG.
Returns the node the user is most likely thinking about.
Selected nodes.
Set a custom icon for the node.
Connect input i to node if canSetInput() returns true.
Set name of the node and resolve name collisions if optional named argument ‘uncollide’ is True.
Set the selection state of the node.
- param tabIndex
The tab to show (first is 0).
Set the (x, y) position of node in node graph.
Set the x position of node in node graph.
Set the y position of node in node graph.
- param forceFloat
Optional python object. If it evaluates to True the control panel will always open as a floating panel. Default is False.
Creates a dialog box showing the result of script s.
- return
true if the properties panel is open. This can be used to skip updates that are not visible to the user.
Splay the selected nodes.
subgraphLocked
True if the node or any in its input tree have an error, or False otherwise.
Frame range for the i’th input of this node.
Width of the node.
Return a tcl list.
- return
X position of node in node graph.
- return
Y position of node in node graph.
-
Class
() → Class of node.¶ - Returns
Class of node.
-
addCallback
(string, Callable) → Add a callback to a specific event¶ Specific callback type can be find in the documentation of the related type or function.
-
addKnob
(k) → None.¶ Add knob k to this node or panel. :param k: Knob. :return: None.
-
allKnobs
() → list¶ Get a list of all knobs in this node, including nameless knobs.
For example:
>>> b = nuke.nodes.Blur() >>> b.allKnobs()
- Returns
List of all knobs.
Note that this doesn’t follow the links for Link_Knobs
-
autoplace
() → None.¶ Automatically place nodes, so they do not overlap. :return: None.
-
bbox
() → List of x, y, w, h.¶ Bounding box of the node. :return: List of x, y, w, h.
-
begin
() → Group.¶ All python code that follows will be executed in the context of node. All names are evaluated relative to this object. Must be paired with end. :return: Group.
-
canSetInput
(i, node) → bool¶ Check whether the output of ‘node’ can be connected to input i. :param i: Input number. :param node: The node to be connected to input i. :return: True if node can be connected, False otherwise.
-
channels
() → String list.¶ List channels output by this node. :return: String list.
-
clearCallbacks
() → Remove all callbacks on the node.¶
-
clearCustomIcon
() → None.¶ Clear the custom icon set for the node. :return: None.
-
clones
() → Number of clones.¶ - Returns
Number of clones.
-
connectInput
(i, node) → bool¶ Connect the output of ‘node’ to the i’th input or the next available unconnected input. The requested input is tried first, but if it is already set then subsequent inputs are tried until an unconnected one is found, as when you drop a connection arrow onto a node in the GUI. :param i: Input number to try first. :param node: The node to connect to input i. :return: True if a connection is made, False otherwise.
-
connectSelectedNodes
(backward, inputA) → None.¶ Connect the selected nodes. :param backward. :param inputA. :return: None.
-
deepSample
(c, x, y, n) → Floating point value.¶ Return pixel values from a deep image. This requires the image to be calculated, so performance may be very bad if this is placed into an expression in a control panel. :param c: Channel name. :param x: Position to sample (X coordinate). :param y: Position to sample (Y coordinate). :param n: Sample index (between 0 and the number returned by deepSampleCount() for this pixel, or -1 for the frontmost). :return: Floating point value.
-
deepSampleCount
(x, y) → Integer value.¶ Return number of samples for a pixel on a deep image. This requires the image to be calculated, so performance may be very bad if this is placed into an expression in a control panel. :param x: Position to sample (X coordinate). :param y: Position to sample (Y coordinate). :return: Integer value.
-
dependencies
(what) → List of nodes.¶ List all nodes referred to by this node. ‘what’ is an optional integer (see below). You can use the following constants or’ed together to select what types of dependencies are looked for:
nuke.EXPRESSIONS = expressions nuke.LINKINPUTS = link knobs nuke.INPUTS = visible input pipes nuke.HIDDEN_INPUTS = hidden input pipes.
The default is to look for all types of connections.
Example: nuke.toNode(‘Blur1’).dependencies( nuke.INPUTS | nuke.EXPRESSIONS ) :param what: Or’ed constant of nuke.EXPRESSIONS, nuke.INPUTS and nuke.HIDDEN_INPUTS to select the types of dependencies. The default is to look for all types of connections. :return: List of nodes.
-
dependent
(what, forceEvaluate) → List of nodes.¶ - List all nodes that read information from this node. ‘what’ is an optional integer:
- You can use any combination of the following constants or’ed together to select what types of dependent nodes to look for:
nuke.EXPRESSIONS = expressions nuke.LINKINPUTS = link knobs nuke.INPUTS = visible input pipes nuke.HIDDEN_INPUTS = hidden input pipes.
The default is to look for all types of connections.
forceEvaluate 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: nuke.toNode(‘Blur1’).dependent( nuke.INPUTS | nuke.EXPRESSIONS ) :param what: Or’ed constant of nuke.EXPRESSIONS, nuke.INPUTS and nuke.HIDDEN_INPUTS to select the types of dependent nodes. The default is to look for all types of connections. :param forceEvaluate: Specifies whether a full tree evaluation will take place. Defaults to True. :return: List of nodes.
-
end
() → None.¶ All python code that follows will no longer be executed in the context of node. Must be paired with begin. :return: None.
-
error
() → bool¶ True if the node or any in its input tree have an error, or False otherwise.
Error state of the node and its input tree. Deprecated; use hasError or treeHasError instead. Note that this will always return false for viewers, which cannot generate their input trees. Instead, choose an input of the viewer (e.g. the active one), and call treeHasError() on that.
-
executePythonCallback
()¶ self.executeCallback(string) -> Executes the callback, if exists related to the specified event.
-
expand
() → None.¶ Moves all nodes from the 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. :return: None.
-
fileDependencies
(start, end) → List of nodes and filenames.¶ - Parameters
start – first frame
end – last frame
Returns the list of input file dependencies for this node and all nodes upstream from this node for the given frame range. The file dependencies are calcuated by searching for Read ops or ops with a File knob. All views are considered and current proxy mode is used to decide on whether full format or proxy files are returned. Note that Write nodes files are also included but precomps, gizmos and external plugins are not. Any time shifting operation such as frameholds, timeblurs, motionblur etc are taken into consideration. :return The return list is a list of nodes and files they require. Eg. [Read1, [‘file1.dpx, file2.dpx’] ], [Read2, [‘file3.dpx’, ‘file4.dpx’] ] ]
-
firstFrame
() → int.¶ First frame in frame range for this node. :return: int.
-
forceUpdateLocalization
() → Force Updates the localized files for this node.¶ - Returns
None
-
forceValidate
() → None¶ Force the node to validate itself, updating its hash.
-
format
() → Format.¶ Format of the node. :return: Format.
-
frameRange
() → FrameRange.¶ Frame range for this node. :return: FrameRange.
-
fullName
() → str¶ Get the name of this node and any groups enclosing it in ‘group.group.name’ form. :return: The fully-qualified name of this node, as a string.
-
getNumKnobs
()¶ self.numKnobs() -> The number of knobs. :return: The number of knobs.
-
hasError
() → bool¶ True if the node itself has an error, regardless of the state of the ops in its input tree, or False otherwise.
Error state of the node itself, regardless of the state of the ops in its input tree. Note that an error on a node may not appear if there is an error somewhere in its input tree, because it may not be possible to validate the node itself correctly in that case.
-
height
() → int.¶ Height of the node. :return: int.
-
help
() → str¶ - Returns
Help for the node.
-
hideControlPanel
() → None¶ - Returns
None
-
input
(i) → The i’th input.¶ - Parameters
i – Input number.
- Returns
The i’th input.
-
inputs
() → Gets the maximum number of connected inputs.¶ - Returns
Number of the highest connected input + 1. If inputs 0, 1, and 3 are connected, this will return 4.
-
isCloneable
() → If the node permits cloning.¶ - Returns
True if the node allows cloning, False otherwise.
-
isLocalizationOutdated
() → Returns if there are changes detected in the source file.¶ - Returns
true if the Localization source file has changed
-
isLocalized
() → returns True/False whether the node is completely localized.¶ - Returns
bool
-
isSelected
() → bool¶ Returns the current selection state of the node. This is the same as checking the ‘selected’ knob. :return: True if selected, or False if not.
-
knob
(p[, follow_link]) → The knob named p or the pth knob.¶ - Parameters
p – A string or an integer.
follow_link – Should it follow links to Link_Knob until resolution. Default is True.
- Returns
The knob named p or the pth knob.
-
knobs
() → dict¶ Get a dictionary of (name, knob) pairs for all knobs in this node.
For example:
>>> b = nuke.nodes.Blur() >>> b.knobs()
- Returns
Dictionary of all knobs.
Note that this doesn’t follow the links for Link_Knobs
-
lastFrame
() → int.¶ Last frame in frame range for this node. :return: int.
-
linkableKnobs
(knobType) → List¶ Returns a list of any knobs that may be linked to from the node as well as some meta information about the knob. This may include whether the knob is enabled and whether it should be used for absolute or relative values. Not all of these variables may make sense for all knobs.. :param knobType A KnobType describing the type of knobs you want.:return: A list of LinkableKnobInfo that may be empty .
-
localizationProgress
() → Checks and reports on progress of localization of the current node.¶ - Returns
float, between 0.0 (not localized) and 1.0 (localized)
-
lock
() → Sets the node to a locked state where knobs cannot be edited.¶
-
locked
() → Returns True if the node is locked, False otherwise.¶
-
maxInputs
()¶ self.maximumInputs() -> Maximum number of inputs this node can have. :return: Maximum number of inputs this node can have.
-
maxOutputs
()¶ self.maximumOutputs() -> Maximum number of outputs this node can have. :return: Maximum number of outputs this node can have.
-
maximumInputs
() → Maximum number of inputs this node can have.¶ - Returns
Maximum number of inputs this node can have.
-
maximumOutputs
() → Maximum number of outputs this node can have.¶ - Returns
Maximum number of outputs this node can have.
-
metadata
(key, time, view) → value or dict¶ Return the metadata item for key on this node at current output context, or at optional time and view. If key is not specified a dictionary containing all key/value pairs is returned. None is returned if key does not exist on this node. :param key: Optional name of the metadata key to retrieve. :param time: Optional time to evaluate at (default is taken from node’s current output context). :param view: Optional view to evaluate at (default is taken from node’s current output context). :return: The requested metadata value, a dictionary containing all keys if a key name is not provided, or None if the specified key is not matched.
-
minInputs
()¶ self.minimumInputs() -> Minimum number of inputs this node can have. :return: Minimum number of inputs this node can have.
-
minimumInputs
() → Minimum number of inputs this node can have.¶ - Returns
Minimum number of inputs this node can have.
-
name
() → str¶ - Returns
Name of node.
-
node
(s) → Node with name s or None.¶ Locate a node by name. :param s: A string. :return: Node with name s or None.
-
nodes
() → List of nodes¶ List of nodes in group. :return: List of nodes
-
numKnobs
() → The number of knobs.¶ - Returns
The number of knobs.
-
numNodes
() → Number of nodes¶ Number of nodes in group. :return: Number of nodes
-
opHashes
() → list of int¶ Returns a list of hash values, one for each op in this node.
-
optionalInput
() → Number of first optional input.¶ - Returns
Number of first optional input.
-
output
() → Node or None.¶ Return output node of group. :return: Node or None.
-
parent
() → Return the parent group node for this node.¶
-
performanceInfo
(category) → Returns performance information for this node. Performance timing must be enabled.¶ @category: performance category ( optional ).A performance category, must be either nuke.PROFILE_STORE, nuke.PROFILE_VALIDATE, nuke.PROFILE_REQUEST or nuke.PROFILE_ENGINE The default is nuke.PROFILE_ENGINE which gives the performance info of the render engine. :return: A dictionary containing the cumulative performance info for this category, where: callCount = the number of calls made timeTakenCPU = the CPU time spent in microseconds timeTakenWall = the actual time ( wall time ) spent in microseconds
-
pixelAspect
() → int.¶ Pixel Aspect ratio of the node. :return: float.
-
proxy
() → bool¶ - Returns
True if proxy is enabled, False otherwise.
-
readKnobs
(s) → None.¶ Read the knobs from a string (TCL syntax). :param s: A string. :return: None.
-
redraw
() → None.¶ Force a redraw of the node. :return: None.
-
reload
() → None¶ Precomp Node reload() :return: None
-
removeCallback
(string) → Remove a callback to a specific event identified as a string.¶
-
removeKnob
(k) → None.¶ Remove knob k from this node or panel. Throws a ValueError exception if k is not found on the node. :param k: Knob. :return: None.
-
resetKnobsToDefault
() → None¶ Reset all the knobs to their default values.
-
rootNode
() → Returns this node’s root node. This may differ from nuke.root() for example if the read node was created importing footage to the timeline.¶
-
run
(callable) → Result of callable.¶ Execute in the context of node. All names are evaluated relative to this object. :param callable: callable to execute. :return: Result of callable.
-
running
() → Node rendering when paralled threads are running or None.¶ Class method. :return: Node rendering when paralled threads are running or None.
-
sample
(c, x, y, dx, dy) → Floating point value.¶ Return pixel values from an image. 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’. :param c: Channel name. :param x: Centre of the area to sample (X coordinate). :param y: Centre of the area to sample (Y coordinate). :param dx: Optional size of the area to sample (X coordinate). :param dy: Optional size of the area to sample (Y coordinate). :param frame: Optional frame to sample the node at. :return: Floating point value.
-
screenHeight
() → int.¶ Height of the node when displayed on screen in the DAG, at 1:1 zoom, in pixels. :return: int.
-
screenWidth
() → int.¶ Width of the node when displayed on screen in the DAG, at 1:1 zoom, in pixels. :return: int.
-
selectOnly
() → None.¶ Set this node to be the only selection, as if it had been clicked in the DAG. :return: None.
-
selectedNode
() → Node or None.¶ Returns the node the user is most likely thinking about. This is the last node the user clicked on, if it is selected. Otherwise it is an ‘output’ (one with no selected outputs) of the set of selected nodes. If no nodes are selected then None is returned. :return: Node or None.
-
selectedNodes
() → Node or None.¶ Selected nodes. :return: Node or None.
-
setCustomIcon
(image, scale, offsetX, offsetY) → bool.¶ Set a custom icon for the node. :param image: filepath to image to be used as an icon. :param scale: Optional. scale factor for the icon. :param offsetX: Optional. offset the icon in the x axis from the top left corner of the node. :param offsetY: Optional. offset the icon in the y axis from the top left corner of the node. :return: True if icon has been set, else false.
-
setInput
(i, node) → bool¶ Connect input i to node if canSetInput() returns true. :param i: Input number. :param node: The node to connect to input i. :return: True if canSetInput() returns true, or if the input is already correct.
-
setName
(name, uncollide=True, updateExpressions=False) → None¶ Set name of the node and resolve name collisions if optional named argument ‘uncollide’ is True. :param name: A string. :param uncollide: Optional boolean to resolve name collisions. Defaults to True. :param updateExpressions: Optional boolean to update expressions in other nodes to point at the new name. Defaults to False. :return: None
-
setSelected
(selected) → None.¶ Set the selection state of the node. This is the same as changing the ‘selected’ knob. :param selected: New selection state - True or False. :return: None.
-
setTab
(tabIndex) → None¶ - Parameters
tabIndex – The tab to show (first is 0).
- Returns
None
-
setXYpos
(x, y) → None.¶ Set the (x, y) position of node in node graph. :param x: The x position of node in node graph. :param y: The y position of node in node graph. :return: None.
-
setXpos
(x) → None.¶ Set the x position of node in node graph. :param x: The x position of node in node graph. :return: None.
-
setYpos
(y) → None.¶ Set the y position of node in node graph. :param y: The y position of node in node graph. :return: None.
-
showControlPanel
(forceFloat=false) → None¶ - Parameters
forceFloat – Optional python object. If it evaluates to True the control panel will always open as a floating panel. Default is False.
- Returns
None
-
showInfo
(s) → None.¶ Creates a dialog box showing the result of script s. :param s: A string. :return: None.
-
shown
() → true if the properties panel is open. This can be used to skip updates that are not visible to the user.¶ - Returns
true if the properties panel is open. This can be used to skip updates that are not visible to the user.
-
splaySelectedNodes
(backward, inputA) → None.¶ Splay the selected nodes. :param backward. :param inputA. :return: None.
-
treeHasError
() → bool¶ True if the node or any in its input tree have an error, or False otherwise.
Error state of the node and its input tree. Note that this will always return false for viewers, which cannot generate their input trees. Instead, choose an input of the viewer (e.g. the active one), and call treeHasError() on that.
-
unlock
() → Unlocks the node and makes knobs editable.¶
-
upstreamFrameRange
(i) → FrameRange¶ Frame range for the i’th input of this node. :param i: Input number. :return: FrameRange. Returns None when querying an invalid input.
-
width
() → int.¶ Width of the node. :return: int.
-
writeKnobs
(i) → String in .nk form.¶ Return a tcl list. If TO_SCRIPT | TO_VALUE is not on, this is a simple list of knob names. If it is on, it is an alternating list of knob names and the output of to_script().
Flags can be any of these or’d together: - nuke.TO_SCRIPT produces to_script(0) values - nuke.TO_VALUE produces to_script(context) values - nuke.WRITE_NON_DEFAULT_ONLY skips knobs with not_default() false - nuke.WRITE_USER_KNOB_DEFS writes addUserKnob commands for user knobs - nuke.WRITE_ALL writes normally invisible knobs like name, xpos, ypos
- Parameters
i – The set of flags or’d together. Default is TO_SCRIPT | TO_VALUE.
- Returns
String in .nk form.
-
xpos
() → X position of node in node graph.¶ - Returns
X position of node in node graph.
-
ypos
() → Y position of node in node graph.¶ - Returns
Y position of node in node graph.