Blender V4.3
COM_SeparateColorNodeLegacy.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 *image_socket = this->get_input_socket(0);
17 NodeOutput *output_rsocket = this->get_output_socket(0);
18 NodeOutput *output_gsocket = this->get_output_socket(1);
19 NodeOutput *output_bsocket = this->get_output_socket(2);
20 NodeOutput *output_asocket = this->get_output_socket(3);
21
22 NodeOperation *color_conv = get_color_converter(context);
23 if (color_conv) {
24 converter.add_operation(color_conv);
25
26 converter.map_input_socket(image_socket, color_conv->get_input_socket(0));
27 }
28
29 {
31 operation->set_channel(0);
32 converter.add_operation(operation);
33
34 if (color_conv) {
35 converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0));
36 }
37 else {
38 converter.map_input_socket(image_socket, operation->get_input_socket(0));
39 }
40 converter.map_output_socket(output_rsocket, operation->get_output_socket(0));
41 }
42
43 {
45 operation->set_channel(1);
46 converter.add_operation(operation);
47
48 if (color_conv) {
49 converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0));
50 }
51 else {
52 converter.map_input_socket(image_socket, operation->get_input_socket(0));
53 }
54 converter.map_output_socket(output_gsocket, operation->get_output_socket(0));
55 }
56
57 {
59 operation->set_channel(2);
60 converter.add_operation(operation);
61
62 if (color_conv) {
63 converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0));
64 }
65 else {
66 converter.map_input_socket(image_socket, operation->get_input_socket(0));
67 }
68 converter.map_output_socket(output_bsocket, operation->get_output_socket(0));
69 }
70
71 {
73 operation->set_channel(3);
74 converter.add_operation(operation);
75
76 if (color_conv) {
77 converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0));
78 }
79 else {
80 converter.map_input_socket(image_socket, operation->get_input_socket(0));
81 }
82 converter.map_output_socket(output_asocket, operation->get_output_socket(0));
83 }
84}
85
87{
88 return nullptr; /* no conversion needed */
89}
90
95
97{
99 const bNode *editor_node = this->get_bnode();
100 operation->set_mode(editor_node->custom1);
101 return operation;
102}
103
108
109} // 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
NodeOperation contains calculation logic.
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: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
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
int16_t custom1