19 name_ = allocator_.copy_string(
name);
20 graph_input_node_ = allocator_.construct<
InterfaceNode>().release();
21 graph_output_node_ = allocator_.construct<
InterfaceNode>().release();
22 nodes_.append(graph_input_node_);
23 nodes_.append(graph_output_node_);
30 std::destroy_at(socket);
33 std::destroy_at(socket);
35 std::destroy_at(
node);
39 std::destroy_at(socket);
42 std::destroy_at(socket);
44 std::destroy_at(
node);
63 socket.
type_ = inputs[i].type;
70 socket.
type_ = outputs[i].type;
81 socket.
node_ = graph_input_node_;
83 socket.
index_in_node_ = graph_inputs_.append_and_get_index(&socket);
84 graph_input_node_->outputs_ = graph_inputs_;
86 graph_input_node_->socket_names_.append(std::move(
name));
94 socket.
node_ = graph_output_node_;
96 socket.
index_in_node_ = graph_outputs_.append_and_get_index(&socket);
97 graph_output_node_->inputs_ = graph_outputs_;
99 graph_output_node_->socket_names_.append(std::move(
name));
108 from.targets_.append(&to);
113 if (socket.origin_ !=
nullptr) {
114 socket.origin_->targets_.remove_first_occurrence_and_reorder(&socket);
115 socket.origin_ =
nullptr;
121 for (
const int i : nodes_.index_range()) {
122 nodes_[i]->index_in_graph_ = i;
128 int socket_counter = 0;
129 for (
const int i : nodes_.index_range()) {
131 socket->index_in_graph_ = socket_counter++;
134 socket->index_in_graph_ = socket_counter++;
137 socket_num_ = socket_counter;
142 for (
const int i : nodes_.index_range()) {
143 if (nodes_[i]->index_in_graph_ != i) {
166 std::stringstream ss;
182 return socket.
name();
205 if (
node->is_interface()) {
236 from_dot_node.
output(origin->index()), to_dot_port);
237 options.add_edge_attributes(*origin, *socket, dot_edge);
239 else if (
const void *default_value = socket->default_value()) {
240 const CPPType &type = socket->type();
241 std::string value_string;
243 value_string = type.
to_string(default_value);
246 value_string = type.
name();
251 digraph.
new_edge(default_value_dot_node, to_dot_port);
bool is_printable() const
std::string to_string(const void *value) const
StringRefNull name() const
const Value & lookup(const Key &key) const
void add_new(const Key &key, const Value &value)
constexpr int64_t size() const
constexpr IndexRange index_range() const
void set(StringRef key, StringRef value)
std::string to_dot_string() const
DirectedEdge & new_edge(NodePort from, NodePort to)
void set_rankdir(Attr_rankdir rankdir)
Node & new_node(StringRef label)
NodePort output(int index) const
NodePort input(int index) const
void set_shape(Attr_shape shape)
void set_background_color(StringRef name)
const LazyFunction & function() const
virtual std::string socket_name(const Socket &socket) const
virtual void add_edge_attributes(const OutputSocket &from, const InputSocket &to, dot_export::DirectedEdge &dot_edge) const
virtual std::optional< std::string > socket_font_color(const Socket &socket) const
void update_node_indices()
bool node_indices_are_valid() const
Span< const FunctionNode * > function_nodes() const
FunctionNode & add_function(const LazyFunction &fn)
void add_link(OutputSocket &from, InputSocket &to)
void update_socket_indices()
Graph(StringRef name="unknown")
GraphOutputSocket & add_output(const CPPType &type, std::string name="")
void clear_origin(InputSocket &socket)
StringRefNull name() const
std::string to_dot(const ToDotOptions &options={}) const
GraphInputSocket & add_input(const CPPType &type, std::string name="")
virtual std::string name() const
std::string detailed_name() const
CCL_NAMESPACE_BEGIN struct Options options
InputSocket GraphOutputSocket
OutputSocket GraphInputSocket
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
std::optional< std::string > fontcolor
Input & add_input(std::string name)
Output & add_output(std::string name)