The following is a list of functions that can be used in tcl Nuke expressions. More...

The following is a list of functions that can be used in tcl Nuke expressions.

Nuke's expression language is a subpart of a tcl expression. This is a list of all functions available in expressions.

It is easily possible to access the values of knobs in the same node by simply providing their name, possibly followed by an index name (e.g. saturation.g returns the green component of a slider named 'saturation' in the same node).

A knob name can be prepended with a Node name to reference a different Node. Parent nodes can be referenced through the keyword 'parent', and the root node via 'root' (e.g. parent.CCorrect2.contrst.r).

true | ( |

Always returns 1

**See also:**- false

false | ( |

Always returns 0

**See also:**- true

pi | ( |

returns the value for *pi* (3.141592654...). Both "PI" and "pi" work.

asin | ( | x |

acos | ( | x |

atan | ( | x |

sinh | ( | x |

cosh | ( | x |

tanh | ( | x |

exp | ( | x |

atan2 | ( | x | , |

y | |||

hypot | ( | x | , |

y | |||

returns the *sqrt(x*x + y*y)*. This is the length of the hypotenuse of a right-angle triangle with sides of length *x* and *y*.

**See also:**- atan2

fmod | ( | x | , |

y | |||

abs | ( | x |

returns the absolute value of the floating-point number *x*.

**See also:**- fabs

fabs | ( | x |

returns the absolute value of the floating-point number *x*.

**See also:**- abs

trunc | ( | x |

int | ( | x |

equal | ( | a | , |

test1 | , | ||

test2 | , | ||

... |
|||

Return true if *a* equals any of the other arguments

**See also:**- inrange

inrange | ( | a | , |

first | , | ||

last | , | ||

... |
|||

Return true if *a* is between first and last, inclusive. You can give more than one range by adding more pairs of arguments.

**See also:**- equal

pow2 | ( | x |

returns the value of x raised to the power of 2.

**See also:**- pow

to_sRGB | ( | x |

Convert using the default 8-bit LUT defined in the root node, then multiplies by 255. Thus this will convert an internal value to the 8-bit number that would normally be written to a file. (this used to be hard-coded to the sRGB standard, thus the name of this function)

toSRGB | ( | x |

Convert using the default 8-bit LUT defined in the root node. Thus this will convert an internal value to the unclamped normalised number that would normally be written to a file. (this used to be hard-coded to the sRGB standard, thus the name of this function)

from_sRGB | ( | byte |

Does the inverse of to_sRGB.

**See also:**- toSRGB, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

fromSRGB | ( | x |

Inverse of toSRGB.

**See also:**- toSRGB, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

to_Cineon | ( | x |

Converts using the default log conversion defined in the root node, then scales to the 0-1023 range. Thus this will convert an internal value to the number that would be written to a Cineon or dpx file. By default 0 turns into 95 (the black point), 1 turns into 685 (the white point). The number 13.5217 turns into the highest legal Cineon number of 1023. The number -.00565 turns into 0, and -.011 turns into -infinity.

**See also:**- fromCineon, to_byte, and to<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. toCineon.

toCineon | ( | x |

Converts using the default log conversion defined in the root node. Thus this will convert an internal value to the unclamped normalised number that would be written to a Cineon or dpx file.

**See also:**- fromCineon, to_byte, and to<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. toCineon.

from_Cineon | ( | x |

Inverse of to_Cineon.

**See also:**- toCineon, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

fromCineon | ( | x |

Inverse of toCineon.

**See also:**- toCineon, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

toRec709 | ( | x |

Converts using the Rec709 log conversion defined in the root node. Thus this will convert an internal value to the unclamped normalised number that would be written to a Rec709 file.

**See also:**- fromRec709, to_byte, and to<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. toCineon.

fromRec709 | ( | x |

Inverse of toRec709.

**See also:**- toRec709, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

toViperLog | ( | x |

Converts using the Viper log conversion defined in the root node. Thus this will convert an internal value to the unclamped normalised number that would be written to a Viper file.

**See also:**- fromViperLog, to_byte, and to<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. toCineon.

fromViperLog | ( | x |

Inverse of toViperLog.

**See also:**- toViperLog, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

toPanalog | ( | x |

Converts using the Panalog log conversion defined in the root node. Thus this will convert an internal value to the unclamped normalised number that would be written to a Panalog file.

**See also:**- fromPanalog, to_byte, and to<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. toCineon.

fromPanalog | ( | x |

Inverse of toPanalog.

**See also:**- toPanalog, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

toREDLog | ( | x |

Converts using the RED log conversion defined in the root node. Thus this will convert an internal value to the unclamped normalised number that would be written to a RED file.

**See also:**- fromREDLog, to_byte, and to<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. toCineon.

fromREDLog | ( | x |

Inverse of toREDLog.

**See also:**- toREDLog, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

toAlexaV3LogC | ( | x |

Converts using the Alexa V3 logC conversion defined in the root node.

**See also:**- fromAlexaV3LogC, to_byte, and to<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. toCineon.

fromAlexaV3LogC | ( | x |

Inverse of toAlexaV3LogC.

**See also:**- toAlexaV3LogC, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

toPLogLin | ( | x |

Converts using the PLogLin conversion defined in the root node.

**See also:**- fromPLogLin, to_byte, and to<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. toCineon.

fromPLogLin | ( | x |

Inverse of toPLogLin.

**See also:**- toPLogLin, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

toSLog | ( | x |

fromSLog | ( | x |

Inverse of toSLog. This one is wrong! It is deprecated. Use fromSLog1 instead.

**See also:**- toSLog1, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

toSLog1 | ( | x |

fromSLog1 | ( | x |

Inverse of toSLog1.

**See also:**- toSLog1, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

toSLog2 | ( | x |

fromSLog2 | ( | x |

Inverse of toSLog2.

**See also:**- toSLog1, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

toSLog3 | ( | x |

fromSLog3 | ( | x |

Inverse of toSLog3.

**See also:**

toCLog | ( | x |

fromCLog | ( | x |

Inverse of toCLog.

**See also:**- toCLog, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

toProtune | ( | x |

Converts using the GoPro Protune conversion defined in the root node.

**See also:**- fromProtune, to_byte, and to<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. toCineon.

fromProtune | ( | x |

Inverse of toProtune.

**See also:**- toProtune, from_byte, and from<colorspace> where <colorspace> can be replaced by any of the options found on the root node, e.g. fromCineon.

to_byte | ( | x |

Convert using the default screen conversion defined in the root node, then multiplies by 255. Thus this will convert an internal value to the 8-bit number that would be put into the screen buffer or texture map. By default this is the same as to_sRGB.

**See also:**- from_byte, toSRGB, toRec709, toCineon, toViperLog, toPanalog, toREDLog, toAlexaV3LogC, toPLogLin, toSLog1

from_byte | ( | byte |

Does the inverse of to_byte.

isfinite | ( | x |

x is not NAN, not infinity, and not zero.

isnormal | ( | x |

isfinite(x) and x is large enough to be a normalized double. This returns false for zero and very small values such as 1e-320.

isnan | ( | x |

Return true (1) if x is a NAN.

isinf | ( | x |

Return true (1) if x is positive or negative infinity. Note that NAN returns false.

signbit | ( | x |

Return true (1) if x has it's sign bit set, including -0 and -NAN, which is a different result than x<0.

copysign | ( | x | , |

y | |||

If signbit(y) return -abs(x), else return +abs(x).

noise | ( | x | , |

y | , | ||

z | |||

creates a 3D noise value.

This produces a signed range centered on zero. The absolute maximum range is from -1.0 to 1.0. This produces zero at all integers, so you should rotate the coordinates somewhat (add a fraction of y and z to x, etc) if you want to use this for random number generation. The y and z arguments are optional, if missing they are zero.

**See also:**- random, fBm, turbulence

random | ( | x | , |

y | , | ||

z | |||

creates a pseudo random value between 0 and 1. It will always generate the same value for the same *x*, *y* and *z*. Calling *random* wth no arguments will create a different value on every invocation. The y and z arguments are optional, if missing they are zero.

**See also:**- noise, fBm, turbulence

fBm | ( | x | , |

y | , | ||

z | , | ||

octaves | , | ||

lucanarity | , | ||

gain | |||

Fractional Brownian Motion. This is the sum of *octaves* calls to noise. For each of them the noise xyz point is multiplied by pow(lucanarity,i) and the noise output is multiplied by pow(gain,i). For normal use lucanarity should be greater than 1 and gain should be less than 1.

**See also:**- noise, random, turbulence

turbulence | ( | x | , |

y | , | ||

z | , | ||

octaves | , | ||

lucanarity | , | ||

gain | |||

mantissa | ( | x |

ldexp | ( | x |

returns the result of multiplying the floating-point number *x* by 2 raised to the power *exp*.

**See also:**- exponent

degrees | ( | x |

convert the angle *x* from radians into degrees

**See also:**- radians

radians | ( | x |

convert the angle *x* from degrees into radians

**See also:**- degrees

step | ( | a | , |

x | |||

returns 0 if *x* is less than *a*, returns 1 otherwise. Matches the *step* function other shading languages.

**See also:**- smoothstep, lerp

smoothstep | ( | a | , |

b | , | ||

x | |||

lerp | ( | a | , |

b | , | ||

x | |||

Returns a if x==0, returns b if x==1, and returns a value between a and b if x is between 0 and 1. Actual return value is a+(b-a)*x. Matches the *lerp* function in other shading languages.

**See also:**- step, smoothstep

mix | ( | a | , |

b | , | ||

x | |||

same as *lerp*

**See also:**- step, smoothstep, lerp

lerp | ( | x0 | , |

y0 | , | ||

x1 | , | ||

y1 | , | ||

x | |||

Return the y value of the point on the straight line between x0,y0 and x1,y1 that has the given x value. This is y0+(y1-y0)*(x-x0)/(x1-x0).

curve | ( | frame |

value | ( | frame |

y | ( | frame |

frame | ( |

first_frame | ( |

First frame in frame range for this node. Prefix with "nodename." to get it for other nodes.

format | ( |

The full-size format output by this node. You must follow this with:

- .width for the width in pixels
- .height for the height in pixels
- .x for the left edge of the image bounding box (usually 0)
- .y for the bottom edge of the image bounding box (usually 0)
- .r for the right edge of the image bounding box (usually width)
- .t for the top edge of the image bounding box (usually height)
- .w which is the same as format.r-format.x
- .h which is the same as #format.t-format.y
- .pixel_aspect for horizontal_pixel_size/vertical_pixel_size

Prefix with "nodename." to get it for other nodes.

actual_format | ( |

The actual format output by this node. This is the full-size format scaled to the nearest integers to match the current proxy scaling, and is the actual size and format of any image file output by this node.

- .width for the width in pixels
- .height for the height in pixels
- .x for the left edge of the image bounding box (usually 0)
- .y for the bottom edge of the image bounding box (usually 0)
- .r for the right edge of the image bounding box (usually width)
- .t for the top edge of the image bounding box (usually height)
- .w which is the same as format.r-format.x
- .h which is the same as format.t-format.y
- .pixel_aspect for horizontal_pixel_size/vertical_pixel_size

Prefix with "nodename." to get it for other nodes.

height | ( |

Same as format.height

inputs | ( |

Number of inputs for this node. Prefix with "nodename." to get it for other nodes.

last_frame | ( |

Last frame in frame range for this node. Prefix with "nodename." to get it for other nodes.

pixel_aspect | ( |

Same as format.pixel_aspect

width | ( |

Current shutter setting for this node. Prefix with "nodename." to get it for other nodes.

Same as format.width

error | ( |

Returns 1 if trying to use the node would produce an error. Prefix with "nodename." to get it for other nodes. The error may be on it or on one of it's inputs. Use the error_node and error_message tcl commands to retrieve more information about the error.

clones | ( |

Returns the number of clones the node has. If there are two nodes that are clones of each other, they both return 1. Normal nodes return zero. Prefix with "nodename." to get it for other nodes.

animated | ( |

True if the value changes over time.

- Prefix with "nodename." to get it for any knob on a node.
- Prefix with "knobname." to get it for only a single knob
- Prefix with "knob.field." to get it for only one field of a knob.

keys | ( |

Returns the number of keyframes set in the animation, or zero if it is not animated or there is only an expression. For nodes or multi-field knobs this returns the first number of keys that is not zero.

- Prefix with "nodename." to get it for any knob on a node.
- Prefix with "knobname." to get it for only a single knob
- Prefix with "knob.field." to get it for only one field of a knob.

has_expression | ( |

Returns true if there is an expression (other than just "curve").

- Prefix with "nodename." to get it for any knob on a node.
- Prefix with "knobname." to get it for only a single knob
- Prefix with "knob.field." to get it for only one field of a knob.

derivative | ( |

Return the first derivative at the current frame.

- Prefix with "knobname." to get it for the first field of a knob
- Prefix with "knob.field." to get it for a different knob or field

derivative | ( | frame |

Return the first derivative at the given frame.

- Prefix with "knobname." to get it for the first field of a knob
- Prefix with "knob.field." to get it for a different knob or field

derivative | ( | n | , |

frame | |||

Return the n'th derivative at the given frame. If n is less than 1 this returns value.

- Prefix with "knobname." to get it for the first field of a knob
- Prefix with "knob.field." to get it for a different knob or field

integrate | ( | a | , |

b | |||

Returns the numerical integral between time a and b.

- Prefix with "knobname." to get it for the first field of a knob
- Prefix with "knob.field." to get it for a different knob or field

inverse | ( | y |

Returns the value of x such that knob(x)==y. This is designed to invert color lookup tables, and currently only works if the knob has a positive derivative everywhere. y is optional, if missing the current frame is used.

- Prefix with "knobname." to get it for the first field of a knob
- Prefix with "knob.field." to get it for a different knob or field