Blender V4.3
COM_NodeOperationBuilder.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 "BLI_map.hh"
8#include "BLI_vector.hh"
9
10#include "COM_NodeGraph.h"
11
12namespace blender::compositor {
13
14class CompositorContext;
15
16class Node;
17class NodeInput;
18class NodeOutput;
19
20class ExecutionSystem;
21class NodeOperation;
22class NodeOperationInput;
23class NodeOperationOutput;
24
25class PreviewOperation;
26class ViewerOperation;
27class ConstantOperation;
28
30 public:
31 class Link {
32 private:
35
36 public:
37 Link(NodeOperationOutput *from, NodeOperationInput *to) : from_(from), to_(to) {}
38
40 {
41 return from_;
42 }
44 {
45 return to_;
46 }
47 };
48
49 private:
50 const CompositorContext *context_;
51 NodeGraph graph_;
52 ExecutionSystem *exec_system_;
53
54 Vector<NodeOperation *> operations_;
55 Vector<Link> links_;
56
61
62 Node *current_node_;
63
68 ViewerOperation *active_viewer_;
69
70 public:
72 bNodeTree *b_nodetree,
73 ExecutionSystem *system);
74
76 {
77 return *context_;
78 }
79
81
82 void add_operation(NodeOperation *operation);
84 ConstantOperation *constant_operation);
85
87 void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket);
89 void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket);
90
93
95 void add_preview(NodeOperationOutput *output);
98
100 void register_viewer(ViewerOperation *viewer);
103 {
104 return active_viewer_;
105 }
106
108 {
109 return operations_;
110 }
111
113 {
114 return links_;
115 }
116
117 protected:
120
123 void add_input_constant_value(NodeOperationInput *input, const NodeInput *node_input);
124
126 void resolve_proxies();
127
129 void determine_canvases();
130
133
135 void prune_operations();
136
138 void sort_operations();
139
140 private:
141 PreviewOperation *make_preview_operation() const;
142 void unlink_inputs_and_relink_outputs(NodeOperation *unlinked_op, NodeOperation *linked_op);
144 void merge_equal_operations();
145 void merge_equal_operations(NodeOperation *from, NodeOperation *into);
146 void save_graphviz(StringRefNull name = "");
147#ifdef WITH_CXX_GUARDEDALLOC
148 MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeCompilerImpl")
149#endif
150};
151
153std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder &builder);
154std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder::Link &link);
155
156} // namespace blender::compositor
Overall context of the compositor.
the ExecutionSystem contains the whole compositor tree.
NodeInput are sockets that can receive data/input.
Definition COM_Node.h:191
void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket)
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)
Vector< NodeOperationInput * > cache_output_links(NodeOperationOutput *output) const
NodeOperationBuilder(const CompositorContext *context, bNodeTree *b_nodetree, ExecutionSystem *system)
void add_link(NodeOperationOutput *from, NodeOperationInput *to)
NodeOperation contains calculation logic.
NodeOutput are sockets that can send data/input.
Definition COM_Node.h:239
std::ostream & operator<<(std::ostream &os, const eCompositorPriority &priority)
Definition COM_Enums.cc:27