Blender
V3.3
source
blender
compositor
nodes
COM_AlphaOverNode.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_AlphaOverNode.h
"
5
6
#include "
COM_AlphaOverKeyOperation.h
"
7
#include "
COM_AlphaOverMixedOperation.h
"
8
#include "
COM_AlphaOverPremultiplyOperation.h
"
9
10
namespace
blender::compositor
{
11
12
void
AlphaOverNode::convert_to_operations
(
NodeConverter
&converter,
13
const
CompositorContext
&
/*context*/
)
const
14
{
15
NodeInput
*color1Socket = this->
get_input_socket
(1);
16
NodeInput
*color2Socket = this->
get_input_socket
(2);
17
bNode
*editor_node = this->
get_bnode
();
18
19
MixBaseOperation
*convert_prog;
20
NodeTwoFloats
*ntf = (
NodeTwoFloats
*)editor_node->
storage
;
21
if
(ntf->
x
!= 0.0f) {
22
AlphaOverMixedOperation
*mix_operation =
new
AlphaOverMixedOperation
();
23
mix_operation->
setX
(ntf->
x
);
24
convert_prog = mix_operation;
25
}
26
else
if
(editor_node->
custom1
) {
27
convert_prog =
new
AlphaOverKeyOperation
();
28
}
29
else
{
30
convert_prog =
new
AlphaOverPremultiplyOperation
();
31
}
32
33
convert_prog->
set_use_value_alpha_multiply
(
false
);
34
if
(color1Socket->
is_linked
()) {
35
convert_prog->
set_canvas_input_index
(1);
36
}
37
else
if
(color2Socket->
is_linked
()) {
38
convert_prog->
set_canvas_input_index
(2);
39
}
40
else
{
41
convert_prog->
set_canvas_input_index
(0);
42
}
43
44
converter.
add_operation
(convert_prog);
45
converter.
map_input_socket
(
get_input_socket
(0), convert_prog->
get_input_socket
(0));
46
converter.
map_input_socket
(
get_input_socket
(1), convert_prog->
get_input_socket
(1));
47
converter.
map_input_socket
(
get_input_socket
(2), convert_prog->
get_input_socket
(2));
48
converter.
map_output_socket
(
get_output_socket
(0), convert_prog->
get_output_socket
(0));
49
}
50
51
}
// namespace blender::compositor
COM_AlphaOverKeyOperation.h
COM_AlphaOverMixedOperation.h
COM_AlphaOverNode.h
COM_AlphaOverPremultiplyOperation.h
if
if(data)
Definition:
bmesh_operator_api_inline.h:158
blender::compositor::AlphaOverKeyOperation
Definition:
COM_AlphaOverKeyOperation.h:14
blender::compositor::AlphaOverMixedOperation
Definition:
COM_AlphaOverMixedOperation.h:14
blender::compositor::AlphaOverMixedOperation::setX
void setX(float x)
Definition:
COM_AlphaOverMixedOperation.h:29
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:12
blender::compositor::AlphaOverPremultiplyOperation
Definition:
COM_AlphaOverPremultiplyOperation.h:14
blender::compositor::CompositorContext
Overall context of the compositor.
Definition:
COM_CompositorContext.h:19
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:77
blender::compositor::NodeConverter
Definition:
COM_NodeConverter.h:28
blender::compositor::NodeConverter::map_output_socket
void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
Definition:
COM_NodeConverter.cc:31
blender::compositor::NodeConverter::add_operation
void add_operation(NodeOperation *operation)
Definition:
COM_NodeConverter.cc:21
blender::compositor::NodeConverter::map_input_socket
void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket)
Definition:
COM_NodeConverter.cc:26
blender::compositor::NodeInput
NodeInput are sockets that can receive data/input.
Definition:
COM_Node.h:190
blender::compositor::NodeInput::is_linked
bool is_linked() const
Definition:
COM_Node.h:220
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:84
blender::compositor::Node::get_bnode
bNode * get_bnode() const
get the reference to the SDNA bNode struct
Definition:
COM_Node.h:64
blender::compositor::Node::get_input_socket
NodeInput * get_input_socket(unsigned int index) const
Definition:
COM_Node.cc:89
blender::compositor
Definition:
COM_defines.h:10
NodeTwoFloats
Definition:
DNA_node_types.h:819
NodeTwoFloats::x
float x
Definition:
DNA_node_types.h:820
bNode
Definition:
DNA_node_types.h:252
bNode::custom1
short custom1
Definition:
DNA_node_types.h:308
bNode::storage
void * storage
Definition:
DNA_node_types.h:283
Generated on Sat Jul 27 2024 14:57:55 for Blender by
doxygen
1.9.1