Blender V4.3
COM_DenoiseNode.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#include "COM_DenoiseNode.h"
6
7namespace blender::compositor {
8
9DenoiseNode::DenoiseNode(bNode *editor_node) : Node(editor_node)
10{
11 /* pass */
12}
13
15 const CompositorContext & /*context*/) const
16{
19 converter.add_input_proxy(get_input_socket(0), false));
20 return;
21 }
22
23 const bNode *node = this->get_bnode();
24 const NodeDenoise *denoise = (const NodeDenoise *)node->storage;
25
26 DenoiseOperation *operation = new DenoiseOperation();
27 converter.add_operation(operation);
28 operation->set_denoise_settings(denoise);
29
30 converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
31 if (denoise && denoise->prefilter == CMP_NODE_DENOISE_PREFILTER_ACCURATE) {
32 {
35 normal_prefilter->set_image_name("normal");
36 converter.add_operation(normal_prefilter);
37 converter.map_input_socket(get_input_socket(1), normal_prefilter->get_input_socket(0));
38 converter.add_link(normal_prefilter->get_output_socket(), operation->get_input_socket(1));
39 }
40 {
42 albedo_prefilter->set_image_name("albedo");
43 converter.add_operation(albedo_prefilter);
44 converter.map_input_socket(get_input_socket(2), albedo_prefilter->get_input_socket(0));
45 converter.add_link(albedo_prefilter->get_output_socket(), operation->get_input_socket(2));
46 }
47 }
48 else {
49 converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
50 converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2));
51 }
52
53 converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0));
54}
55
56} // 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 set_denoise_settings(const NodeDenoise *settings)
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: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
@ Vector
Vector data type.