Blender V4.3
COM_NodeGraph.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2013 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include "DNA_node_types.h"
8
9#ifdef WITH_CXX_GUARDEDALLOC
10# include "MEM_guardedalloc.h"
11#endif
12
13namespace blender::compositor {
14
15class CompositorContext;
16class Node;
17class NodeInput;
18class NodeOutput;
19
24class NodeGraph {
25 public:
26 struct Link {
29
30 Link(NodeOutput *from, NodeInput *to) : from(from), to(to) {}
31 };
32
33 private:
34 Vector<Node *> nodes_;
35 Vector<Link> links_;
36
37 public:
38 ~NodeGraph();
39
41 {
42 return nodes_;
43 }
45 {
46 return links_;
47 }
48
49 void from_bNodeTree(const CompositorContext &context, bNodeTree *tree);
50
51 protected:
52 typedef std::pair<Vector<Node *>::iterator, Vector<Node *>::iterator> NodeRange;
53
54 static bNodeSocket *find_b_node_input(bNode *b_node, const char *identifier);
55 static bNodeSocket *find_b_node_output(bNode *b_node, const char *identifier);
56
57 void add_node(Node *node, bNodeTree *b_ntree, bNodeInstanceKey key, bool is_active_group);
58 void add_link(NodeOutput *from_socket, NodeInput *to_socket);
59
60 void add_bNodeTree(const CompositorContext &context,
61 int nodes_start,
63 bNodeInstanceKey parent_key);
64
65 void add_bNode(const CompositorContext &context,
66 bNodeTree *b_ntree,
67 bNode *b_node,
69 bool is_active_group);
70
71 NodeOutput *find_output(const NodeRange &node_range, bNodeSocket *b_socket);
72 void add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink);
73
74 /* **** Special proxy node type conversions **** */
75 /* These nodes are not represented in the node graph themselves,
76 * but converted into a number of proxy links
77 */
78
79 void add_proxies_mute(bNodeTree *b_ntree,
80 bNode *b_node,
82 bool is_active_group);
83 void add_proxies_skip(bNodeTree *b_ntree,
84 bNode *b_node,
86 bool is_active_group);
87
88 void add_proxies_group_inputs(bNode *b_node, bNode *b_node_io);
90 bNode *b_node,
91 bNode *b_node_io);
92 void add_proxies_group(const CompositorContext &context, bNode *b_node, bNodeInstanceKey key);
93
94 void add_proxies_reroute(bNodeTree *b_ntree,
95 bNode *b_node,
97 bool is_active_group);
98
99#ifdef WITH_CXX_GUARDEDALLOC
100 MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeGraph")
101#endif
102};
103
104} // namespace blender::compositor
Read Guarded memory(de)allocation.
Overall context of the compositor.
static bNodeSocket * find_b_node_input(bNode *b_node, const char *identifier)
void add_bNodeTree(const CompositorContext &context, int nodes_start, bNodeTree *tree, bNodeInstanceKey parent_key)
void add_bNode(const CompositorContext &context, bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group)
std::pair< Vector< Node * >::iterator, Vector< Node * >::iterator > NodeRange
void from_bNodeTree(const CompositorContext &context, bNodeTree *tree)
void add_proxies_group_inputs(bNode *b_node, bNode *b_node_io)
void add_proxies_reroute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group)
void add_proxies_skip(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group)
NodeOutput * find_output(const NodeRange &node_range, bNodeSocket *b_socket)
Span< Link > links() const
Span< Node * > nodes() const
void add_proxies_mute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group)
void add_proxies_group_outputs(const CompositorContext &context, bNode *b_node, bNode *b_node_io)
void add_link(NodeOutput *from_socket, NodeInput *to_socket)
static bNodeSocket * find_b_node_output(bNode *b_node, const char *identifier)
void add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink)
void add_proxies_group(const CompositorContext &context, bNode *b_node, bNodeInstanceKey key)
void add_node(Node *node, bNodeTree *b_ntree, bNodeInstanceKey key, bool is_active_group)
NodeInput are sockets that can receive data/input.
Definition COM_Node.h:191
NodeOutput are sockets that can send data/input.
Definition COM_Node.h:239
KDTree_3d * tree