Blender  V3.3
node_composite_mask.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2012 Blender Foundation. All rights reserved. */
3 
8 #include "DNA_mask_types.h"
9 
10 #include "UI_interface.h"
11 #include "UI_resources.h"
12 
13 #include "node_composite_util.hh"
14 
15 /* **************** Mask ******************** */
16 
18 
20 {
21  b.add_output<decl::Float>(N_("Mask"));
22 }
23 
25 {
26  NodeMask *data = MEM_cnew<NodeMask>(__func__);
27  data->size_x = data->size_y = 256;
28  node->storage = data;
29 
30  node->custom2 = 16; /* samples */
31  node->custom3 = 0.5f; /* shutter */
32 }
33 
34 static void node_mask_label(const bNodeTree *UNUSED(ntree),
35  const bNode *node,
36  char *label,
37  int maxlen)
38 {
39  if (node->id != nullptr) {
40  BLI_strncpy(label, node->id->name + 2, maxlen);
41  }
42  else {
43  BLI_strncpy(label, IFACE_("Mask"), maxlen);
44  }
45 }
46 
48 {
49  bNode *node = (bNode *)ptr->data;
50 
51  uiTemplateID(layout,
52  C,
53  ptr,
54  "mask",
55  nullptr,
56  nullptr,
57  nullptr,
59  false,
60  nullptr);
61  uiItemR(layout, ptr, "use_feather", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
62 
63  uiItemR(layout, ptr, "size_source", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
64 
66  uiItemR(layout, ptr, "size_x", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
67  uiItemR(layout, ptr, "size_y", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
68  }
69 
70  uiItemR(layout, ptr, "use_motion_blur", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
71  if (node->custom1 & CMP_NODEFLAG_MASK_MOTION_BLUR) {
72  uiItemR(layout, ptr, "motion_blur_samples", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
73  uiItemR(layout, ptr, "motion_blur_shutter", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
74  }
75 }
76 
77 } // namespace blender::nodes::node_composite_mask_cc
78 
80 {
81  namespace file_ns = blender::nodes::node_composite_mask_cc;
82 
83  static bNodeType ntype;
84 
90 
92 
93  nodeRegisterType(&ntype);
94 }
#define CMP_NODE_MASK
Definition: BKE_node.h:1264
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 NODE_CLASS_INPUT
Definition: BKE_node.h:345
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
#define UNUSED(x)
#define IFACE_(msgid)
@ CMP_NODEFLAG_MASK_FIXED_SCENE
@ CMP_NODEFLAG_MASK_FIXED
@ CMP_NODEFLAG_MASK_MOTION_BLUR
#define C
Definition: RandGen.cpp:25
@ UI_ITEM_R_SPLIT_EMPTY_NAME
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiTemplateID(uiLayout *layout, const struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter, bool live_icon, const char *text)
@ UI_TEMPLATE_ID_FILTER_ALL
OperationNode * node
const char * label
bNodeTree * ntree
static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *ptr)
static void cmp_node_mask_declare(NodeDeclarationBuilder &b)
static void node_composit_init_mask(bNodeTree *UNUSED(ntree), bNode *node)
static void node_mask_label(const bNodeTree *UNUSED(ntree), const bNode *node, char *label, int maxlen)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_cmp_mask()
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
void * data
Definition: RNA_types.h:38
Defines a node type.
Definition: BKE_node.h:226
void(* labelfunc)(const struct bNodeTree *ntree, const struct bNode *node, char *label, int maxlen)
Definition: BKE_node.h:256
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