Blender  V3.3
COM_CombineColorNodeLegacy.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. */
3 
5 
6 #include "COM_ConvertOperation.h"
7 
8 namespace blender::compositor {
9 
11 {
12 }
13 
15  const CompositorContext &context) const
16 {
17  NodeInput *input_rsocket = this->get_input_socket(0);
18  NodeInput *input_gsocket = this->get_input_socket(1);
19  NodeInput *input_bsocket = this->get_input_socket(2);
20  NodeInput *input_asocket = this->get_input_socket(3);
21  NodeOutput *output_socket = this->get_output_socket(0);
22 
24  if (input_rsocket->is_linked()) {
25  operation->set_canvas_input_index(0);
26  }
27  else if (input_gsocket->is_linked()) {
28  operation->set_canvas_input_index(1);
29  }
30  else if (input_bsocket->is_linked()) {
31  operation->set_canvas_input_index(2);
32  }
33  else {
34  operation->set_canvas_input_index(3);
35  }
36  converter.add_operation(operation);
37 
38  converter.map_input_socket(input_rsocket, operation->get_input_socket(0));
39  converter.map_input_socket(input_gsocket, operation->get_input_socket(1));
40  converter.map_input_socket(input_bsocket, operation->get_input_socket(2));
41  converter.map_input_socket(input_asocket, operation->get_input_socket(3));
42 
44  if (color_conv) {
45  converter.add_operation(color_conv);
46 
47  converter.add_link(operation->get_output_socket(), color_conv->get_input_socket(0));
48  converter.map_output_socket(output_socket, color_conv->get_output_socket());
49  }
50  else {
51  converter.map_output_socket(output_socket, operation->get_output_socket());
52  }
53 }
54 
56 {
57  return nullptr; /* no conversion needed */
58 }
59 
61 {
62  return new ConvertHSVToRGBOperation();
63 }
64 
66 {
68  bNode *editor_node = this->get_bnode();
69  operation->set_mode(editor_node->custom1);
70  return operation;
71 }
72 
74 {
75  return new ConvertYUVToRGBOperation();
76 }
77 
78 } // 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:190
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:238
NodeOutput * get_output_socket(unsigned int index=0) const
Definition: COM_Node.cc:84
bNode * get_bnode() const
get the reference to the SDNA bNode struct
Definition: COM_Node.h:64
NodeInput * get_input_socket(unsigned int index) const
Definition: COM_Node.cc:89
short custom1