Blender V4.3
COM_GlareNode.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
5#include "COM_GlareNode.h"
12#include "COM_MixOperation.h"
14
15namespace blender::compositor {
16
17GlareNode::GlareNode(bNode *editor_node) : Node(editor_node)
18{
19 /* pass */
20}
21
23 const CompositorContext & /*context*/) const
24{
25 const bNode *node = this->get_bnode();
26 const NodeGlare *glare = (const NodeGlare *)node->storage;
27
28 GlareBaseOperation *glareoperation = nullptr;
29 switch (glare->type) {
30 default:
32 glareoperation = new GlareGhostOperation();
33 break;
35 glareoperation = new GlareStreaksOperation();
36 break;
38 glareoperation = new GlareFogGlowOperation();
39 break;
41 glareoperation = new GlareSimpleStarOperation();
42 break;
44 glareoperation = new GlareBloomOperation();
45 break;
46 }
47 BLI_assert(glareoperation);
48 glareoperation->set_glare_settings(glare);
49
50 GlareThresholdOperation *threshold_operation = new GlareThresholdOperation();
51 threshold_operation->set_glare_settings(glare);
52
53 SetValueOperation *mixvalueoperation = new SetValueOperation();
54 mixvalueoperation->set_value(glare->mix);
55
56 MixGlareOperation *mixoperation = new MixGlareOperation();
57 mixoperation->set_canvas_input_index(1);
59
60 converter.add_operation(glareoperation);
61 converter.add_operation(threshold_operation);
62 converter.add_operation(mixvalueoperation);
63 converter.add_operation(mixoperation);
64
65 converter.map_input_socket(get_input_socket(0), threshold_operation->get_input_socket(0));
66 converter.add_link(threshold_operation->get_output_socket(),
67 glareoperation->get_input_socket(0));
68
69 converter.add_link(mixvalueoperation->get_output_socket(), mixoperation->get_input_socket(0));
70 converter.map_input_socket(get_input_socket(0), mixoperation->get_input_socket(1));
71 converter.add_link(glareoperation->get_output_socket(), mixoperation->get_input_socket(2));
72 converter.map_output_socket(get_output_socket(), mixoperation->get_output_socket());
73}
74
75} // namespace blender::compositor
#define BLI_assert(a)
Definition BLI_assert.h:50
@ CMP_NODE_GLARE_STREAKS
@ CMP_NODE_GLARE_BLOOM
@ CMP_NODE_GLARE_GHOST
@ CMP_NODE_GLARE_SIMPLE_STAR
@ CMP_NODE_GLARE_FOG_GLOW
Overall context of the compositor.
void set_glare_settings(const NodeGlare *settings)
GlareNode(bNode *editor_node)
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)
void add_operation(NodeOperation *operation)
void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket)
void set_resize_mode(ResizeMode resize_mode)
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 * 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
@ FitAny
Fit the width or the height of the input image to the width or height of the working area of the node...