Blender
V4.5
source
blender
nodes
composite
nodes
node_composite_sepcomb_rgba.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2006 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
9
#include "
BLI_math_vector_types.hh
"
10
11
#include "
FN_multi_function_builder.hh
"
12
13
#include "
NOD_multi_function.hh
"
14
15
#include "
GPU_material.hh
"
16
17
#include "
node_composite_util.hh
"
18
19
/* **************** SEPARATE RGBA ******************** */
20
21
namespace
blender::nodes::node_composite_separate_rgba_cc
{
22
23
static
void
cmp_node_seprgba_declare
(
NodeDeclarationBuilder
&
b
)
24
{
25
b
.add_input<
decl::Color
>(
"Image"
)
26
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
27
.compositor_domain_priority(0);
28
b
.add_output<
decl::Float
>(
"R"
).translation_context(
BLT_I18NCONTEXT_COLOR
);
29
b
.add_output<
decl::Float
>(
"G"
).translation_context(
BLT_I18NCONTEXT_COLOR
);
30
b
.add_output<
decl::Float
>(
"B"
).translation_context(
BLT_I18NCONTEXT_COLOR
);
31
b
.add_output<
decl::Float
>(
"A"
).translation_context(
BLT_I18NCONTEXT_COLOR
);
32
}
33
34
using namespace
blender::compositor
;
35
36
static
int
node_gpu_material
(
GPUMaterial
*
material
,
37
bNode
*
node
,
38
bNodeExecData
*
/*execdata*/
,
39
GPUNodeStack
*
inputs
,
40
GPUNodeStack
*
outputs
)
41
{
42
return
GPU_stack_link
(
material
,
node
,
"node_composite_separate_rgba"
,
inputs
,
outputs
);
43
}
44
45
static
void
node_build_multi_function
(
blender::nodes::NodeMultiFunctionBuilder
&builder)
46
{
47
static
auto
function = mf::build::SI1_SO4<float4, float, float, float, float>(
48
"Separate Color RGBA"
,
49
[](
const
float4
&color,
float
&r,
float
&g,
float
&
b
,
float
&a) ->
void
{
50
r = color.x;
51
g = color.y;
52
b
= color.z;
53
a = color.w;
54
},
55
mf::build::exec_presets::AllSpanOrSingle());
56
builder.
set_matching_fn
(function);
57
}
58
59
}
// namespace blender::nodes::node_composite_separate_rgba_cc
60
61
static
void
register_node_type_cmp_seprgba
()
62
{
63
namespace
file_ns =
blender::nodes::node_composite_separate_rgba_cc
;
64
65
static
blender::bke::bNodeType
ntype;
66
67
cmp_node_type_base
(&ntype,
"CompositorNodeSepRGBA"
,
CMP_NODE_SEPRGBA_LEGACY
);
68
ntype.
ui_name
=
"Separate RGBA (Legacy)"
;
69
ntype.
ui_description
=
"Deprecated"
;
70
ntype.
enum_name_legacy
=
"SEPRGBA"
;
71
ntype.
nclass
=
NODE_CLASS_CONVERTER
;
72
ntype.
declare
= file_ns::cmp_node_seprgba_declare;
73
ntype.
gather_link_search_ops
=
nullptr
;
74
ntype.
gpu_fn
= file_ns::node_gpu_material;
75
ntype.
build_multi_function
= file_ns::node_build_multi_function;
76
77
blender::bke::node_register_type
(ntype);
78
}
79
NOD_REGISTER_NODE
(
register_node_type_cmp_seprgba
)
80
81
/* **************** COMBINE RGBA ******************** */
82
83
namespace
blender
::nodes::node_composite_combine_rgba_cc {
84
85
static
void
cmp_node_combrgba_declare
(
NodeDeclarationBuilder
&
b
)
86
{
87
b
.add_input<
decl::Float
>(
"R"
)
88
.
min
(0.0f)
89
.max(1.0f)
90
.
compositor_domain_priority
(0)
91
.translation_context(
BLT_I18NCONTEXT_COLOR
);
92
b
.add_input<
decl::Float
>(
"G"
)
93
.
min
(0.0f)
94
.max(1.0f)
95
.
compositor_domain_priority
(1)
96
.translation_context(
BLT_I18NCONTEXT_COLOR
);
97
b
.add_input<
decl::Float
>(
"B"
)
98
.
min
(0.0f)
99
.max(1.0f)
100
.
compositor_domain_priority
(2)
101
.translation_context(
BLT_I18NCONTEXT_COLOR
);
102
b
.add_input<
decl::Float
>(
"A"
)
103
.default_value(1.0f)
104
.min(0.0f)
105
.max(1.0f)
106
.
compositor_domain_priority
(3)
107
.translation_context(
BLT_I18NCONTEXT_COLOR
);
108
b
.add_output<
decl::Color
>(
"Image"
);
109
}
110
111
using namespace
blender::compositor
;
112
113
static
int
node_gpu_material(
GPUMaterial
*
material
,
114
bNode
*
node
,
115
bNodeExecData
*
/*execdata*/
,
116
GPUNodeStack
*
inputs
,
117
GPUNodeStack
*
outputs
)
118
{
119
return
GPU_stack_link
(
material
,
node
,
"node_composite_combine_rgba"
,
inputs
,
outputs
);
120
}
121
122
static
void
node_build_multi_function(
blender::nodes::NodeMultiFunctionBuilder
&builder)
123
{
124
static
auto
function = mf::build::SI4_SO<float, float, float, float, float4>(
125
"Combine Color RGBA"
,
126
[](
const
float
r,
const
float
g,
const
float
b
,
const
float
a) ->
float4
{
127
return
float4
(r, g,
b
, a);
128
},
129
mf::build::exec_presets::Materialized());
130
builder.
set_matching_fn
(function);
131
}
132
133
}
// namespace blender::nodes::node_composite_combine_rgba_cc
134
135
static
void
register_node_type_cmp_combrgba
()
136
{
137
namespace
file_ns =
blender::nodes::node_composite_combine_rgba_cc
;
138
139
static
blender::bke::bNodeType
ntype;
140
141
cmp_node_type_base
(&ntype,
"CompositorNodeCombRGBA"
,
CMP_NODE_COMBRGBA_LEGACY
);
142
ntype.
ui_name
=
"Combine RGBA (Legacy)"
;
143
ntype.
ui_description
=
"Deprecated"
;
144
ntype.
enum_name_legacy
=
"COMBRGBA"
;
145
ntype.
nclass
=
NODE_CLASS_CONVERTER
;
146
ntype.
declare
= file_ns::cmp_node_combrgba_declare;
147
ntype.
gather_link_search_ops
=
nullptr
;
148
ntype.
gpu_fn
= file_ns::node_gpu_material;
149
ntype.
build_multi_function
= file_ns::node_build_multi_function;
150
151
blender::bke::node_register_type
(ntype);
152
}
153
NOD_REGISTER_NODE
(
register_node_type_cmp_combrgba
)
NODE_CLASS_CONVERTER
#define NODE_CLASS_CONVERTER
Definition
BKE_node.hh:439
CMP_NODE_SEPRGBA_LEGACY
#define CMP_NODE_SEPRGBA_LEGACY
Definition
BKE_node_legacy_types.hh:164
CMP_NODE_COMBRGBA_LEGACY
#define CMP_NODE_COMBRGBA_LEGACY
Definition
BKE_node_legacy_types.hh:175
BLI_math_vector_types.hh
BLT_I18NCONTEXT_COLOR
#define BLT_I18NCONTEXT_COLOR
Definition
BLT_translation.hh:147
FN_multi_function_builder.hh
GPU_material.hh
GPU_stack_link
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
Definition
gpu_node_graph.cc:825
NOD_multi_function.hh
NOD_REGISTER_NODE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
Definition
NOD_register.hh:34
blender::nodes::NodeDeclarationBuilder
Definition
NOD_node_declaration.hh:629
blender::nodes::NodeMultiFunctionBuilder
Definition
NOD_multi_function.hh:18
blender::nodes::NodeMultiFunctionBuilder::set_matching_fn
void set_matching_fn(const mf::MultiFunction *fn)
Definition
NOD_multi_function.hh:99
blender::nodes::SocketDeclaration::compositor_domain_priority
int compositor_domain_priority() const
Definition
node_declaration.cc:877
blender::nodes::decl::Color
Definition
NOD_socket_declarations.hh:133
blender::nodes::decl::Float
Definition
NOD_socket_declarations.hh:19
b
b
Definition
compositor_morphological_distance_info.hh:24
node
OperationNode * node
Definition
deg_builder_cycle.cc:38
material
Material material
Definition
deg_eval_copy_on_write.cc:96
float4
VecBase< float, 4 > float4
Definition
gpu_glsl_cpp_stubs.hh:365
blender::bke::node_register_type
void node_register_type(bNodeType &ntype)
Definition
node.cc:2748
blender::compositor
Definition
BKE_node.hh:76
blender::nodes::node_composite_combine_rgba_cc
Definition
node_composite_sepcomb_rgba.cc:83
blender::nodes::node_composite_combine_rgba_cc::cmp_node_combrgba_declare
static void cmp_node_combrgba_declare(NodeDeclarationBuilder &b)
Definition
node_composite_sepcomb_rgba.cc:85
blender::nodes::node_composite_separate_rgba_cc
Definition
node_composite_sepcomb_rgba.cc:21
blender::nodes::node_composite_separate_rgba_cc::node_gpu_material
static int node_gpu_material(GPUMaterial *material, bNode *node, bNodeExecData *, GPUNodeStack *inputs, GPUNodeStack *outputs)
Definition
node_composite_sepcomb_rgba.cc:36
blender::nodes::node_composite_separate_rgba_cc::cmp_node_seprgba_declare
static void cmp_node_seprgba_declare(NodeDeclarationBuilder &b)
Definition
node_composite_sepcomb_rgba.cc:23
blender::nodes::node_composite_separate_rgba_cc::node_build_multi_function
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
Definition
node_composite_sepcomb_rgba.cc:45
blender
Definition
ANIM_action.hh:36
register_node_type_cmp_combrgba
static void register_node_type_cmp_combrgba()
Definition
node_composite_sepcomb_rgba.cc:135
register_node_type_cmp_seprgba
static void register_node_type_cmp_seprgba()
Definition
node_composite_sepcomb_rgba.cc:61
cmp_node_type_base
void cmp_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
Definition
node_composite_util.cc:33
node_composite_util.hh
outputs
static blender::bke::bNodeSocketTemplate outputs[]
Definition
node_texture_at.cc:16
inputs
static blender::bke::bNodeSocketTemplate inputs[]
Definition
node_texture_at.cc:11
min
#define min(a, b)
Definition
sort.cc:36
GPUMaterial
Definition
gpu/intern/gpu_material.cc:60
GPUNodeStack
Definition
GPU_material.hh:272
bNodeExecData
Definition
node_util.hh:19
bNode
Definition
DNA_node_types.h:415
blender::VecBase< float, 4 >
blender::bke::bNodeType
Defines a node type.
Definition
BKE_node.hh:226
blender::bke::bNodeType::ui_description
std::string ui_description
Definition
BKE_node.hh:232
blender::bke::bNodeType::ui_name
std::string ui_name
Definition
BKE_node.hh:231
blender::bke::bNodeType::gpu_fn
NodeGPUExecFunction gpu_fn
Definition
BKE_node.hh:330
blender::bke::bNodeType::build_multi_function
NodeMultiFunctionBuildFunction build_multi_function
Definition
BKE_node.hh:344
blender::bke::bNodeType::nclass
short nclass
Definition
BKE_node.hh:239
blender::bke::bNodeType::enum_name_legacy
const char * enum_name_legacy
Definition
BKE_node.hh:235
blender::bke::bNodeType::gather_link_search_ops
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition
BKE_node.hh:371
blender::bke::bNodeType::declare
NodeDeclareFunction declare
Definition
BKE_node.hh:355
Generated on Fri Apr 3 2026 06:33:18 for Blender by
doxygen
1.11.0