Node

Inheritance diagram of rumba.Node
class Node

Base class of all Rumba nodes.

A Node has plugs and children nodes.

Python example

# Create a root node
node = Node("Node", "node", None)

# Create two children nodes
child0 = Node("Node", "child", node)
child1 = Node("Node", "child", node)

# Test if a child exists
if node.has_child("child"):

    # Get a child node
    child = node.child("child")

    # Get the parent node
    parent = child.parent()

# Iterates the children
for child in node.children():
    name = child.name()

# Get a node plug
plug = node.plug("structure")
plug = node.structure   # alternative

# Iterate the plugs
for p in node.plugs():
    name = p.name()

# Create a Lerp plug-in node
lerp = Node("Lerp", "lerp", None)

# Get a plug
weight = lerp.weight

# Set its value
weight.set_value(0.5)

Methods

__eq__

Return self==value.

__getattr__

__hash__

Return hash(self).

__init__

Constructor(s)

__ne__

Return self!=value.

add_plug

bases()

Returns a list of all the types this class derives.

channel(channel_type)

Return the specified channel if available, return nullptr otherwise.

channel_plugs()

rtype

list(Plug)

channel_switch_sub_channel(sub_channel)

Return the plug for the sub channel name if available.

channels()

Return all the node's channels.

child(name)

Get a child node by its name.

children()

Get the node children accessor.

delete_node(undo_stack)

Delete this node from the document.

description()

Returns the node's description, always returns a valid pointer.

document()

Get the Document parent node.

duplicate(parent, undo_stack)

Duplicate this node, plugs, dynamic plugs and children.

find_first(name)

Get the first node named name in the children hierarchy of this node.

flatten_reference()

Flattens this root reference node.

full_document_name()

Return the node full name starting at the document node.

full_name()

Return the node full name starting at the workspace node.

has_child(child_name)

Check if a child node exists.

has_parent()

Check if this node has a parent.

has_plug(plug_name)

Check if a plug exists.

is_child_of(parent)

Return true if this node is child of parent or is parent.

is_deleted()

Return true if this node has been deleted.

is_instance(node_type_name)

Check if this node derive from another node type.

is_mutable()

Check if this node can be modified.

is_reference_loaded()

Returns true if this node is a root reference node and the reference is loaded.

is_reference_root()

Check if this node is the root node of a reference.

is_referenced()

Check if this node is referenced.

is_selected()

true if the node is selected

load_reference

name()

Return the node name.

node_delegate()

Get the NodeDelegate pointing to this node.

notify_first_init(undo_stack)

Do the one shot initialization tasks for this node.

parent()

Get the node parent.

plug(plug_name)

Return a plug by its name.

plugin()

Returns the node plug-in, if this node has been created by a plug-in, or nullptr.

plugs()

Return the node plugs iteration.

random_child()

Returns a Node with a random name as child of this node.

reference_filename()

Returns the reference file name for this node.

relationship()

Returns the nodes in relationship with this node.

remove_plug

rename(new_name, undo_stack)

Rename the node.

rename_plug(plug, new_name, undo_stack)

Rename a plug of this node.

replace_reference(new_reference)

Replace this root reference node with another file.

search(key)

Search in the node childrens all the name that satisfies the key.

set_description(description, undo_stack)

Set the description of this node.

set_graph_properties(gp)

Set the graph_properties plug value and invalidates the connected nodes graph_properties plugs.

set_parent(parent, undo_stack)

Set the node parent.

type_name()

Return the node type name.

unload_reference()

Unload this root reference node.

write(filename)

Write the node into a file.

__init__()

Constructor(s)

Node (type: unicode,name: unicode,parent: Node,undo_stack: bool)

Create a node.

Parameters
  • type (unicode) - The node type to use

  • name (unicode) - The node name

  • parent (Node) - The optional parent node

  • undo_stack (bool) - true if this node creation is undoable

raises RuntimeError

if the type is unknown.

bases()

Returns a list of all the types this class derives.

Return type

list(unicode)

channel(channel_type: ChannelType) Channel

Return the specified channel if available, return nullptr otherwise.

Return type

Channel

channel_plugs()
Return type

list(Plug)

channel_switch_sub_channel(sub_channel: unicode) Optional[Plug]

Return the plug for the sub channel name if available.

Return type

Optional[Plug]

channels()

Return all the node’s channels.

Return type

list(Channel)

child(name: unicode) Node

Get a child node by its name.

Return type

Node

Raises

RuntimeError – if the child doesn’t exist.

children() Children

Get the node children accessor.

Return type

Children

delete_node(undo_stack: bool) None

Delete this node from the document.

Once deleted, only the is_deleted() method can be called on the node. The node shall not be used anymore.

Parameters

undo_stack (bool) – if true, this action is undoable

description() AttributeDescriptor

Returns the node’s description, always returns a valid pointer.

Return type

AttributeDescriptor

document() Optional[Node]

Get the Document parent node.

Return type

Optional[Node]

Raises

RuntimeError – if the node is not a child of a Document node.

duplicate(parent: Node, undo_stack: bool) Node

Duplicate this node, plugs, dynamic plugs and children.

Parameters
  • parent (Node) – The optional parent node

  • undo_stack (bool) – true if this node creation is undoable

Return type

Node

find_first(name: unicode) Node

Get the first node named name in the children hierarchy of this node.

Return type

Node

Raises

RuntimeError – if the node doesn’t exist.

flatten_reference() None

Flattens this root reference node.

Flattens the reference starting at this node, keeping all internal references as such. If Node::is_reference_root returns false or if Node::is_reference_loaded returns false, this method has no effect.

Raises

RuntimeError – if the file is corrupted

full_document_name() unicode

Return the node full name starting at the document node.

Return type

unicode

full_name() unicode

Return the node full name starting at the workspace node.

Return type

unicode

has_child(child_name: unicode) bool

Check if a child node exists.

Return type

bool

has_parent() bool

Check if this node has a parent.

Return type

bool

has_plug(plug_name: unicode) bool

Check if a plug exists.

Return type

bool

is_child_of(parent: Node) bool

Return true if this node is child of parent or is parent.

Return type

bool

is_deleted() bool

Return true if this node has been deleted. In that case, it shall not be used any more.

Return type

bool

is_instance(node_type_name: unicode) bool

Check if this node derive from another node type.

Return type

bool

is_mutable() bool

Check if this node can be modified.

The node is mutable if it is not inside a reference.

Return type

bool

is_reference_loaded() bool

Returns true if this node is a root reference node and the reference is loaded.

Return type

bool

is_reference_root() bool

Check if this node is the root node of a reference.

Returns true if the node is the root of a reference node, or an unloaded reference node. In case the node is unloaded, Node::is_referenced() returns false.

Return type

bool

is_referenced() bool

Check if this node is referenced.

Returns true if the node is inside a reference node (read only) or if the node is a loaded root reference node (mutable).

Return type

bool

is_selected() bool

true if the node is selected

Return type

bool

name() unicode

Return the node name.

Return type

unicode

node_delegate() NodeDelegate

Get the NodeDelegate pointing to this node.

The NodeDelegate object is valid as long as the Node object lives.

Return type

NodeDelegate

notify_first_init(undo_stack: bool) None

Do the one shot initialization tasks for this node.

This method must be called after the first time the node has been created and added to the workspace. This will call the NodePlugin::on_first_init callback to performe extra initialization tasks.

parent() Node

Get the node parent.

Return type

Node

Raises

RuntimeError – if the node has no parent.

plug(plug_name: unicode) Plug

Return a plug by its name.

In Python, you can access a plug like an attribute.

# Get a node plug
plug = node.plug("structure")
plug = node.structure   # alternative
Return type

Plug

Raises

RuntimeError – if the plug does not exist.

plugin() NodePlugin

Returns the node plug-in, if this node has been created by a plug-in, or nullptr.

Return type

NodePlugin

plugs() Plugs

Return the node plugs iteration.

Return type

Plugs

random_child() Node

Returns a Node with a random name as child of this node.

Return type

Node

reference_filename() unicode

Returns the reference file name for this node.

If the node is not a reference root node, return an empty string.

Return type

unicode

relationship()

Returns the nodes in relationship with this node.

A relationship can have different meanings. For a layer for instance, the relationship are the controllers animated in this layer.

Return type

list(Node)

rename(new_name: unicode, undo_stack: bool) None

Rename the node.

Parameters
  • new_name (unicode) – The new name for the node

  • undo_stack (bool) – if true, this action is undoable

rename_plug(plug: Plug, new_name: unicode, undo_stack: bool) None

Rename a plug of this node.

Raises
  • plug – The plug to rename.

  • name – The new name for the plug

  • undo_stack – The modification is undoable if this parameter is true.

  • RuntimeError – When no plug can be renamed.

replace_reference(new_reference: unicode) None

Replace this root reference node with another file.

Replace the reference with another file. The reference stays loaded or unload.

Raises

RuntimeError – if the file is corrupted

search(key: unicode)

Search in the node childrens all the name that satisfies the key.

Returns a list of nodes that satisfies the search key.

Parameters

key (unicode) – The key use in the regex to search node by name, must follow regex standard

Return type

list(Node)

set_description(description: unicode, undo_stack: bool) None

Set the description of this node.

set_graph_properties(gp: GraphProperties) None

Set the graph_properties plug value and invalidates the connected nodes graph_properties plugs.

Use this method to set the node graph_properties plug value when the node moved in order to correctly invalidate its sibling connected nodes.

set_parent(parent: Node, undo_stack: bool) None

Set the node parent.

Raises

RuntimeError – if the node can’t be re-parented.

type_name() unicode

Return the node type name.

Return type

unicode

unload_reference() None

Unload this root reference node.

Unload the reference starting at this node from memory, and keep all its overriden values, connections and descriptions in the reference edits. If Node::is_reference_loaded returns false, this method has no effect.

write(filename: unicode) None

Write the node into a file.

Raises

RuntimeError – if the writing fails.