Blender  V3.3
COM_CornerPinNode.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2014 Blender Foundation. */
3 
4 #include "COM_CornerPinNode.h"
5 
7 
8 namespace blender::compositor {
9 
10 CornerPinNode::CornerPinNode(bNode *editor_node) : Node(editor_node)
11 {
12 }
13 
15  const CompositorContext & /*context*/) const
16 {
17  NodeInput *input_image = this->get_input_socket(0);
18  /* NOTE: socket order differs between UI node and operations:
19  * bNode uses intuitive order following top-down layout:
20  * upper-left, upper-right, lower-left, lower-right
21  * Operations use same order as the tracking blenkernel functions expect:
22  * lower-left, lower-right, upper-right, upper-left
23  */
24  const int node_corner_index[4] = {3, 4, 2, 1};
25 
26  NodeOutput *output_warped_image = this->get_output_socket(0);
27  NodeOutput *output_plane = this->get_output_socket(1);
28 
30  converter.add_operation(warp_image_operation);
31  PlaneCornerPinMaskOperation *plane_mask_operation = new PlaneCornerPinMaskOperation();
32  converter.add_operation(plane_mask_operation);
33 
34  converter.map_input_socket(input_image, warp_image_operation->get_input_socket(0));
35  for (int i = 0; i < 4; i++) {
36  NodeInput *corner_input = get_input_socket(node_corner_index[i]);
37  converter.map_input_socket(corner_input, warp_image_operation->get_input_socket(i + 1));
38  converter.map_input_socket(corner_input, plane_mask_operation->get_input_socket(i));
39  }
40  converter.map_output_socket(output_warped_image, warp_image_operation->get_output_socket());
41  converter.map_output_socket(output_plane, plane_mask_operation->get_output_socket());
42 }
43 
44 } // namespace blender::compositor
Overall context of the compositor.
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
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)
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