Blender
V4.3
source
blender
compositor
nodes
COM_AlphaOverNode.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_AlphaOverNode.h
"
6
7
#include "
COM_AlphaOverKeyOperation.h
"
8
#include "
COM_AlphaOverMixedOperation.h
"
9
#include "
COM_AlphaOverPremultiplyOperation.h
"
10
11
namespace
blender::compositor
{
12
13
void
AlphaOverNode::convert_to_operations
(
NodeConverter
&converter,
14
const
CompositorContext
&
/*context*/
)
const
15
{
16
NodeInput
*color1Socket = this->
get_input_socket
(1);
17
NodeInput
*color2Socket = this->
get_input_socket
(2);
18
const
bNode
*editor_node = this->
get_bnode
();
19
20
MixBaseOperation
*convert_prog;
21
const
NodeTwoFloats
*ntf = (
const
NodeTwoFloats
*)editor_node->
storage
;
22
if
(ntf->
x
!= 0.0f) {
23
AlphaOverMixedOperation
*mix_operation =
new
AlphaOverMixedOperation
();
24
mix_operation->
setX
(ntf->
x
);
25
convert_prog = mix_operation;
26
}
27
else
if
(editor_node->
custom1
) {
28
convert_prog =
new
AlphaOverKeyOperation
();
29
}
30
else
{
31
convert_prog =
new
AlphaOverPremultiplyOperation
();
32
}
33
34
convert_prog->
set_use_value_alpha_multiply
(
false
);
35
if
(color1Socket->
is_linked
()) {
36
convert_prog->
set_canvas_input_index
(1);
37
}
38
else
if
(color2Socket->
is_linked
()) {
39
convert_prog->
set_canvas_input_index
(2);
40
}
41
else
{
42
convert_prog->
set_canvas_input_index
(0);
43
}
44
45
converter.
add_operation
(convert_prog);
46
converter.
map_input_socket
(
get_input_socket
(0), convert_prog->
get_input_socket
(0));
47
converter.
map_input_socket
(
get_input_socket
(1), convert_prog->
get_input_socket
(1));
48
converter.
map_input_socket
(
get_input_socket
(2), convert_prog->
get_input_socket
(2));
49
converter.
map_output_socket
(
get_output_socket
(0), convert_prog->
get_output_socket
(0));
50
}
51
52
}
// namespace blender::compositor
COM_AlphaOverKeyOperation.h
COM_AlphaOverMixedOperation.h
COM_AlphaOverNode.h
COM_AlphaOverPremultiplyOperation.h
blender::compositor::AlphaOverKeyOperation
Definition
COM_AlphaOverKeyOperation.h:15
blender::compositor::AlphaOverMixedOperation
Definition
COM_AlphaOverMixedOperation.h:15
blender::compositor::AlphaOverMixedOperation::setX
void setX(float x)
Definition
COM_AlphaOverMixedOperation.h:25
blender::compositor::AlphaOverNode::convert_to_operations
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
Definition
COM_AlphaOverNode.cc:13
blender::compositor::AlphaOverPremultiplyOperation
Definition
COM_AlphaOverPremultiplyOperation.h:15
blender::compositor::CompositorContext
Overall context of the compositor.
Definition
COM_CompositorContext.h:27
blender::compositor::MixBaseOperation
Definition
COM_MixOperation.h:15
blender::compositor::MixBaseOperation::set_use_value_alpha_multiply
void set_use_value_alpha_multiply(const bool value)
Definition
COM_MixOperation.h:53
blender::compositor::NodeConverter
Definition
COM_NodeConverter.h:29
blender::compositor::NodeConverter::map_output_socket
void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
Definition
COM_NodeConverter.cc:30
blender::compositor::NodeConverter::add_operation
void add_operation(NodeOperation *operation)
Definition
COM_NodeConverter.cc:20
blender::compositor::NodeConverter::map_input_socket
void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket)
Definition
COM_NodeConverter.cc:25
blender::compositor::NodeInput
NodeInput are sockets that can receive data/input.
Definition
COM_Node.h:191
blender::compositor::NodeInput::is_linked
bool is_linked() const
Definition
COM_Node.h:221
blender::compositor::NodeOperation::get_output_socket
NodeOperationOutput * get_output_socket(unsigned int index=0)
Definition
COM_NodeOperation.cc:87
blender::compositor::NodeOperation::get_input_socket
NodeOperationInput * get_input_socket(unsigned int index)
Definition
COM_NodeOperation.cc:92
blender::compositor::NodeOperation::set_canvas_input_index
void set_canvas_input_index(unsigned int index)
set the index of the input socket that will determine the canvas of this operation
Definition
COM_NodeOperation.cc:144
blender::compositor::Node::get_output_socket
NodeOutput * get_output_socket(unsigned int index=0) const
Definition
COM_Node.cc:85
blender::compositor::Node::get_input_socket
NodeInput * get_input_socket(unsigned int index) const
Definition
COM_Node.cc:90
blender::compositor::Node::get_bnode
const bNode * get_bnode() const
get the reference to the SDNA bNode struct
Definition
COM_Node.h:65
blender::compositor
Definition
COM_JumpFloodingAlgorithm.cc:20
NodeTwoFloats
Definition
DNA_node_types.h:1184
NodeTwoFloats::x
float x
Definition
DNA_node_types.h:1185
bNode
Definition
DNA_node_types.h:357
bNode::custom1
int16_t custom1
Definition
DNA_node_types.h:400
bNode::storage
void * storage
Definition
DNA_node_types.h:417
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0