|
Rumba C++ SDK
|
Base class of all Rumba nodes. More...
#include <Node.h>
Classes | |
| class | Children |
| A Node children accessor. More... | |
| class | Plugs |
| A Plug accessor. More... | |
Public Types | |
| using | Flags = Plug::Flags |
Public Member Functions | |
| Node (const char *type, const char *name, Node *parent=nullptr, bool undo_stack=false) | |
| Create a node. More... | |
| Node | duplicate (Node *parent=nullptr, bool undo_stack=false) const |
| Duplicate this node, plugs, dynamic plugs and children. More... | |
| void | delete_node (bool undo_stack=false) |
| Delete this node from the document. More... | |
| void | rename (const char *new_name, bool undo_stack=false) |
| const char * | name () const |
| Return the node name. More... | |
| std::string | full_name () const |
| Return the node full name starting at the workspace node. More... | |
| std::string | full_document_name () const |
| Return the node full name starting at the document node. More... | |
| const char * | ui_descriptor () const |
| Return the node ui json descriptor. More... | |
| const char * | type_name () const |
| Return the node type name. More... | |
| StringView | ui_description () const |
| Return the node ui json description. More... | |
| bool | is_instance (const char *node_type_name) const |
| Check if this node derive from another node type. More... | |
| bool | is_referenced () const |
| Check if this node is referenced. More... | |
| bool | is_mutable () const |
| Check if this node can be modified. More... | |
| bool | is_reference_root () const |
| Check if this node is the root node of a reference. More... | |
| bool | is_reference_loaded () const |
| Returns true if this node is a root reference node and the reference is loaded. More... | |
| bool | is_serializable () const |
| Returns true if this node and all its children will be serialised on save. More... | |
| bool | is_document_node () const |
| Returns true if this node belong to a document. More... | |
| void | set_serializable (bool serialize) |
| std::wstring | reference_filename () const |
| Returns the reference file name for this node. More... | |
| void | unload_reference () |
| Unload this root reference node. More... | |
| void | load_reference () |
| Unload this root reference node. More... | |
| void | replace_reference (const std::wstring &new_reference) |
| Replace this root reference node with another file. More... | |
| void | write (const std::wstring &filename) const |
| Write the node into a file. More... | |
| Children | children () const |
| Get the node children accessor. More... | |
| bool | has_parent () const |
| Check if this node has a parent. More... | |
| Node | parent () const |
| Get the node parent. More... | |
| void | set_parent (Node &parent, bool undo_stack) |
| Set the node parent. More... | |
| bool | has_document () const |
| Check if this node is child of a Document node. More... | |
| Node | document () const |
| Get the Document parent node. More... | |
| bool | has_child (const char *child_name) const |
| Check if a child node exists. More... | |
| Node | child (const char *name) const |
| Get a child node by its name. More... | |
| bool | is_child_of (const Node &parent) const |
| Return true if this node is child of parent or is parent. More... | |
| Node | find_first (const char *name) const |
| Get the first node named name in the children hierarchy of this node. More... | |
| Plugs | plugs () const |
| Return the node plugs iteration. More... | |
| bool | has_plug (const char *plug_name) const |
| Check if a plug exists. More... | |
| Plug | add_plug (const char *name, const Value &default_value, int flags=Flags::serial, bool undo_stack=false, const std::string &description="") |
| void | remove_plug (const char *name, bool undo_stack=false) |
| void | remove_plug (const Plug &plug, bool undo_stack=false) |
| Plug | plug (const char *plug_name) const |
| Return a plug by its name. More... | |
| std::vector< Plug > | channels () const |
| Returns the channels of this node. More... | |
| std::vector< Node > | relationship () |
| Returns the nodes in relationship with this node. More... | |
| const std::vector< std::string > & | bases () const |
| Returns a list of all the types this class derives. More... | |
| Node | random_child () |
| Returns a Node with a random name as child of this node. More... | |
| std::shared_ptr< NodePlugin > | plugin () const |
| Returns the node plug-in, if this node has been created by a plug-in, or nullptr. More... | |
| std::vector< Node > | search (const std::string &key) const |
| Search in the node childrens all the name that satisfies the key. More... | |
| std::shared_ptr< class NodeDelegate > | node_delegate () |
| void | notify_first_init (bool undo_stack) |
| Do the one shot initialization tasks for this node. More... | |
| bool | operator== (const Node &o) const |
| bool | operator!= (const Node &o) const |
Base class of all Rumba nodes.
A Node has plugs and children nodes.
C++ example
| using maquina::Node::Flags = Plug::Flags |
| maquina::Node::Node | ( | const char * | type, |
| const char * | name, | ||
| Node * | parent = nullptr, |
||
| bool | undo_stack = false |
||
| ) |
Create a node.
| std::runtime_error | if the type is unknown. |
| type | The node type to use |
| name | The node name |
| parent | The optional parent node |
| undo_stack | true if this node creation is undoable |
| Plug maquina::Node::add_plug | ( | const char * | name, |
| const Value & | default_value, | ||
| int | flags = Flags::serial, |
||
| bool | undo_stack = false, |
||
| const std::string & | description = "" |
||
| ) |
Add a new plug to this node.
| name | Initial name of the plug, may be changed if a plug with this name already exists |
| default_value | Default value held by this plug |
| flags | A combination of Flags |
| undo_stack | The modification is undoable if this parameter is true. |
| const std::vector<std::string>& maquina::Node::bases | ( | ) | const |
Returns a list of all the types this class derives.
| std::vector<Plug> maquina::Node::channels | ( | ) | const |
Returns the channels of this node.
| Node maquina::Node::child | ( | const char * | name | ) | const |
Get a child node by its name.
| std::runtime_error | if the child doesn't exist. |
| Children maquina::Node::children | ( | ) | const |
Get the node children accessor.
| void maquina::Node::delete_node | ( | bool | undo_stack = false | ) |
Delete this node from the document.
| undo_stack | if true, this action is undoable |
| Node maquina::Node::document | ( | ) | const |
Get the Document parent node.
| std::runtime_error | if the node is not a child of a Document node. |
Duplicate this node, plugs, dynamic plugs and children.
| parent | The optional parent node |
| undo_stack | true if this node creation is undoable |
| Node maquina::Node::find_first | ( | const char * | name | ) | const |
Get the first node named name in the children hierarchy of this node.
| std::runtime_error | if the node doesn't exist. |
| std::string maquina::Node::full_document_name | ( | ) | const |
Return the node full name starting at the document node.
| std::string maquina::Node::full_name | ( | ) | const |
Return the node full name starting at the workspace node.
| bool maquina::Node::has_child | ( | const char * | child_name | ) | const |
Check if a child node exists.
| bool maquina::Node::has_document | ( | ) | const |
Check if this node is child of a Document node.
| bool maquina::Node::has_parent | ( | ) | const |
Check if this node has a parent.
| bool maquina::Node::has_plug | ( | const char * | plug_name | ) | const |
Check if a plug exists.
| bool maquina::Node::is_child_of | ( | const Node & | parent | ) | const |
Return true if this node is child of parent or is parent.
| bool maquina::Node::is_document_node | ( | ) | const |
Returns true if this node belong to a document.
Returns true if the node is a document or is in a document, and is serializable.
| bool maquina::Node::is_instance | ( | const char * | node_type_name | ) | const |
Check if this node derive from another node type.
| bool maquina::Node::is_mutable | ( | ) | const |
Check if this node can be modified.
The node is mutable if it is not inside a reference.
| bool maquina::Node::is_reference_loaded | ( | ) | const |
Returns true if this node is a root reference node and the reference is loaded.
| bool maquina::Node::is_reference_root | ( | ) | const |
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.
| bool maquina::Node::is_referenced | ( | ) | const |
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).
| bool maquina::Node::is_serializable | ( | ) | const |
Returns true if this node and all its children will be serialised on save.
| void maquina::Node::load_reference | ( | ) |
Unload this root reference node.
Unload the reference starting at this node from memory, and keep all its values and connection. If Node::is_reference_root returns false or if Node::is_reference_loaded returns true, this method has no effect.
| std::runtime_error | if the file is corrupted |
| const char* maquina::Node::name | ( | ) | const |
Return the node name.
| std::shared_ptr<class NodeDelegate> maquina::Node::node_delegate | ( | ) |
| void maquina::Node::notify_first_init | ( | bool | undo_stack | ) |
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.
|
inline |
|
inline |
| Node maquina::Node::parent | ( | ) | const |
Get the node parent.
| std::runtime_error | if the node has no parent. |
| Plug maquina::Node::plug | ( | const char * | plug_name | ) | const |
Return a plug by its name.
| std::runtime_error | if the plug does not exist. |
| std::shared_ptr<NodePlugin> maquina::Node::plugin | ( | ) | const |
Returns the node plug-in, if this node has been created by a plug-in, or nullptr.
| Plugs maquina::Node::plugs | ( | ) | const |
Return the node plugs iteration.
| std::wstring maquina::Node::reference_filename | ( | ) | const |
Returns the reference file name for this node.
If the node is not a reference root node, return an empty string.
| std::vector<Node> maquina::Node::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.
| void maquina::Node::remove_plug | ( | const char * | name, |
| bool | undo_stack = false |
||
| ) |
Remove a plug from this node that was added by add_plug(). If no plug with such name exists or such a plug was not added by add_plug(), this method throws an exception. Otherwise the plug is detached from the evaluation graph (inputs, outputs, dependences and back dependences are removed) and it will be destroyed when the last reference to it disappear. *
| name | Actual name of the plug, not necessarily the one given to add_plug(). |
| undo_stack | The modification is undoable if this parameter is true. |
| std::runtime_error | When no plug with this name can be removed. |
| void maquina::Node::remove_plug | ( | const Plug & | plug, |
| bool | undo_stack = false |
||
| ) |
Remove a plug from this node that was added by add_plug(). If the given plug does not belong to this node or was not added by add_plug(), this method throws an exception. Otherwise the plug is detached from the evaluation graph (inputs, outputs, dependences and back dependences are removed) and it will be destroyed when the last reference to it disappear. *
| plug | The plug to remove. |
| undo_stack | The modification is undoable if this parameter is true. |
| std::runtime_error | When no plug with this name can be removed. |
| void maquina::Node::rename | ( | const char * | new_name, |
| bool | undo_stack = false |
||
| ) |
| void maquina::Node::replace_reference | ( | const std::wstring & | new_reference | ) |
Replace this root reference node with another file.
Replace the reference with another file. The reference stays loaded or unload.
| std::runtime_error | if the file is corrupted |
| std::vector<Node> maquina::Node::search | ( | const std::string & | key | ) | const |
Search in the node childrens all the name that satisfies the key.
Returns a list of nodes that satisfies the search key.
| key | The key use in the regex to search node by name, must follow regex standard |
| void maquina::Node::set_parent | ( | Node & | parent, |
| bool | undo_stack | ||
| ) |
Set the node parent.
| std::runtime_error | if the node can't be re-parented. |
| void maquina::Node::set_serializable | ( | bool | serialize | ) |
Set the serialization flag on this node.
| serialize | if false, this node and all its children will not be serialized on save. |
| const char* maquina::Node::type_name | ( | ) | const |
Return the node type name.
| StringView maquina::Node::ui_description | ( | ) | const |
Return the node ui json description.
| const char* maquina::Node::ui_descriptor | ( | ) | const |
Return the node ui json descriptor.
| void maquina::Node::unload_reference | ( | ) |
Unload this root reference node.
Unload the reference starting at this node from memory, and keep all its values and connection. If Node::is_reference_loaded returns false, this method has no effect.
| void maquina::Node::write | ( | const std::wstring & | filename | ) | const |
Write the node into a file.
| std::runtime_error | if the writing fails. |