Blender V5.3
node_shader_holdout.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2005 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "node_shader_util.hh"
10
11namespace blender {
12
14
16{
17 const bNodeTree *ntree = b.tree_or_null();
18 const bool is_gpu_internal = ntree && (ntree->flag & NTREE_IS_GPU_SHADER_INTERNAL);
19
20 b.add_input<decl::Float>("Weight"_ustr).available(is_gpu_internal);
21 b.add_output<decl::Shader>("Holdout"_ustr);
22}
23
25 bNode *node,
26 bNodeExecData * /*execdata*/,
29{
31 return GPU_stack_link(
32 mat, node, "node_holdout", in, out, GPU_kernel_globals(), GPU_shading_data());
33}
34
35} // namespace nodes::node_shader_holdout_cc
36
37/* node type definition */
39{
40 namespace file_ns = nodes::node_shader_holdout_cc;
41
42 static bke::bNodeType ntype;
43
44 sh_node_type_base(&ntype, "ShaderNodeHoldout"_ustr, SH_NODE_HOLDOUT);
45 ntype.ui_name = "Holdout";
46 ntype.ui_description =
47 "Create a \"hole\" in the image with zero alpha transparency, which is useful for "
48 "compositing.\nNote: the holdout shader can only create alpha when transparency is enabled "
49 "in the film settings";
50 ntype.enum_name_legacy = "HOLDOUT";
53 ntype.declare = file_ns::node_declare;
55 ntype.gpu_fn = file_ns::gpu_shader_rgb;
56
58}
59
60} // namespace blender
#define NODE_CLASS_SHADER
Definition BKE_node.hh:491
#define SH_NODE_HOLDOUT
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
static void node_declare(NodeDeclarationBuilder &b)
static int gpu_shader_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
BMesh Iterators.
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
void register_node_type_sh_holdout()
bool object_shader_nodes_poll(const bContext *C)
@ GPU_MATFLAG_HOLDOUT
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void search_link_ops_for_shader_bsdf_node(nodes::GatherLinkSearchOpParams &params)
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
GPUNodeLink * GPU_shading_data()
@ NTREE_IS_GPU_SHADER_INTERNAL
GPUNodeLink * GPU_kernel_globals()
eNodeTree_Flag flag
Defines a node type.
Definition BKE_node.hh:265
std::string ui_description
Definition BKE_node.hh:271
NodeGPUExecFunction gpu_fn
Definition BKE_node.hh:373
const char * enum_name_legacy
Definition BKE_node.hh:274
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition BKE_node.hh:409
NodeDeclareFunction declare
Definition BKE_node.hh:393
bool(*) add_ui_poll(const bContext *C)
Definition BKE_node.hh:341