Blender V5.0
node_texture_combine_color.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BLI_math_color.h"
10#include "node_texture_util.hh"
11#include "node_util.hh"
12
14 {SOCK_FLOAT, N_("Red"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
15 {SOCK_FLOAT, N_("Green"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
16 {SOCK_FLOAT, N_("Blue"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
17 {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
18 {-1, ""},
19};
21 {SOCK_RGBA, N_("Color")},
22 {-1, ""},
23};
24
25static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
26{
27 int i;
28 for (i = 0; i < 4; i++) {
29 out[i] = tex_input_value(in[i], p, thread);
30 }
31 /* Apply color space if required. */
32 switch (node->custom1) {
34 /* Pass */
35 break;
36 }
39 break;
40 }
43 break;
44 }
45 default: {
47 break;
48 }
49 }
50}
51
52static void update(bNodeTree * /*ntree*/, bNode *node)
53{
55}
56
57static void exec(void *data,
58 int /*thread*/,
59 bNode *node,
60 bNodeExecData *execdata,
61 bNodeStack **in,
63{
64 tex_output(node, execdata, in, out[0], &colorfn, static_cast<TexCallData *>(data));
65}
66
68{
69 static blender::bke::bNodeType ntype;
70
71 tex_node_type_base(&ntype, "TextureNodeCombineColor", TEX_NODE_COMBINE_COLOR);
72 ntype.ui_name = "Combine Color";
73 ntype.enum_name_legacy = "COMBINE_COLOR";
76 ntype.exec_fn = exec;
77 ntype.updatefunc = update;
78
80}
#define NODE_CLASS_OP_COLOR
Definition BKE_node.hh:449
#define TEX_NODE_COMBINE_COLOR
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
Definition math_color.cc:57
void hsl_to_rgb_v(const float hsl[3], float r_rgb[3])
Definition math_color.cc:62
@ SOCK_FLOAT
@ SOCK_RGBA
NodeCombSepColorMode
@ NODE_COMBSEP_COLOR_RGB
@ NODE_COMBSEP_COLOR_HSV
@ NODE_COMBSEP_COLOR_HSL
@ PROP_FACTOR
Definition RNA_types.hh:251
BMesh const char void * data
#define in
#define out
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
void node_type_socket_templates(bNodeType *ntype, bNodeSocketTemplate *inputs, bNodeSocketTemplate *outputs)
Definition node.cc:5352
static void update(bNodeTree *ntree)
static blender::bke::bNodeSocketTemplate outputs[]
static void colorfn(float *out, TexParams *p, bNode *, bNodeStack **in, short thread)
static void exec(void *data, int, bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
static blender::bke::bNodeSocketTemplate inputs[]
static void update(bNodeTree *, bNode *node)
static void exec(void *data, int, bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
void register_node_type_tex_combine_color()
static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
void tex_output(bNode *node, bNodeExecData *, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata)
float tex_input_value(bNodeStack *in, TexParams *params, short thread)
void tex_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
void node_combsep_color_label(const ListBase *sockets, NodeCombSepColorMode mode)
Definition node_util.cc:227
int16_t custom1
ListBase inputs
Compact definition of a node socket.
Definition BKE_node.hh:99
Defines a node type.
Definition BKE_node.hh:238
NodeExecFunction exec_fn
Definition BKE_node.hh:340
const char * enum_name_legacy
Definition BKE_node.hh:247
void(* updatefunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:281
i
Definition text_draw.cc:230
#define N_(msgid)