Blender V4.3
COM_TransformNode.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "COM_TransformNode.h"
10
11namespace blender::compositor {
12
13TransformNode::TransformNode(bNode *editor_node) : Node(editor_node)
14{
15 /* pass */
16}
17
19 const CompositorContext & /*context*/) const
20{
21 NodeInput *image_input = this->get_input_socket(0);
22 NodeInput *x_input = this->get_input_socket(1);
23 NodeInput *y_input = this->get_input_socket(2);
24 NodeInput *angle_input = this->get_input_socket(3);
25 NodeInput *scale_input = this->get_input_socket(4);
26
27 ScaleRelativeOperation *scale_operation = new ScaleRelativeOperation();
28 converter.add_operation(scale_operation);
29
30 RotateOperation *rotate_operation = new RotateOperation();
31 rotate_operation->set_do_degree2_rad_conversion(false);
32 converter.add_operation(rotate_operation);
33
34 TranslateOperation *translate_operation = new TranslateCanvasOperation();
35 converter.add_operation(translate_operation);
36
38 scale_operation->set_sampler(sampler);
39 rotate_operation->set_sampler(sampler);
40 translate_operation->set_sampler(sampler);
41
42 converter.map_input_socket(image_input, scale_operation->get_input_socket(0));
43 converter.map_input_socket(scale_input, scale_operation->get_input_socket(1));
44 converter.map_input_socket(scale_input,
45 scale_operation->get_input_socket(2)); // xscale = yscale
46
47 converter.add_link(scale_operation->get_output_socket(), rotate_operation->get_input_socket(0));
48 converter.map_input_socket(angle_input, rotate_operation->get_input_socket(1));
49
50 converter.add_link(rotate_operation->get_output_socket(),
51 translate_operation->get_input_socket(0));
52 converter.map_input_socket(x_input, translate_operation->get_input_socket(1));
53 converter.map_input_socket(y_input, translate_operation->get_input_socket(2));
54
55 converter.map_output_socket(get_output_socket(), translate_operation->get_output_socket());
56}
57
58} // namespace blender::compositor
Overall context of the compositor.
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
const bNode * get_bnode() const
get the reference to the SDNA bNode struct
Definition COM_Node.h:65
void set_sampler(PixelSampler sampler)
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
local_group_size(16, 16) .push_constant(Type local_group_size(16, 16) .push_constant(Type input_tx sampler(1, ImageType::FLOAT_2D, "matte_tx") .image(0
int16_t custom1