Blender  V2.93
COM_NodeOperationBuilder.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2013, Blender Foundation.
17  */
18 
19 #pragma once
20 
21 #include <map>
22 #include <set>
23 #include <vector>
24 
25 #include "COM_NodeGraph.h"
26 
27 namespace blender::compositor {
28 
29 class CompositorContext;
30 
31 class Node;
32 class NodeInput;
33 class NodeOutput;
34 
35 class ExecutionSystem;
36 class ExecutionGroup;
37 class NodeOperation;
38 class NodeOperationInput;
39 class NodeOperationOutput;
40 
41 class PreviewOperation;
42 class WriteBufferOperation;
43 class ViewerOperation;
44 
46  public:
47  class Link {
48  private:
49  NodeOperationOutput *m_from;
50  NodeOperationInput *m_to;
51 
52  public:
54  {
55  }
56 
58  {
59  return m_from;
60  }
62  {
63  return m_to;
64  }
65  };
66 
67  private:
68  const CompositorContext *m_context;
69  NodeGraph m_graph;
70 
71  Vector<NodeOperation *> m_operations;
72  Vector<Link> m_links;
73  Vector<ExecutionGroup *> m_groups;
74 
79 
80  Node *m_current_node;
81 
86  ViewerOperation *m_active_viewer;
87 
88  public:
90 
91  const CompositorContext &context() const
92  {
93  return *m_context;
94  }
95 
97 
98  void addOperation(NodeOperation *operation);
99 
101  void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket);
103  void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket);
104 
107 
111  void addNodeInputPreview(NodeInput *input);
112 
114  void registerViewer(ViewerOperation *viewer);
117  {
118  return m_active_viewer;
119  }
120 
122  {
123  return m_operations;
124  }
125 
126  const Vector<Link> &get_links() const
127  {
128  return m_links;
129  }
130 
131  protected:
134 
137  void add_input_constant_value(NodeOperationInput *input, const NodeInput *node_input);
138 
140  void resolve_proxies();
141 
143  void determineResolutions();
144 
151  void add_input_buffers(NodeOperation *operation, NodeOperationInput *input);
153 
155  void prune_operations();
156 
158  void sort_operations();
159 
161  void group_operations();
163 
164  private:
165  PreviewOperation *make_preview_operation() const;
166 
167 #ifdef WITH_CXX_GUARDEDALLOC
168  MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeCompilerImpl")
169 #endif
170 };
171 
172 std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder &builder);
173 std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder::Link &link);
174 
175 } // namespace blender::compositor
struct Link Link
#define output
Overall context of the compositor.
Class ExecutionGroup is a group of Operations that are executed as one. This grouping is used to comb...
the ExecutionSystem contains the whole compositor tree.
NodeInput are sockets that can receive data/input.
Definition: COM_Node.h:210
WriteBufferOperation * find_attached_write_buffer_operation(NodeOperationOutput *output) const
void addPreview(NodeOperationOutput *output)
void add_input_constant_value(NodeOperationInput *input, const NodeInput *node_input)
void add_output_buffers(NodeOperation *operation, NodeOperationOutput *output)
Vector< NodeOperationInput * > cache_output_links(NodeOperationOutput *output) const
void add_input_buffers(NodeOperation *operation, NodeOperationInput *input)
void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket)
void addLink(NodeOperationOutput *from, NodeOperationInput *to)
ExecutionGroup * make_group(NodeOperation *op)
const Vector< NodeOperation * > & get_operations() const
const CompositorContext & context() const
NodeOperationBuilder(const CompositorContext *context, bNodeTree *b_nodetree)
NodeOperation contains calculation logic.
NodeOutput are sockets that can send data/input.
Definition: COM_Node.h:258
StackEntry * from
std::ostream & operator<<(std::ostream &os, const eCompositorPriority &priority)
Definition: COM_Enums.cc:23
Definition: node.h:98