Blender  V3.3
node_composite_dilate.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 /* **************** Dilate/Erode ******************** */
16 
18 
20 {
21  b.add_input<decl::Float>(N_("Mask")).default_value(0.0f).min(0.0f).max(1.0f);
22  b.add_output<decl::Float>(N_("Mask"));
23 }
24 
26 {
27  NodeDilateErode *data = MEM_cnew<NodeDilateErode>(__func__);
28  data->falloff = PROP_SMOOTH;
29  node->storage = data;
30 }
31 
33 {
34  uiItemR(layout, ptr, "mode", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
35  uiItemR(layout, ptr, "distance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
36  switch (RNA_enum_get(ptr, "mode")) {
38  uiItemR(layout, ptr, "edge", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
39  break;
41  uiItemR(layout, ptr, "falloff", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
42  break;
43  }
44 }
45 
46 } // namespace blender::nodes::node_composite_dilate_cc
47 
49 {
50  namespace file_ns = blender::nodes::node_composite_dilate_cc;
51 
52  static bNodeType ntype;
53 
59  &ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage);
60 
61  nodeRegisterType(&ntype);
62 }
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
Definition: node.cc:4390
#define CMP_NODE_DILATEERODE
Definition: BKE_node.h:1223
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 NODE_CLASS_OP_FILTER
Definition: BKE_node.h:349
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define UNUSED(x)
@ CMP_NODE_DILATEERODE_DISTANCE_THRESH
@ CMP_NODE_DILATEERODE_DISTANCE_FEATHER
#define PROP_SMOOTH
@ 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 cmp_node_dilate_declare(NodeDeclarationBuilder &b)
static void node_composit_init_dilateerode(bNodeTree *UNUSED(ntree), bNode *node)
static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_cmp_dilateerode()
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
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