Blender V5.3
node_tree_input_node_operation.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "DNA_node_types.h"
6
7#include "BKE_node.hh"
8#include "BKE_node_runtime.hh"
9
10#include "COM_context.hh"
11#include "COM_node_operation.hh"
13#include "COM_utilities.hh"
14
15namespace blender::compositor {
16
17/* A node operation representing a node tree input node that for each of its outputs gets the input
18 * from the node group operation it represents and shares its data with its own output with the
19 * same identifier. Node tree input nodes include group input and zone input nodes. */
21 private:
22 /* The operation that this input node belongs to. */
23 Operation &operation_;
24
25 public:
27 : NodeOperation(context, node), operation_(operation)
28 {
29 }
30
31 void execute() override
32 {
33 for (const bNodeSocket *output_socket : this->node().output_sockets()) {
34 if (!is_socket_available(output_socket)) {
35 continue;
36 }
37
38 Result &output_result = this->get_result(output_socket->identifier);
39 if (output_result.should_compute()) {
40 const Result &operation_input = operation_.get_input(output_socket->identifier);
41 output_result.share_data(operation_input);
42 }
43 }
44 }
45};
46
48 const bNode &node,
49 Operation &operation)
50{
51 return new NodeTreeInputNodeOperation(context, node, operation);
52}
53
54} // namespace blender::compositor
NodeOperation(Context &context, const bNode &node)
NodeTreeInputNodeOperation(Context &context, const bNode &node, Operation &operation)
Result & get_result(StringRef identifier)
Definition operation.cc:40
Context & context() const
Definition operation.cc:57
void share_data(const Result &source)
Definition result.cc:996
bool should_compute() const
Definition result.cc:1124
NodeOperation * get_node_tree_input_node_operation(Context &context, const bNode &node, Operation &operation)
bool is_socket_available(const bNodeSocket *socket)
Definition utilities.cc:26