|
Enzo
|
Every node in a scene, their wiring, and the scopes they live in. More...
#include <Network.h>
Public Types | |
| using | NodeStore = std::unordered_map<NodeId, std::unique_ptr<Node>> |
Public Member Functions | |
| Network (const Network &)=delete | |
| Network & | operator= (const Network &)=delete |
| Scope * | getScope (const Path &path) |
| Returns the scope at a path, or null when no scope sits there. | |
| NetworkGraph & | graph () |
| Returns the wiring and dependencies between the nodes. | |
| void | clear () |
| Empties the network back to a bare root scope. | |
Nodes | |
| auto | nodes () |
| Returns an iterable range over every node, yielding {NodeId, Node&} pairs. | |
| Node & | getNode (NodeId nodeId) |
| Returns the node with the given id. | |
| bool | isValidNode (NodeId nodeId) const |
| Returns whether a node with the given id is present. | |
| Node * | getNodeAtPath (const Path &path) |
| Returns the node at an exact path, or null when no node is there. | |
| std::vector< NodeId > | getChildNodeIds (const Path &scope) |
| Returns the ids of the nodes living directly inside a scope, in no particular order. | |
| Node & | createNode (NodeId nodeId, const NodeType &nodeType, const Path &path) |
| Builds a node, stores it, and opens the child scope its type declares. | |
| void | deleteNode (NodeId nodeId) |
| Drops a node, the scope it held, and its wiring. | |
| NodeId | reserveNodeId () |
| Returns an id no node has used yet. | |
| Node * | findNode (const NetworkPath &path, NodeId fromNode=nullNode) |
| Resolves a node reference to its node. | |
| std::weak_ptr< prm::NodeParameter > | findParameter (const NetworkPath &path, NodeId fromNode=nullNode) |
| Resolves a parameter reference to its parameter. | |
Every node in a scene, their wiring, and the scopes they live in.
This is the whole node graph as one value. It holds data and answers questions about what it holds. Cooking, undo, selection, and signalling all belong to the nt::NetworkManager that owns one of these.
Nodes are stored flat and keyed by nt::NodeId, with nesting carried entirely in their paths, so /container1/grid1 lives in the scope at /container1 without anything holding it there.
| nt::Node & enzo::nt::Network::createNode | ( | nt::NodeId | nodeId, |
| const NodeType & | nodeType, | ||
| const Path & | path ) |
Builds a node, stores it, and opens the child scope its type declares.
| void enzo::nt::Network::deleteNode | ( | nt::NodeId | nodeId | ) |
Drops a node, the scope it held, and its wiring.
| nt::Node * enzo::nt::Network::findNode | ( | const NetworkPath & | path, |
| NodeId | fromNode = nullNode ) |
Resolves a node reference to its node.
A relative path is read from the scope holding fromNode, so a bare name finds a sibling and ".." steps out to the scope above.
| path | A node path such as "grid1", "../grid1", or "/grid1". An empty node path resolves to fromNode itself. |
| fromNode | The node a relative path resolves against, nullNode when there is none. |
| std::weak_ptr< prm::NodeParameter > enzo::nt::Network::findParameter | ( | const NetworkPath & | path, |
| NodeId | fromNode = nullNode ) |
Resolves a parameter reference to its parameter.
| path | A parameter path such as "grid1.tx". |
| fromNode | The node a path with no node part resolves against, nullNode when there is none. |
| std::vector< nt::NodeId > enzo::nt::Network::getChildNodeIds | ( | const Path & | scope | ) |
Returns the ids of the nodes living directly inside a scope, in no particular order.
| nt::Node & enzo::nt::Network::getNode | ( | nt::NodeId | nodeId | ) |
Returns the node with the given id.
Returns the node at an exact path, or null when no node is there.
Returns the scope at a path, or null when no scope sits there.