Blender  V3.3
COM_IDMaskNode.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. */
3 
4 #include "COM_IDMaskNode.h"
5 #include "COM_IDMaskOperation.h"
6 #include "COM_SMAAOperation.h"
7 
8 namespace blender::compositor {
9 
10 IDMaskNode::IDMaskNode(bNode *editor_node) : Node(editor_node)
11 {
12  /* pass */
13 }
15  const CompositorContext & /*context*/) const
16 {
17  bNode *bnode = this->get_bnode();
18 
19  IDMaskOperation *operation;
20  operation = new IDMaskOperation();
21  operation->set_object_index(bnode->custom1);
22  converter.add_operation(operation);
23 
24  converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
25  if (bnode->custom2 == 0) {
26  converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0));
27  }
28  else {
29  SMAAEdgeDetectionOperation *operation1 = nullptr;
30 
31  operation1 = new SMAAEdgeDetectionOperation();
32  converter.add_operation(operation1);
33 
34  converter.add_link(operation->get_output_socket(0), operation1->get_input_socket(0));
35 
36  /* Blending Weight Calculation Pixel Shader (Second Pass). */
39  converter.add_operation(operation2);
40 
41  converter.add_link(operation1->get_output_socket(), operation2->get_input_socket(0));
42 
43  /* Neighborhood Blending Pixel Shader (Third Pass). */
45  converter.add_operation(operation3);
46 
47  converter.add_link(operation->get_output_socket(0), operation3->get_input_socket(0));
48  converter.add_link(operation2->get_output_socket(), operation3->get_input_socket(1));
49  converter.map_output_socket(get_output_socket(0), operation3->get_output_socket());
50  }
51 }
52 
53 } // namespace blender::compositor
Overall context of the compositor.
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
IDMaskNode(bNode *editor_node)
void set_object_index(float object_index)
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)
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: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
short custom2