Blender  V3.3
node_texture_viewer.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2005 Blender Foundation. All rights reserved. */
3 
8 #include "NOD_texture.h"
9 #include "node_texture_util.h"
10 #include <math.h>
11 
13  {SOCK_RGBA, N_("Color"), 1.0f, 0.0f, 0.0f, 1.0f},
14  {-1, ""},
15 };
16 
17 static void exec(void *data,
18  int UNUSED(thread),
19  bNode *UNUSED(node),
20  bNodeExecData *UNUSED(execdata),
21  bNodeStack **in,
23 {
24  TexCallData *cdata = (TexCallData *)data;
25 
26  if (cdata->do_preview) {
28  float col[4];
29  params_from_cdata(&params, cdata);
30 
31  tex_input_rgba(col, in[0], &params, cdata->thread);
32  }
33 }
34 
36 {
37  static bNodeType ntype;
38 
41  node_type_exec(&ntype, NULL, NULL, exec);
42 
43  ntype.no_muting = true;
44  ntype.flag |= NODE_PREVIEW;
45 
46  nodeRegisterType(&ntype);
47 }
#define NODE_CLASS_OUTPUT
Definition: BKE_node.h:346
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
Definition: node.cc:4358
#define TEX_NODE_VIEWER
Definition: BKE_node.h:1361
void node_type_exec(struct bNodeType *ntype, NodeInitExecFunction init_exec_fn, NodeFreeExecFunction free_exec_fn, NodeExecFunction exec_fn)
Definition: node.cc:4455
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define UNUSED(x)
#define NODE_PREVIEW
@ SOCK_RGBA
Definition: thread.h:34
OperationNode * node
uint col
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread)
void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass)
void params_from_cdata(TexParams *out, TexCallData *in)
static void exec(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **UNUSED(out))
void register_node_type_tex_viewer(void)
static bNodeSocketTemplate inputs[]
Compact definition of a node socket.
Definition: BKE_node.h:84
Defines a node type.
Definition: BKE_node.h:226
short flag
Definition: BKE_node.h:236
bool no_muting
Definition: BKE_node.h:338
#define N_(msgid)