Blender  V3.3
COM_CombineXYZNode.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2021 Blender Foundation. */
3 
4 #include "COM_CombineXYZNode.h"
5 
6 #include "COM_ConvertOperation.h"
7 
8 namespace blender::compositor {
9 
10 CombineXYZNode::CombineXYZNode(bNode *editor_node) : Node(editor_node)
11 {
12 }
13 
15  const CompositorContext &UNUSED(context)) const
16 {
17  NodeInput *input_x_socket = this->get_input_socket(0);
18  NodeInput *input_y_socket = this->get_input_socket(1);
19  NodeInput *input_z_socket = this->get_input_socket(2);
20  NodeOutput *output_socket = this->get_output_socket(0);
21 
23  if (input_x_socket->is_linked()) {
24  operation->set_canvas_input_index(0);
25  }
26  else if (input_y_socket->is_linked()) {
27  operation->set_canvas_input_index(1);
28  }
29  else {
30  operation->set_canvas_input_index(2);
31  }
32  converter.add_operation(operation);
33 
34  converter.map_input_socket(input_x_socket, operation->get_input_socket(0));
35  converter.map_input_socket(input_y_socket, operation->get_input_socket(1));
36  converter.map_input_socket(input_z_socket, operation->get_input_socket(2));
37  converter.map_output_socket(output_socket, operation->get_output_socket());
38 }
39 
40 } // namespace blender::compositor
#define UNUSED(x)
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
Overall context of the compositor.
void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
void add_operation(NodeOperation *operation)
void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket)
NodeInput are sockets that can receive data/input.
Definition: COM_Node.h:190
NodeOperationOutput * get_output_socket(unsigned int index=0)
NodeOperationInput * get_input_socket(unsigned int index)
void set_canvas_input_index(unsigned int index)
set the index of the input socket that will determine the canvas of this operation
NodeOutput are sockets that can send data/input.
Definition: COM_Node.h:238
NodeOutput * get_output_socket(unsigned int index=0) const
Definition: COM_Node.cc:84
NodeInput * get_input_socket(unsigned int index) const
Definition: COM_Node.cc:89