Blender  V3.3
COM_DenoiseNode.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2019 Blender Foundation. */
3 #include "COM_DenoiseNode.h"
4 #include "COM_DenoiseOperation.h"
5 
6 namespace blender::compositor {
7 
8 DenoiseNode::DenoiseNode(bNode *editor_node) : Node(editor_node)
9 {
10  /* pass */
11 }
12 
14  const CompositorContext & /*context*/) const
15 {
16  if (!COM_is_denoise_supported()) {
18  converter.add_input_proxy(get_input_socket(0), false));
19  return;
20  }
21 
22  bNode *node = this->get_bnode();
23  NodeDenoise *denoise = (NodeDenoise *)node->storage;
24 
25  DenoiseOperation *operation = new DenoiseOperation();
26  converter.add_operation(operation);
27  operation->set_denoise_settings(denoise);
28 
29  converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
30  if (denoise && denoise->prefilter == CMP_NODE_DENOISE_PREFILTER_ACCURATE) {
31  {
34  normal_prefilter->set_image_name("normal");
35  converter.add_operation(normal_prefilter);
36  converter.map_input_socket(get_input_socket(1), normal_prefilter->get_input_socket(0));
37  converter.add_link(normal_prefilter->get_output_socket(), operation->get_input_socket(1));
38  }
39  {
41  albedo_prefilter->set_image_name("albedo");
42  converter.add_operation(albedo_prefilter);
43  converter.map_input_socket(get_input_socket(2), albedo_prefilter->get_input_socket(0));
44  converter.add_link(albedo_prefilter->get_output_socket(), operation->get_input_socket(2));
45  }
46  }
47  else {
48  converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
49  converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2));
50  }
51 
52  converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0));
53 }
54 
55 } // namespace blender::compositor
@ CMP_NODE_DENOISE_PREFILTER_ACCURATE
Overall context of the compositor.
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
void add_link(NodeOperationOutput *from, NodeOperationInput *to)
void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
NodeOperationOutput * add_input_proxy(NodeInput *input, bool use_conversion)
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
OperationNode * node
@ Vector
Vector data type.