Blender V4.3
node_composite_premulkey.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 "UI_interface.hh"
10#include "UI_resources.hh"
11
12#include "GPU_material.hh"
13
14#include "COM_shader_node.hh"
15
17
18/* **************** Pre-multiply and Key Alpha Convert ******************** */
19
21
23{
24 b.add_input<decl::Color>("Image")
25 .default_value({1.0f, 1.0f, 1.0f, 1.0f})
26 .compositor_domain_priority(0);
27 b.add_output<decl::Color>("Image");
28}
29
31{
32 uiItemR(layout, ptr, "mapping", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
33}
34
35using namespace blender::realtime_compositor;
36
38 public:
40
41 void compile(GPUMaterial *material) override
42 {
45
46 if (get_mode() == 0) {
47 GPU_stack_link(material, &bnode(), "color_alpha_premultiply", inputs, outputs);
48 return;
49 }
50
51 GPU_stack_link(material, &bnode(), "color_alpha_unpremultiply", inputs, outputs);
52 }
53
58};
59
61{
62 return new AlphaConvertShaderNode(node);
63}
64
65} // namespace blender::nodes::node_composite_premulkey_cc
66
68{
70
71 static blender::bke::bNodeType ntype;
72
73 cmp_node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTER);
74 ntype.declare = file_ns::cmp_node_premulkey_declare;
75 ntype.draw_buttons = file_ns::node_composit_buts_premulkey;
76 ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
77
79}
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:410
CMPNodeAlphaConvertMode
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
local_group_size(16, 16) .push_constant(Type b
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static ShaderNode * get_compositor_shader_node(DNode node)
static void cmp_node_premulkey_declare(NodeDeclarationBuilder &b)
static void node_composit_buts_premulkey(uiLayout *layout, bContext *, PointerRNA *ptr)
void register_node_type_cmp_premulkey()
void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
int16_t custom1
Defines a node type.
Definition BKE_node.hh:218
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:238
NodeDeclareFunction declare
Definition BKE_node.hh:347
NodeGetCompositorShaderNodeFunction get_compositor_shader_node
Definition BKE_node.hh:328
PointerRNA * ptr
Definition wm_files.cc:4126