Blender  V3.3
node_composite_keying.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. All rights reserved. */
3 
8 #include "BLI_math_base.h"
9 
10 #include "BLT_translation.h"
11 
12 #include "DNA_movieclip_types.h"
13 
14 #include "UI_interface.h"
15 #include "UI_resources.h"
16 
17 #include "node_composite_util.hh"
18 
19 /* **************** Keying ******************** */
20 
22 
24 {
25  b.add_input<decl::Color>(N_("Image")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
26  b.add_input<decl::Color>(N_("Key Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
27  b.add_input<decl::Float>(N_("Garbage Matte")).hide_value();
28  b.add_input<decl::Float>(N_("Core Matte")).hide_value();
29  b.add_output<decl::Color>(N_("Image"));
30  b.add_output<decl::Float>(N_("Matte"));
31  b.add_output<decl::Float>(N_("Edges"));
32 }
33 
35 {
36  NodeKeyingData *data = MEM_cnew<NodeKeyingData>(__func__);
37 
38  data->screen_balance = 0.5f;
39  data->despill_balance = 0.5f;
40  data->despill_factor = 1.0f;
41  data->edge_kernel_radius = 3;
42  data->edge_kernel_tolerance = 0.1f;
43  data->clip_black = 0.0f;
44  data->clip_white = 1.0f;
45  node->storage = data;
46 }
47 
49 {
50  /* bNode *node = (bNode*)ptr->data; */ /* UNUSED */
51 
52  uiItemR(layout, ptr, "blur_pre", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
53  uiItemR(layout, ptr, "screen_balance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
54  uiItemR(layout, ptr, "despill_factor", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
55  uiItemR(layout, ptr, "despill_balance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
56  uiItemR(layout, ptr, "edge_kernel_radius", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
57  uiItemR(layout, ptr, "edge_kernel_tolerance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
58  uiItemR(layout, ptr, "clip_black", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
59  uiItemR(layout, ptr, "clip_white", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
60  uiItemR(layout, ptr, "dilate_distance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
61  uiItemR(layout, ptr, "feather_falloff", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
62  uiItemR(layout, ptr, "feather_distance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
63  uiItemR(layout, ptr, "blur_post", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
64 }
65 
66 } // namespace blender::nodes::node_composite_keying_cc
67 
69 {
70  namespace file_ns = blender::nodes::node_composite_keying_cc;
71 
72  static bNodeType ntype;
73 
79  &ntype, "NodeKeyingData", node_free_standard_storage, node_copy_standard_storage);
80 
81  nodeRegisterType(&ntype);
82 }
#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
#define CMP_NODE_KEYING
Definition: BKE_node.h:1266
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define UNUSED(x)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
OperationNode * node
bNodeTree * ntree
static void node_composit_buts_keying(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode *node)
static void cmp_node_keying_declare(NodeDeclarationBuilder &b)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_cmp_keying()
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
Defines a node type.
Definition: BKE_node.h:226
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