Blender  V3.3
node_composite_channel_matte.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2006 Blender Foundation. All rights reserved. */
3 
8 #include "RNA_access.h"
9 
10 #include "UI_interface.h"
11 #include "UI_resources.h"
12 
13 #include "node_composite_util.hh"
14 
15 /* ******************* Channel Matte Node ********************************* */
16 
18 
20 {
21  b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
22  b.add_output<decl::Color>(N_("Image"));
23  b.add_output<decl::Float>(N_("Matte"));
24 }
25 
27 {
28  NodeChroma *c = MEM_cnew<NodeChroma>(__func__);
29  node->storage = c;
30  c->t1 = 1.0f;
31  c->t2 = 0.0f;
32  c->t3 = 0.0f;
33  c->fsize = 0.0f;
34  c->fstrength = 0.0f;
35  c->algorithm = 1; /* Max channel limiting. */
36  c->channel = 1; /* Limit by red. */
37  node->custom1 = 1; /* RGB channel. */
38  node->custom2 = 2; /* Green Channel. */
39 }
40 
42  bContext *UNUSED(C),
43  PointerRNA *ptr)
44 {
45  uiLayout *col, *row;
46 
47  uiItemL(layout, IFACE_("Color Space:"), ICON_NONE);
48  row = uiLayoutRow(layout, false);
49  uiItemR(
50  row, ptr, "color_space", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
51 
52  col = uiLayoutColumn(layout, false);
53  uiItemL(col, IFACE_("Key Channel:"), ICON_NONE);
54  row = uiLayoutRow(col, false);
55  uiItemR(row,
56  ptr,
57  "matte_channel",
59  nullptr,
60  ICON_NONE);
61 
62  col = uiLayoutColumn(layout, false);
63 
64  uiItemR(col, ptr, "limit_method", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
65  if (RNA_enum_get(ptr, "limit_method") == 0) {
66  uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE);
67  row = uiLayoutRow(col, false);
68  uiItemR(row,
69  ptr,
70  "limit_channel",
72  nullptr,
73  ICON_NONE);
74  }
75 
76  uiItemR(
77  col, ptr, "limit_max", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
78  uiItemR(
79  col, ptr, "limit_min", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
80 }
81 
82 } // namespace blender::nodes::node_composite_channel_matte_cc
83 
85 {
87 
88  static bNodeType ntype;
89 
93  ntype.flag |= NODE_PREVIEW;
96 
97  nodeRegisterType(&ntype);
98 }
#define NODE_CLASS_MATTE
Definition: BKE_node.h:352
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
Definition: node.cc:4390
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
Definition: node.cc:4426
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define CMP_NODE_CHANNEL_MATTE
Definition: BKE_node.h:1233
#define UNUSED(x)
#define IFACE_(msgid)
#define NODE_PREVIEW
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemL(uiLayout *layout, const char *name, int icon)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
@ UI_ITEM_R_EXPAND
@ UI_ITEM_R_SLIDER
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
OperationNode * node
bNodeTree * ntree
uint col
static unsigned c
Definition: RandGen.cpp:83
static void cmp_node_channel_matte_declare(NodeDeclarationBuilder &b)
static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *node)
static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_cmp_channel_matte()
void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
void node_copy_standard_storage(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
Definition: node_util.c:55
void node_free_standard_storage(bNode *node)
Definition: node_util.c:43
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
Defines a node type.
Definition: BKE_node.h:226
short flag
Definition: BKE_node.h:236
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:244
NodeDeclareFunction declare
Definition: BKE_node.h:324
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480