Blender V4.3
COM_ColorMatteNode.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
9
10namespace blender::compositor {
11
12ColorMatteNode::ColorMatteNode(bNode *editor_node) : Node(editor_node)
13{
14 /* pass */
15}
16
18 const CompositorContext & /*context*/) const
19{
20 const bNode *editorsnode = get_bnode();
21
22 NodeInput *input_socket_image = this->get_input_socket(0);
23 NodeInput *input_socket_key = this->get_input_socket(1);
24 NodeOutput *output_socket_image = this->get_output_socket(0);
25 NodeOutput *output_socket_matte = this->get_output_socket(1);
26
27 ConvertRGBToHSVOperation *operationRGBToHSV_Image = new ConvertRGBToHSVOperation();
28 ConvertRGBToHSVOperation *operationRGBToHSV_Key = new ConvertRGBToHSVOperation();
29 converter.add_operation(operationRGBToHSV_Image);
30 converter.add_operation(operationRGBToHSV_Key);
31
33 operation->set_settings((NodeChroma *)editorsnode->storage);
34 converter.add_operation(operation);
35
37 converter.add_operation(operation_alpha);
38
39 converter.map_input_socket(input_socket_image, operationRGBToHSV_Image->get_input_socket(0));
40 converter.map_input_socket(input_socket_key, operationRGBToHSV_Key->get_input_socket(0));
41 converter.add_link(operationRGBToHSV_Image->get_output_socket(), operation->get_input_socket(0));
42 converter.add_link(operationRGBToHSV_Key->get_output_socket(), operation->get_input_socket(1));
43 converter.map_output_socket(output_socket_matte, operation->get_output_socket(0));
44
45 converter.map_input_socket(input_socket_image, operation_alpha->get_input_socket(0));
46 converter.add_link(operation->get_output_socket(), operation_alpha->get_input_socket(1));
47 converter.map_output_socket(output_socket_image, operation_alpha->get_output_socket());
48
49 converter.add_preview(operation_alpha->get_output_socket());
50}
51
52} // namespace blender::compositor
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
Overall context of the compositor.
void add_link(NodeOperationOutput *from, NodeOperationInput *to)
void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
void add_preview(NodeOperationOutput *output)
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 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
void * storage