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