|
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) |
| Rename the node. More... | |
| 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... | |
| std::shared_ptr< AttributeDescriptor > | description () const |
| Returns the node's description, always returns a valid pointer. More... | |
| void | set_description (const std::string &description, bool undo_stack=false) |
| Set the description of this node. More... | |
| const char * | type_name () const |
| Return the node type name. More... | |
| bool | is_deleted () const |
| Return true if this node has been deleted. In that case, it shall not be used any more. 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_singleton () const |
| void | set_singleton (bool singleton) |
| 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 () |
| Load this root reference node. More... | |
| void | replace_reference (const std::wstring &new_reference) |
| Replace this root reference node with another file. More... | |
| void | flatten_reference () |
| Flattens this root reference node. 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... | |
| std::optional< 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 | rename_plug (const Plug &plug, const char *new_name, bool undo_stack=false) |
| 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 > | channel_plugs () const |
| std::vector< Channel > | channels () const |
| Return all the node's channels. More... | |
| std::shared_ptr< Channel > | channel (ChannelType channel_type) const |
| Return the specified channel if available, return nullptr otherwise. 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 () |
| Get the NodeDelegate pointing to this node. More... | |
| void | notify_first_init (bool undo_stack) |
| Do the one shot initialization tasks for this node. More... | |
| void | set_graph_properties (const class GraphProperties &gp) |
| Set the graph_properties plug value and invalidates the connected nodes graph_properties plugs. More... | |
| bool | is_selected () const |
| true if the node is selected More... | |
| std::optional< Plug > | channel_switch_sub_channel (const std::string_view &sub_channel) const |
| Return the plug for the sub channel name if available. More... | |
| bool | operator== (const Node &o) const |
| bool | operator!= (const Node &o) const |
| 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. |
| std::runtime_error | When no plug can be added. |
| const std::vector<std::string>& maquina::Node::bases | ( | ) | const |
Returns a list of all the types this class derives.
| std::shared_ptr<Channel> maquina::Node::channel | ( | ChannelType | channel_type | ) | const |
Return the specified channel if available, return nullptr otherwise.
| std::vector<Plug> maquina::Node::channel_plugs | ( | ) | const |
| std::optional<Plug> maquina::Node::channel_switch_sub_channel | ( | const std::string_view & | sub_channel | ) | const |
Return the plug for the sub channel name if available.
| std::vector<Channel> maquina::Node::channels | ( | ) | const |
Return all the node's channels.
| 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.
Once deleted, only the is_deleted() method can be called on the node. The node shall not be used anymore.
| undo_stack | if true, this action is undoable |
| std::shared_ptr<AttributeDescriptor> maquina::Node::description | ( | ) | const |
Returns the node's description, always returns a valid pointer.
| std::optional<Node> maquina::Node::document | ( | ) | const |
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. |
| void maquina::Node::flatten_reference | ( | ) |
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.
| std::runtime_error | if the file is corrupted |
| 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_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_deleted | ( | ) | const |
Return true if this node has been deleted. In that case, it shall not be used any more.
| 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_selected | ( | ) | const |
true if the node is selected
| bool maquina::Node::is_serializable | ( | ) | const |
Returns true if this node and all its children will be serialised on save.
| bool maquina::Node::is_singleton | ( | ) | const |
| void maquina::Node::load_reference | ( | ) |
Load this root reference node.
Load the reference for this node from file, applying the overrides stored in the reference edits. 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 | ( | ) |
Get the NodeDelegate pointing to this node.
The NodeDelegate object is valid as long as the Node object lives.
| 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 |
||
| ) |
Rename the node.
| new_name | The new name for the node |
| undo_stack | if true, this action is undoable |
| void maquina::Node::rename_plug | ( | const Plug & | plug, |
| const char * | new_name, | ||
| bool | undo_stack = false |
||
| ) |
Rename a plug of this node.
| plug | The plug to rename. |
| name | The new name for the plug |
| undo_stack | The modification is undoable if this parameter is true. |
| std::runtime_error | When no plug can be renamed. |
| 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_description | ( | const std::string & | description, |
| bool | undo_stack = false |
||
| ) |
Set the description of this node.
| void maquina::Node::set_graph_properties | ( | const class GraphProperties & | gp | ) |
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.
| 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. |
| void maquina::Node::set_singleton | ( | bool | singleton | ) |
| const char* maquina::Node::type_name | ( | ) | const |
Return the node type name.
| void maquina::Node::unload_reference | ( | ) |
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.
| void maquina::Node::write | ( | const std::wstring & | filename | ) | const |
Write the node into a file.
| std::runtime_error | if the writing fails. |