Blender V4.3
COM_CombineColorNodeLegacy.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
6
8
9namespace blender::compositor {
10
12
14 const CompositorContext &context) const
15{
16 NodeInput *input_rsocket = this->get_input_socket(0);
17 NodeInput *input_gsocket = this->get_input_socket(1);
18 NodeInput *input_bsocket = this->get_input_socket(2);
19 NodeInput *input_asocket = this->get_input_socket(3);
20 NodeOutput *output_socket = this->get_output_socket(0);
21
23 if (input_rsocket->is_linked()) {
24 operation->set_canvas_input_index(0);
25 }
26 else if (input_gsocket->is_linked()) {
27 operation->set_canvas_input_index(1);
28 }
29 else if (input_bsocket->is_linked()) {
30 operation->set_canvas_input_index(2);
31 }
32 else {
33 operation->set_canvas_input_index(3);
34 }
35 converter.add_operation(operation);
36
37 converter.map_input_socket(input_rsocket, operation->get_input_socket(0));
38 converter.map_input_socket(input_gsocket, operation->get_input_socket(1));
39 converter.map_input_socket(input_bsocket, operation->get_input_socket(2));
40 converter.map_input_socket(input_asocket, operation->get_input_socket(3));
41
42 NodeOperation *color_conv = get_color_converter(context);
43 if (color_conv) {
44 converter.add_operation(color_conv);
45
46 converter.add_link(operation->get_output_socket(), color_conv->get_input_socket(0));
47 converter.map_output_socket(output_socket, color_conv->get_output_socket());
48 }
49 else {
50 converter.map_output_socket(output_socket, operation->get_output_socket());
51 }
52}
53
55{
56 return nullptr; /* no conversion needed */
57}
58
63
65{
67 const bNode *editor_node = this->get_bnode();
68 operation->set_mode(editor_node->custom1);
69 return operation;
70}
71
76
77} // namespace blender::compositor
virtual NodeOperation * get_color_converter(const CompositorContext &context) const =0
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
NodeOperation * get_color_converter(const CompositorContext &context) const override
NodeOperation * get_color_converter(const CompositorContext &context) const override
NodeOperation * get_color_converter(const CompositorContext &context) const override
NodeOperation * get_color_converter(const CompositorContext &context) const override
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
NodeOperation contains calculation logic.
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:239
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
int16_t custom1