nuke.SceneView_Knob

class nuke.SceneView_Knob

Bases: Unsigned_Knob

Displays a list of items as a hierarchy. The hierarchy is specified using back or forward slashes within the item names to specify their level in the tree. Handles multiple selection of items within the tree.

Methods

Class

return

Class name.

addItems

Adds a list of string items to the knob.

animation

Return the AnimationCurve for the channel 'chan' and view 'view'.

animations

param view

Optional view.

array

return

List of knob values.

arraySize

return

Number of elements in array.

clearAnimated

Delete animation.

clearFlag

Clear flag.

copyAnimation

Copies the i'th channel of the AnimationCurve curve to this object.

copyAnimations

Copies the AnimationCurves from curves to this object.

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.

defaultValue

return

Default value.

deleteAnimation

Deletes the AnimationCurve.

dimensions

return

Dimensions in array.

enabled

return

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

error

param message

message to put the knob in error.

frame

return

Frame number.

fromScript

Set value of the knob to a user defined script (TCL syntax, as in .nk file).

fullyQualifiedName

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

getAllItems

Returns a list of strings containing all items that the knob can import.

getAuthorMode

Returns the authoring mode currently set on the knob.

getAuthorModes

Returns the names of the authoring modes of the knob if the knob is an authoring knob, otherwise an empty list.

getDerivative

Return derivative at time 't' and index 'i'.

getFlag

Returns whether the input flag is set.

getHighlightedItem

Returns a string containing the item which is currently highlighted.

getImportedItems

Returns a list of strings containing all items imported into the knob.

getIntegral

Return integral at time interval [t1, t2] and index 'i'.

getKeyIndex

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

getKeyList

Get all unique keys on the knob.

getKeyTime

Return time of the keyframe at time 't' and channel 'c'.

getNthDerivative

Return n'th derivative at time 't' and index 'i'.

getNumKeys

Return number of keys at channel 'c'.

getSelectedItems

Returns a list of strings containing all currently selected items in the knob.

getValue

self.value(index, view, time) -> Floating point or List of floating point values (in case some are different).

getValueAt

self.valueAt(time, index, view) -> Floating point or List of floating point values (in case some are different).

hasExpression

param index

Optional index.

height

return

Height of array of values.

isAnimated

param index

Optional index.

isKey

param index

Optional index.

isKeyAt

Returns True if there is a keyframe at specified time, optional index and view, otherwise returns False.

label

return

label.

max

return

Maximum value.

maximum

self.max() -> Maximum value.

min

return

Minimum value.

minimum

self.min() -> Minimum value.

name

return

name.

node

Return the node that this knob belongs to.

notDefault

return

True if any of the values is not set to the default, False otherwise.

removeItems

Removes a list of string items from the knob.

removeKey

Remove key.

removeKeyAt

Remove keyframe at specified time, optional index and view.

resize

Resize the array.

setAllItems

Sets a list of strings containing all items that the knob can import.

setAnimated

Create an Animation object.

setAuthorMode

Sets the authoring mode on the knob.

setDefaultValue

param s

Sequence of floating-point values.

setEnabled

Enable or disable the knob.

setExpression

Set the expression for a knob.

setFlag

Logical OR of the argument and existing knob flags.

setImportedItems

Sets a list of strings containing all items imported into the knob.

setKeyAt

Set a key on element 'index', at time and view.

setLabel

param s

New label.

setName

param s

New name.

setRange

Set range of values.

setSelectedItems

Takes a list of strings of items contained in the knob and sets them as selected.

setSingleValue

Set to just hold a single value or not.

setTooltip

param s

New tooltip.

setValue

Set the unsigned integer value of this knob.

setValueAt

Set value of element 'index' at time for view.

setVisible

Show or hide the knob.

singleValue

param view

Optional view. Default is current view.

splitView

Split the view away from the current knob value.

toScript

Return the value of the knob in script syntax.

tooltip

return

tooltip.

unsplitView

Unsplit the view so that it shares a value with other views.

value

Get the value of this knob as an integer.

valueAt

Return value for this knob at specified time, optional index and view.

vect

return

List of knob values.

visible

return

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

warning

param message

message to put a warning on the knob.

width

return

Width of array of values.

Class() Class name.
Returns

Class name.

addItems() None

Adds a list of string items to the knob. New items are automatically set as imported and selected.

animation(chan, view) AnimationCurve or None.

Return the AnimationCurve for the channel ‘chan’ and view ‘view’. The view argument is optional. :param channel: The channel index. :param view: Optional view. :return: AnimationCurve or None.

animations(view) AnimationCurve list.
Parameters

view – Optional view.

Returns

AnimationCurve list.

Example: b = nuke.nodes.Blur() k = b[‘size’] k.setAnimated(0) a = k.animations() a[0].setKey(0, 11) a[0].setKey(10, 20)

array() List of knob values.
Returns

List of knob values.

Should only be used for knobs that are neither animated nor get their values from a ValueProvider. For knobs like that, use Array_Knob.getValue, instead

arraySize() Number of elements in array.
Returns

Number of elements in array.

clearAnimated(index, view) True if succeeded, False otherwise.

Delete animation. :param index: Optional index. :param view: Optional view. :return: True if succeeded, False otherwise.

clearFlag(f) None.

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

copyAnimation(channel, curve, view) None.

Copies the i’th channel of the AnimationCurve curve to this object. The view is optional and defaults to the current view. :param channel: The channel index. :param curve: AnimationCurve. :param view: Optional view. Defaults to current. :return: None.

copyAnimations(curves, view) None.

Copies the AnimationCurves from curves to this object. The view is optional and defaults to the current view. :param curves: AnimationCurve list. :param view: Optional view. Defaults to current. :return: None.

critical(message) None.
Parameters

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

Returns

None.

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.

defaultValue() Default value.
Returns

Default value.

deleteAnimation(curve) None. Raises ValueError if not found.

Deletes the AnimationCurve. :param curve: An AnimationCurve instance which belongs to this Knob. :return: None. Raises ValueError if not found.

dimensions() Dimensions in array.
Returns

Dimensions in array.

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.

frame() Frame number.
Returns

Frame number.

fromScript(s) True if successful, False otherwise.

Set value of the knob to a user defined script (TCL syntax, as in .nk file). Return True if successful. :param s: Nuke script to be set on knob. :return: True if successful, False otherwise.

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.

getAllItems() list

Returns a list of strings containing all items that the knob can import.

getAuthorMode() Integer.

Returns the authoring mode currently set on the knob. This is a unique string identifier of the option, which is also used for serialisation and deserialisation. It is not meant to change,thus one can rely on it. :return: The string identifier of the current authoring mode set.

getAuthorModes() List.

Returns the names of the authoring modes of the knob if the knob is an authoring knob, otherwise an empty list. :return: The names of the authoring modes of the knob if the knob is an authoring knob, otherwise an empty list. This is a list of strings.

getDerivative()

Return derivative at time ‘t’ and index ‘i’.

getFlag(f) Bool.

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

getHighlightedItem() string

Returns a string containing the item which is currently highlighted.

getImportedItems() list

Returns a list of strings containing all items imported into the knob.

getIntegral()

Return integral at time interval [t1, t2] and index ‘i’.

getKeyIndex()

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

getKeyList()

Get all unique keys on the knob. Returns list.

getKeyTime()

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

getNthDerivative()

Return n’th derivative at time ‘t’ and index ‘i’.

getNumKeys()

Return number of keys at channel ‘c’.

getSelectedItems() list

Returns a list of strings containing all currently selected items in the knob.

getValue()

self.value(index, view, time) -> Floating point or List of floating point values (in case some are different). :param index: Optional index. Default is 0. :param view: Optional view. :param time: Optional time. :return: Floating point or List of floating point values (in case some are different).

getValueAt()

self.valueAt(time, index, view) -> Floating point or List of floating point values (in case some are different). Return value for this knob at specified time, optional index and view. :param time: Time. :param index: Optional index. Default is 0. :param view: Optional view. :return: Floating point or List of floating point values (in case some are different).

hasExpression(index) True if has expression, False otherwise.
Parameters

index – Optional index.

Returns

True if has expression, False otherwise.

height() Height of array of values.
Returns

Height of array of values.

isAnimated(index, view) True if animated, False otherwise.
Parameters
  • index – Optional index.

  • view – Optional view.

Returns

True if animated, False otherwise.

isKey(index, view) True if succeeded, False otherwise.
Parameters
  • index – Optional index.

  • view – Optional view.

Returns

True if succeeded, False otherwise.

isKeyAt(time, index, view) True if succeeded, False otherwise.

Returns True if there is a keyframe at specified time, optional index and view, otherwise returns False. :param time: Time. :param index: Optional index. :param view: Optional view. :return: True if succeeded, False otherwise.

label() label.
Returns

label.

max() Maximum value.
Returns

Maximum value.

maximum()

self.max() -> Maximum value. :return: Maximum value.

min() Minimum value.
Returns

Minimum value.

minimum()

self.min() -> Minimum value. :return: Minimum value.

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.

notDefault() True if any of the values is not set to the default, False otherwise.
Returns

True if any of the values is not set to the default, False otherwise.

removeItems() None

Removes a list of string items from the knob.

removeKey(index, view) True if succeeded, False otherwise.

Remove key. :param index: Optional index. :param view: Optional view. :return: True if succeeded, False otherwise.

removeKeyAt(time, index, view) True if succeeded, False otherwise.

Remove keyframe at specified time, optional index and view. Return True if successful. :param time: Time. :param index: Optional index. :param view: Optional view. :return: True if succeeded, False otherwise.

resize(w, h) True if successful, False otherwise.

Resize the array. :param w: New width :param h: Optional new height :return: True if successful, False otherwise.

setAllItems(items, autoSelect) None

Sets a list of strings containing all items that the knob can import. After calling this function, only items from this list can be imported into the nosde.

Parameters
  • items – List of imported items.

  • autoSelect – If True, all items are automatically set as imported and selected.

Returns

None.

setAnimated(index, view) True if succeeded, False otherwise.

Create an Animation object. Return True if successful, in which case caller must initialise it by calling setValue() or setValueAt(). :param index: Optional index. :param view: Optional view. :return: True if succeeded, False otherwise.

setAuthorMode(authorMode) None.

Sets the authoring mode on the knob. This accepts both the unique string identifier, which is also used for serialisation and deserialisation, or index of the option for convenience. These values are not meant to change, thus one can rely on them. :param authorMode: The string identifier or index of the authoring mode. :return: None.

setDefaultValue(s) None.
Parameters

s – Sequence of floating-point values.

Returns

None.

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.

setImportedItems(items) None\n

Sets a list of strings containing all items imported into the knob. This will overwrite the current imported items list.

Parameters

items – List of imported items.

Returns

None.

setKeyAt(time, index, view) None.

Set a key on element ‘index’, at time and view. :param time: Time. :param index: Optional index. :param view: Optional view. :return: None.

setLabel(s) None.
Parameters

s – New label.

Returns

None.

setName(s) None.
Parameters

s – New name.

Returns

None.

setRange(f1, f2) None.

Set range of values. :param f1 Min value. :param f2 Max value. :return: None.

setSelectedItems() None

Takes a list of strings of items contained in the knob and sets them as selected.

setSingleValue(b, view) None.

Set to just hold a single value or not. :param b: Boolean object. :param view: Optional view. Default is current view. :return: None.

setTooltip(s) None.
Parameters

s – New tooltip.

Returns

None.

setValue(val) bool

Set the unsigned integer value of this knob. :param val: The new value for the knob. Must be an integer >= 0. :return: True if succeeded, False otherwise.

setValueAt(value, time, index, view) bool.

Set value of element ‘index’ at time for view. If the knob is animated, it will set a new keyframe or change an existing one. Index and view are optional. Return True if successful. :param value: Floating point value. :param time: Time. :param index: Optional index. :param view: Optional view. :return: True if value changed, False otherwise. Safe to ignore.

setVisible(visible) None.

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

singleValue(view) True if holds a single value.
Parameters

view – Optional view. Default is current view.

Returns

True if holds a single value.

splitView(view) None.

Split the view away from the current knob value. :param view: Optional view. Default is current view. :return: None.

toScript(quote, context) String.

Return the value of the knob in script syntax. :param quote: Optional, default is False. Specify True to return the knob value quoted in {}. :param context: Optional context, default is current, None will be “contextless” (all views, all keys) as in a .nk file. :return: String.

tooltip() tooltip.
Returns

tooltip.

unsplitView(view) None.

Unsplit the view so that it shares a value with other views. :param view: Optional view. Default is current view. :return: None.

value() int

Get the value of this knob as an integer. :return: int

valueAt(time, index, view) Floating point or List of floating point values (in case some are different).

Return value for this knob at specified time, optional index and view. :param time: Time. :param index: Optional index. Default is 0. :param view: Optional view. :return: Floating point or List of floating point values (in case some are different).

vect() List of knob values.
Returns

List of knob values.

Should only be used for knobs that are neither animated nor get their values from a ValueProvider. For knobs like that, use Array_Knob.getValue, instead

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.

width() Width of array of values.
Returns

Width of array of values.