2#include "Engine/Core/Path.h"
4#include "Engine/Network/CookContext.h"
5#include "Engine/Network/NodePacket.h"
6#include "Engine/Network/NodeType.h"
7#include "Engine/Parameter/NodeParameter.h"
32 virtual ~Node() =
default;
49 std::shared_ptr<const enzo::NodePacket>
getOutputPacket(
unsigned int outputIndex)
const;
59 std::vector<std::weak_ptr<prm::NodeParameter>>
getParameters();
64 std::weak_ptr<prm::NodeParameter>
getParameter(std::string_view parameterName);
115 void dirtyNode(
bool dirtyDescendents =
true);
140 void initParameters();
144 bool isComparisonTrue(
const std::string& conditionText);
147 void onParameterChanged(
const std::string& parmName);
149 std::vector<std::shared_ptr<prm::NodeParameter>> parameters_;
150 std::vector<std::shared_ptr<const enzo::NodePacket>> outputPackets_;
155 Vector2 position_{0.f, 0.f};
Basic attribute, parameter, and node types for Enzo.
uint64_t NodeId
The unique ID assigned to each node in the network.
Definition Types.h:306
Definition NodePacket.h:9
A default path class for creation and manipulation of tree-based paths.
Definition Path.h:14
The handle a node holds while it cooks to get context about the network.
Definition CookContext.h:23
The unique runtime representation of a node.
Definition Node.h:18
bool takesInput() const
Returns whether the node takes any input at all.
Definition Node.cpp:226
void setPosition(Vector2 pos)
Sets the node's position in the network graph.
Definition Node.h:130
Node & operator=(const Node &)=delete
Deleted copy assignment operator to avoid accidental copies.
bool isDirty()
Returns true if the node is dirty and false if the node is clean (does not need cooking).
Definition Node.cpp:96
std::string getName() const
Returns the runtime name uniquely identifying this node among its siblings (eg. "grid1")
Definition Node.cpp:204
const Path & getPath() const
Returns the full path locating this node within the network.
Definition Node.h:94
Vector2 getPosition() const
Returns the node's position in the network graph.
Definition Node.h:128
const std::vector< prm::Template > & getTemplates() const
Returns the template tree declared by this node's type.
Definition Node.cpp:202
bool isParameterEnabled(std::string_view parmName)
Whether the named parameter's disable condition leaves it enabled.
Definition Node.cpp:166
const nt::NodeType & getType() const
Returns the static type definition this node was created from.
Definition Node.cpp:206
std::weak_ptr< prm::NodeParameter > getParameter(std::string_view parameterName)
Returns a parameter with the given name belonging to this node.
Definition Node.cpp:142
std::shared_ptr< const enzo::NodePacket > getOutputPacket(unsigned int outputIndex) const
Returns the current output geometry.
Definition Node.cpp:110
std::vector< std::weak_ptr< prm::NodeParameter > > getParameters()
Returns all parameters belonging to this node.
Definition Node.cpp:197
Node(const Node &)=delete
Deleted copy constructor to avoid accidental copies.
void dirtyNode(bool dirtyDescendents=true)
Marks the outputed geometry as outdated and notifies the network.
Definition Node.cpp:83
unsigned int getMaxOutputs() const
Returns the number of available outputs the node provides.
Definition Node.cpp:227
std::optional< std::string > getReferencedValue(const std::string &text)
Returns the value text written as prm(name) reads from that parameter, or the text itself when it nam...
Definition Node.cpp:186
boost::signals2::signal< void(nt::NodeId nodeId, bool dirtyDescendents)> nodeDirtied
A signal emitted when the node is dirtied. This will usually notify the NetworkManager.
Definition Node.h:134
void setPath(const Path &path)
Sets the full path locating this node within the network.
Definition Node.h:97
void cook(nt::CookContext &context)
Builds the node's implementation and runs its cook, filling the output packets.
Definition Node.cpp:98
void setOutputPacket(unsigned int outputIndex, enzo::NodePacket packet)
Stores finished geometry against one of the node's outputs.
Definition Node.cpp:120
bool isParameterHidden(std::string_view parmName)
Whether the named parameter's hide condition currently hides it.
Definition Node.cpp:176
boost::signals2::signal< void(const std::string &parmName)> parameterChanged
A signal emitted when one parameter's value changes, carrying its name.
Definition Node.h:137
bool outputRequested(unsigned int outputIndex) const
Returns whether anything downstream is asking for one of the node's outputs.
Definition Node.cpp:136
Node(enzo::nt::NodeId nodeId, const nt::NodeType &nodeType, const Path &path)
Constructs a new node.
Definition Node.cpp:49
Everything every node of one kind shares.
Definition NodeType.h:39