Blender  V3.3
node_composite_blur.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 /* **************** BLUR ******************** */
16 
18 
20 {
21  b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
22  b.add_input<decl::Float>(N_("Size")).default_value(1.0f).min(0.0f).max(1.0f);
23  b.add_output<decl::Color>(N_("Image"));
24 }
25 
27 {
28  NodeBlurData *data = MEM_cnew<NodeBlurData>(__func__);
29  data->filtertype = R_FILTER_GAUSS;
30  node->storage = data;
31 }
32 
34 {
35  uiLayout *col, *row;
36 
37  col = uiLayoutColumn(layout, false);
38  const int filter = RNA_enum_get(ptr, "filter_type");
39  const int reference = RNA_boolean_get(ptr, "use_variable_size");
40 
41  uiItemR(col, ptr, "filter_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
42  if (filter != R_FILTER_FAST_GAUSS) {
43  uiItemR(col, ptr, "use_variable_size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
44  if (!reference) {
45  uiItemR(col, ptr, "use_bokeh", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
46  }
47  uiItemR(col, ptr, "use_gamma_correction", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
48  }
49 
50  uiItemR(col, ptr, "use_relative", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
51 
52  if (RNA_boolean_get(ptr, "use_relative")) {
53  uiItemL(col, IFACE_("Aspect Correction"), ICON_NONE);
54  row = uiLayoutRow(layout, true);
55  uiItemR(row,
56  ptr,
57  "aspect_correction",
59  nullptr,
60  ICON_NONE);
61 
62  col = uiLayoutColumn(layout, true);
63  uiItemR(col, ptr, "factor_x", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("X"), ICON_NONE);
64  uiItemR(col, ptr, "factor_y", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Y"), ICON_NONE);
65  }
66  else {
67  col = uiLayoutColumn(layout, true);
68  uiItemR(col, ptr, "size_x", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("X"), ICON_NONE);
69  uiItemR(col, ptr, "size_y", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Y"), ICON_NONE);
70  }
71  uiItemR(col, ptr, "use_extended_bounds", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
72 }
73 
74 } // namespace blender::nodes::node_composite_blur_cc
75 
77 {
78  namespace file_ns = blender::nodes::node_composite_blur_cc;
79 
80  static bNodeType ntype;
81 
85  ntype.flag |= NODE_PREVIEW;
89 
90  nodeRegisterType(&ntype);
91 }
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_OP_FILTER
Definition: BKE_node.h:349
#define CMP_NODE_BLUR
Definition: BKE_node.h:1206
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define UNUSED(x)
#define IFACE_(msgid)
#define NODE_PREVIEW
#define R_FILTER_GAUSS
#define R_FILTER_FAST_GAUSS
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
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
OperationNode * node
bNodeTree * ntree
uint col
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
static void cmp_node_blur_declare(NodeDeclarationBuilder &b)
static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode *node)
static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_cmp_blur()
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
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
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