Blender
V2.93
source
blender
compositor
nodes
COM_AlphaOverNode.cc
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or
3
* modify it under the terms of the GNU General Public License
4
* as published by the Free Software Foundation; either version 2
5
* of the License, or (at your option) any later version.
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software Foundation,
14
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15
*
16
* Copyright 2011, Blender Foundation.
17
*/
18
19
#include "
COM_AlphaOverNode.h
"
20
21
#include "
COM_AlphaOverKeyOperation.h
"
22
#include "
COM_AlphaOverMixedOperation.h
"
23
#include "
COM_AlphaOverPremultiplyOperation.h
"
24
#include "
COM_MixOperation.h
"
25
26
#include "
COM_SetValueOperation.h
"
27
#include "
DNA_material_types.h
"
/* the ramp types */
28
29
namespace
blender::compositor
{
30
31
void
AlphaOverNode::convertToOperations
(
NodeConverter
&converter,
32
const
CompositorContext
&
/*context*/
)
const
33
{
34
NodeInput
*color1Socket = this->
getInputSocket
(1);
35
NodeInput
*color2Socket = this->
getInputSocket
(2);
36
bNode
*editorNode = this->
getbNode
();
37
38
MixBaseOperation
*convertProg;
39
NodeTwoFloats
*ntf = (
NodeTwoFloats
*)editorNode->
storage
;
40
if
(ntf->
x
!= 0.0f) {
41
AlphaOverMixedOperation
*mixOperation =
new
AlphaOverMixedOperation
();
42
mixOperation->
setX
(ntf->
x
);
43
convertProg = mixOperation;
44
}
45
else
if
(editorNode->
custom1
) {
46
convertProg =
new
AlphaOverKeyOperation
();
47
}
48
else
{
49
convertProg =
new
AlphaOverPremultiplyOperation
();
50
}
51
52
convertProg->
setUseValueAlphaMultiply
(
false
);
53
if
(color1Socket->
isLinked
()) {
54
convertProg->
setResolutionInputSocketIndex
(1);
55
}
56
else
if
(color2Socket->
isLinked
()) {
57
convertProg->
setResolutionInputSocketIndex
(2);
58
}
59
else
{
60
convertProg->
setResolutionInputSocketIndex
(0);
61
}
62
63
converter.
addOperation
(convertProg);
64
converter.
mapInputSocket
(
getInputSocket
(0), convertProg->
getInputSocket
(0));
65
converter.
mapInputSocket
(
getInputSocket
(1), convertProg->
getInputSocket
(1));
66
converter.
mapInputSocket
(
getInputSocket
(2), convertProg->
getInputSocket
(2));
67
converter.
mapOutputSocket
(
getOutputSocket
(0), convertProg->
getOutputSocket
(0));
68
}
69
70
}
// namespace blender::compositor
COM_AlphaOverKeyOperation.h
COM_AlphaOverMixedOperation.h
COM_AlphaOverNode.h
COM_AlphaOverPremultiplyOperation.h
COM_MixOperation.h
COM_SetValueOperation.h
DNA_material_types.h
if
if(data)
Definition:
bmesh_operator_api_inline.h:177
blender::compositor::AlphaOverKeyOperation
Definition:
COM_AlphaOverKeyOperation.h:29
blender::compositor::AlphaOverMixedOperation
Definition:
COM_AlphaOverMixedOperation.h:29
blender::compositor::AlphaOverMixedOperation::setX
void setX(float x)
Definition:
COM_AlphaOverMixedOperation.h:44
blender::compositor::AlphaOverNode::convertToOperations
void convertToOperations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
Definition:
COM_AlphaOverNode.cc:31
blender::compositor::AlphaOverPremultiplyOperation
Definition:
COM_AlphaOverPremultiplyOperation.h:29
blender::compositor::CompositorContext
Overall context of the compositor.
Definition:
COM_CompositorContext.h:37
blender::compositor::MixBaseOperation
Definition:
COM_MixOperation.h:30
blender::compositor::MixBaseOperation::setUseValueAlphaMultiply
void setUseValueAlphaMultiply(const bool value)
Definition:
COM_MixOperation.h:72
blender::compositor::NodeConverter
Definition:
COM_NodeConverter.h:43
blender::compositor::NodeConverter::mapInputSocket
void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket)
Definition:
COM_NodeConverter.cc:43
blender::compositor::NodeConverter::addOperation
void addOperation(NodeOperation *operation)
Definition:
COM_NodeConverter.cc:38
blender::compositor::NodeConverter::mapOutputSocket
void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
Definition:
COM_NodeConverter.cc:48
blender::compositor::NodeInput
NodeInput are sockets that can receive data/input.
Definition:
COM_Node.h:210
blender::compositor::NodeInput::isLinked
bool isLinked() const
Definition:
COM_Node.h:240
blender::compositor::NodeOperation::getInputSocket
NodeOperationInput * getInputSocket(unsigned int index)
Definition:
COM_NodeOperation.cc:47
blender::compositor::NodeOperation::setResolutionInputSocketIndex
void setResolutionInputSocketIndex(unsigned int index)
set the index of the input socket that will determine the resolution of this operation
Definition:
COM_NodeOperation.cc:97
blender::compositor::NodeOperation::getOutputSocket
NodeOperationOutput * getOutputSocket(unsigned int index=0)
Definition:
COM_NodeOperation.cc:42
blender::compositor::Node::getOutputSocket
NodeOutput * getOutputSocket(const unsigned int index=0) const
Definition:
COM_Node.cc:108
blender::compositor::Node::getbNode
bNode * getbNode() const
get the reference to the SDNA bNode struct
Definition:
COM_Node.h:82
blender::compositor::Node::getInputSocket
NodeInput * getInputSocket(const unsigned int index) const
Definition:
COM_Node.cc:113
blender::compositor
Definition:
COM_defines.h:21
NodeTwoFloats
Definition:
DNA_node_types.h:779
NodeTwoFloats::x
float x
Definition:
DNA_node_types.h:780
bNode
Definition:
DNA_node_types.h:212
bNode::custom1
short custom1
Definition:
DNA_node_types.h:269
bNode::storage
void * storage
Definition:
DNA_node_types.h:244
Generated on Tue Jan 31 2023 14:37:24 for Blender by
doxygen
1.9.1