diff options
author | Siddhartha Jejurkar <f20180617@goa.bits-pilani.ac.in> | 2021-12-17 16:01:32 +0300 |
---|---|---|
committer | Siddhartha Jejurkar <f20180617@goa.bits-pilani.ac.in> | 2021-12-17 16:01:32 +0300 |
commit | dbc41b30f88b96f7d8c6e995b17f5930eb55cc77 (patch) | |
tree | c6c495328443ea3621e5df2ef483b0e0dd504496 /source/blender/nodes/composite/nodes/node_composite_keying.cc | |
parent | 99a2af76d10e05a18987be5d554ada197b1ca086 (diff) | |
parent | 7c9e4099854a4fc8eab4db97173c1aacd25f9e08 (diff) |
Merge branch 'master' into soc-2021-uv-edge-select-supportsoc-2021-uv-edge-select-support
Diffstat (limited to 'source/blender/nodes/composite/nodes/node_composite_keying.cc')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_keying.cc | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.cc b/source/blender/nodes/composite/nodes/node_composite_keying.cc index d5547161069..de1da3289f9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keying.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keying.cc @@ -21,30 +21,33 @@ * \ingroup cmpnodes */ +#include "BLI_math_base.h" + #include "BLT_translation.h" #include "DNA_movieclip_types.h" -#include "BLI_math_base.h" +#include "UI_interface.h" +#include "UI_resources.h" #include "node_composite_util.hh" -/* **************** Translate ******************** */ +/* **************** Keying ******************** */ -static bNodeSocketTemplate cmp_node_keying_in[] = { - {SOCK_RGBA, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_RGBA, "Key Color", 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, "Garbage Matte", 0.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, "Core Matte", 0.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_keying_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Color>(N_("Key Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Garbage Matte")).hide_value(); + b.add_input<decl::Float>(N_("Core Matte")).hide_value(); + b.add_output<decl::Color>(N_("Image")); + b.add_output<decl::Float>(N_("Matte")); + b.add_output<decl::Float>(N_("Edges")); +} -static bNodeSocketTemplate cmp_node_keying_out[] = { - {SOCK_RGBA, "Image"}, - {SOCK_FLOAT, "Matte"}, - {SOCK_FLOAT, "Edges"}, - {-1, ""}, -}; +} // namespace blender::nodes static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode *node) { @@ -60,12 +63,31 @@ static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode *node) node->storage = data; } -void register_node_type_cmp_keying(void) +static void node_composit_buts_keying(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + /* bNode *node = (bNode*)ptr->data; */ /* UNUSED */ + + uiItemR(layout, ptr, "blur_pre", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "screen_balance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "despill_factor", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "despill_balance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "edge_kernel_radius", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "edge_kernel_tolerance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "clip_black", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "clip_white", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "dilate_distance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "feather_falloff", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "feather_distance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "blur_post", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + +void register_node_type_cmp_keying() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, cmp_node_keying_in, cmp_node_keying_out); + ntype.declare = blender::nodes::cmp_node_keying_declare; + ntype.draw_buttons = node_composit_buts_keying; node_type_init(&ntype, node_composit_init_keying); node_type_storage( &ntype, "NodeKeyingData", node_free_standard_storage, node_copy_standard_storage); |