Blender  V3.3
COM_NodeOperationBuilder.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 "BLI_map.hh"
7 #include "BLI_vector.hh"
8 
9 #include "COM_NodeGraph.h"
10 
11 namespace blender::compositor {
12 
13 class CompositorContext;
14 
15 class Node;
16 class NodeInput;
17 class NodeOutput;
18 
19 class ExecutionSystem;
20 class ExecutionGroup;
21 class NodeOperation;
22 class NodeOperationInput;
23 class NodeOperationOutput;
24 
25 class PreviewOperation;
26 class WriteBufferOperation;
27 class ViewerOperation;
28 class ConstantOperation;
29 
31  public:
32  class Link {
33  private:
34  NodeOperationOutput *from_;
35  NodeOperationInput *to_;
36 
37  public:
39  {
40  }
41 
43  {
44  return from_;
45  }
47  {
48  return to_;
49  }
50  };
51 
52  private:
53  const CompositorContext *context_;
54  NodeGraph graph_;
55  ExecutionSystem *exec_system_;
56 
57  Vector<NodeOperation *> operations_;
58  Vector<Link> links_;
60 
65 
66  Node *current_node_;
67 
72  ViewerOperation *active_viewer_;
73 
74  public:
76  bNodeTree *b_nodetree,
77  ExecutionSystem *system);
78 
79  const CompositorContext &context() const
80  {
81  return *context_;
82  }
83 
85 
86  void add_operation(NodeOperation *operation);
88  ConstantOperation *constant_operation);
89 
91  void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket);
93  void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket);
94 
97 
102 
104  void register_viewer(ViewerOperation *viewer);
107  {
108  return active_viewer_;
109  }
110 
112  {
113  return operations_;
114  }
115 
116  const Vector<Link> &get_links() const
117  {
118  return links_;
119  }
120 
121  protected:
124 
128 
130  void resolve_proxies();
131 
133  void determine_canvases();
134 
143 
145  void prune_operations();
146 
148  void sort_operations();
149 
151  void group_operations();
153 
154  private:
155  PreviewOperation *make_preview_operation() const;
156  void unlink_inputs_and_relink_outputs(NodeOperation *unlinked_op, NodeOperation *linked_op);
158  void merge_equal_operations();
159  void merge_equal_operations(NodeOperation *from, NodeOperation *into);
160  void save_graphviz(StringRefNull name = "");
161 #ifdef WITH_CXX_GUARDEDALLOC
162  MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeCompilerImpl")
163 #endif
164 };
165 
167 std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder &builder);
168 std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder::Link &link);
169 
170 } // namespace blender::compositor
struct Link Link
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:190
void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket)
void convert_to_operations(ExecutionSystem *system)
WriteBufferOperation * find_attached_write_buffer_operation(NodeOperationOutput *output) const
void add_preview(NodeOperationOutput *output)
void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
void replace_operation_with_constant(NodeOperation *operation, ConstantOperation *constant_operation)
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
NodeOperationBuilder(const CompositorContext *context, bNodeTree *b_nodetree, ExecutionSystem *system)
void add_input_buffers(NodeOperation *operation, NodeOperationInput *input)
ExecutionGroup * make_group(NodeOperation *op)
const Vector< NodeOperation * > & get_operations() const
const CompositorContext & context() const
void add_link(NodeOperationOutput *from, NodeOperationInput *to)
NodeOperation contains calculation logic.
NodeOutput are sockets that can send data/input.
Definition: COM_Node.h:238
StackEntry * from
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
std::ostream & operator<<(std::ostream &os, const eCompositorPriority &priority)
Definition: COM_Enums.cc:26