nuke.curveknob.CurveKnob

class nuke.curveknob.CurveKnob

Bases: Knob

The knob which holds the tree of paint elements (Layers, Shapes and Strokes).

Most operations are performed on the tree itself, or its elements, rather than through the knob. You can get the root of the tree through the knob’s rootLayer property, or you can get straight to a specific element using the toElement() method.

A common usage scenario is as follows:

>>> knob = nuke.toNode('RotoPaint1')['curves']
>>> root = knob.rootLayer
>>> # perform operations on the root layer.

Creating any new shapes, strokes or layers will require you to pass in a reference to the knob, so it’s worth storing the reference in a variable.

Methods

Class

return:

Class name.

changed

Call this after performing updates on the tree, to tell it that it's been updated.

clearAnimated

Clear animation for channel 'c'.

clearFlag

Clear flag.

critical

param message:

message to put the knob in error, and do a popup.

debug

param message:

message to put out to the error console, attached to the knob, if the verbosity level is set high enough.

enabled

return:

True if the knob is enabled, False if it's disabled.

error

param message:

message to put the knob in error.

fromScript

Initialise from script.

fullyQualifiedName

Returns the fully-qualified name of the knob within the node.

getDerivative

Return derivative at time 't' for channel 'c'.

getFlag

Returns whether the input flag is set.

getIntegral

Return integral at the interval [t1, t2] for channel 'c'.

getKeyIndex

Return keyframe index at time 't' for channel 'c'.

getKeyList

Get all unique keys on the knob.

getKeyTime

Return index of the keyframe at time 't' for channel 'c'.

getNthDerivative

Return nth derivative at time 't' for channel 'c'.

getNumKeys

Return number of keyframes for channel 'c'.

getSelected

Returns list of all selected items in a curve knob As an example, say you have a Bezier curve selected,the following will return 'Bezier1' >>> curveKnob = nuke.toNode('RotoPaint1)['curves'] >>> selected = curveKnob.getSelected() >>> selected[0].name

getValue

Return value at the current frame for channel 'c'.

getValueAt

Return value at time 't' for channel 'c'.

hasExpression

Return True if animation at index 'index' has an expression.

isAnimated

Return True if channel 'c' is animated.

isKey

Return True if there is a keyframe at the current frame for channel 'c'.

isKeyAt

Return True if there is a keyframe at time 't' for channel 'c'.

label

return:

label.

name

return:

name.

node

Return the node that this knob belongs to.

removeKey

Remove key for channel 'c'.

removeKeyAt

Remove key at time 't' for channel 'c'.

setAnimated

Set channel 'c' to be animated.

setEnabled

Enable or disable the knob.

setExpression

Set the expression for a knob.

setFlag

Logical OR of the argument and existing knob flags.

setLabel

param s:

New label.

setName

param s:

New name.

setTooltip

param s:

New tooltip.

setValue

Sets the value 'val' at channel 'chan'.

setValueAt

Sets the value 'val' at channel 'chan' for time 'time'.

setVisible

Show or hide the knob.

toElement

Takes a path which identifies a particular element in the curve tree and returns the corresponding Layer, Stroke or Shape object.

toScript

Return the value of the knob in script syntax.

tooltip

return:

tooltip.

value

Return value at the current frame for channel 'c'.

visible

return:

True if the knob is visible, False if it's hidden.

warning

param message:

message to put a warning on the knob.

Attributes

curveWidget

Curve Widget

rootLayer

The root layer.

Class() Class name.
Returns:

Class name.

changed() None

Call this after performing updates on the tree, to tell it that it’s been updated. For many operations this is called automatically, but you can call it manually for those cases where it isn’t.

clearAnimated()

Clear animation for channel ‘c’. Return True if successful.

clearFlag(f) None.

Clear flag. :param f: Flag. :return: None.

critical(message) None.
Parameters:

message – message to put the knob in error, and do a popup.

Returns:

None.

curveWidget

Curve Widget

debug(message) None.
Parameters:

message – message to put out to the error console, attached to the knob, if the verbosity level is set high enough.

Returns:

None.

enabled() Boolean.
Returns:

True if the knob is enabled, False if it’s disabled.

error(message) None.
Parameters:

message – message to put the knob in error.

Returns:

None.

fromScript()

Initialise from script.

fullyQualifiedName(channel=- 1) string

Returns the fully-qualified name of the knob within the node. This can be useful for expression linking.

Parameters:

channel – Optional parameter, specifies the channel number of the sub-knob (for example, channels of 0 and 1 would refer to the x and y of a XY_Knob respectively), leave blank or set to -1 to get the qualified name of the knob only.

Returns:

The string of the qualified knob or sub-knob, which can be used directly in expression links.

getDerivative()

Return derivative at time ‘t’ for channel ‘c’.

getFlag(f) Bool.

Returns whether the input flag is set. :param f: Flag. :return: True if set, False otherwise.

getIntegral()

Return integral at the interval [t1, t2] for channel ‘c’.

getKeyIndex()

Return keyframe index at time ‘t’ for channel ‘c’.

getKeyList()

Get all unique keys on the knob. Returns list.

getKeyTime()

Return index of the keyframe at time ‘t’ for channel ‘c’.

getNthDerivative()

Return nth derivative at time ‘t’ for channel ‘c’.

getNumKeys()

Return number of keyframes for channel ‘c’.

getSelected() [selectedObjects]

Returns list of all selected items in a curve knob As an example, say you have a Bezier curve selected,the following will return ‘Bezier1’ >>> curveKnob = nuke.toNode(‘RotoPaint1)[‘curves’] >>> selected = curveKnob.getSelected() >>> selected[0].name

getValue()

Return value at the current frame for channel ‘c’.

getValueAt()

Return value at time ‘t’ for channel ‘c’.

hasExpression(index=- 1) bool

Return True if animation at index ‘index’ has an expression. :param index: Optional index parameter. Defaults to -1 if not specified. This can be specified as a keyword parameter if desired. :return: True if has expression, False otherwise.

isAnimated()

Return True if channel ‘c’ is animated.

isKey()

Return True if there is a keyframe at the current frame for channel ‘c’.

isKeyAt()

Return True if there is a keyframe at time ‘t’ for channel ‘c’.

label() label.
Returns:

label.

name() name.
Returns:

name.

node() nuke.Node

Return the node that this knob belongs to. If the node has been cloned, we’ll always return a reference to the original. :return: The node which owns this knob, or None if the knob has no owner yet.

removeKey()

Remove key for channel ‘c’. Return True if successful.

removeKeyAt()

Remove key at time ‘t’ for channel ‘c’. Return True if successful.

rootLayer

The root layer.

setAnimated()

Set channel ‘c’ to be animated.

setEnabled(enabled) None.

Enable or disable the knob. :param enabled: True to enable the knob, False to disable it.

setExpression(expression, channel=- 1, view=None) bool

Set the expression for a knob. You can optionally specify a channel to set the expression for.

Parameters:
  • expression – The new expression for the knob. This should be a string.

  • channel – Optional parameter, specifying the channel to set the expression for. This should be an integer.

  • view – Optional view parameter. Without, this command will set the expression for the current view theinterface is displaying. Can be the name of the view or the index.

Returns:

True if successful, False if not.

setFlag(f) None.

Logical OR of the argument and existing knob flags. :param f: Flag. :return: None.

setLabel(s) None.
Parameters:

s – New label.

Returns:

None.

setName(s) None.
Parameters:

s – New name.

Returns:

None.

setTooltip(s) None.
Parameters:

s – New tooltip.

Returns:

None.

setValue(val, chan) bool

Sets the value ‘val’ at channel ‘chan’. :return: True if successful, False if not.

setValueAt(val, time, chan) bool

Sets the value ‘val’ at channel ‘chan’ for time ‘time’. :return: True if successful, False if not.

setVisible(visible) None.

Show or hide the knob. :param visible: True to show the knob, False to hide it.

toElement(path) Element

Takes a path which identifies a particular element in the curve tree and returns the corresponding Layer, Stroke or Shape object. The path is a slash separated string and is always resolved relative to the root layer. So if, for example, you have a RotoPaint node with a layer called ‘Layer1’ which contains a shape called ‘Shape1’, the path to the shape would be ‘Layer1/Shape1’. >>> knob = nuke.toNode(‘RotoPaint1)[‘curves’] >>> shape = knob.toElement(‘Layer1/Shape1’) >>> shape.name ‘Shape1’

toScript(quote, context=current) string.

Return the value of the knob in script syntax. Pass True for quote to return results quoted in {}. Pass None for context to get results for all views and key times (as stored in a .nk file).

tooltip() tooltip.
Returns:

tooltip.

value()

Return value at the current frame for channel ‘c’.

visible() Boolean.
Returns:

True if the knob is visible, False if it’s hidden.

warning(message) None.
Parameters:

message – message to put a warning on the knob.

Returns:

None.