Blender V4.3
COM_CornerPinNode.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2014 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "COM_CornerPinNode.h"
6
8#include "COM_SMAAOperation.h"
10
11namespace blender::compositor {
12
13CornerPinNode::CornerPinNode(bNode *editor_node) : Node(editor_node) {}
14
16 const CompositorContext & /*context*/) const
17{
18 PlaneCornerPinMaskOperation *plane_mask_operation = new PlaneCornerPinMaskOperation();
19 converter.add_operation(plane_mask_operation);
20
21 SMAAOperation *smaa_operation = new SMAAOperation();
22 converter.add_operation(smaa_operation);
23
24 converter.add_link(plane_mask_operation->get_output_socket(),
25 smaa_operation->get_input_socket(0));
26
27 converter.map_output_socket(this->get_output_socket(1), smaa_operation->get_output_socket());
28
30 converter.add_operation(warp_image_operation);
31 converter.map_input_socket(this->get_input_socket(0), warp_image_operation->get_input_socket(0));
32
33 /* NOTE: socket order differs between UI node and operations:
34 * bNode uses intuitive order following top-down layout:
35 * upper-left, upper-right, lower-left, lower-right
36 * Operations use same order as the tracking blenkernel functions expect:
37 * lower-left, lower-right, upper-right, upper-left
38 */
39 const int node_corner_index[4] = {3, 4, 2, 1};
40 for (int i = 0; i < 4; i++) {
41 NodeInput *corner_input = get_input_socket(node_corner_index[i]);
42 converter.map_input_socket(corner_input, warp_image_operation->get_input_socket(i + 1));
43 converter.map_input_socket(corner_input, plane_mask_operation->get_input_socket(i));
44 }
45
46 SetAlphaMultiplyOperation *set_alpha_operation = new SetAlphaMultiplyOperation();
47 converter.add_operation(set_alpha_operation);
48 converter.add_link(warp_image_operation->get_output_socket(),
49 set_alpha_operation->get_input_socket(0));
50 converter.add_link(smaa_operation->get_output_socket(),
51 set_alpha_operation->get_input_socket(1));
52 converter.map_output_socket(this->get_output_socket(0),
53 set_alpha_operation->get_output_socket());
54}
55
56} // namespace blender::compositor
Overall context of the compositor.
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
void add_link(NodeOperationOutput *from, NodeOperationInput *to)
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:191
NodeOperationOutput * get_output_socket(unsigned int index=0)
NodeOperationInput * get_input_socket(unsigned int index)
NodeOutput * get_output_socket(unsigned int index=0) const
Definition COM_Node.cc:85
NodeInput * get_input_socket(unsigned int index) const
Definition COM_Node.cc:90