Blender  V3.3
node_composite_glare.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 
16 
18 {
19  b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
20  b.add_output<decl::Color>(N_("Image"));
21 }
22 
24 {
25  NodeGlare *ndg = MEM_cnew<NodeGlare>(__func__);
26  ndg->quality = 1;
27  ndg->type = 2;
28  ndg->iter = 3;
29  ndg->colmod = 0.25;
30  ndg->mix = 0;
31  ndg->threshold = 1;
32  ndg->star_45 = true;
33  ndg->streaks = 4;
34  ndg->angle_ofs = 0.0f;
35  ndg->fade = 0.9;
36  ndg->size = 8;
37  node->storage = ndg;
38 }
39 
41 {
42  uiItemR(layout, ptr, "glare_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
43  uiItemR(layout, ptr, "quality", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
44 
45  if (RNA_enum_get(ptr, "glare_type") != 1) {
46  uiItemR(layout, ptr, "iterations", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
47 
48  if (RNA_enum_get(ptr, "glare_type") != 0) {
49  uiItemR(layout,
50  ptr,
51  "color_modulation",
53  nullptr,
54  ICON_NONE);
55  }
56  }
57 
58  uiItemR(layout, ptr, "mix", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
59  uiItemR(layout, ptr, "threshold", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
60 
61  if (RNA_enum_get(ptr, "glare_type") == 2) {
62  uiItemR(layout, ptr, "streaks", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
63  uiItemR(layout, ptr, "angle_offset", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
64  }
65  if (RNA_enum_get(ptr, "glare_type") == 0 || RNA_enum_get(ptr, "glare_type") == 2) {
66  uiItemR(
67  layout, ptr, "fade", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
68 
69  if (RNA_enum_get(ptr, "glare_type") == 0) {
70  uiItemR(layout, ptr, "use_rotate_45", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
71  }
72  }
73  if (RNA_enum_get(ptr, "glare_type") == 1) {
74  uiItemR(layout, ptr, "size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
75  }
76 }
77 
78 } // namespace blender::nodes::node_composite_glare_cc
79 
81 {
82  namespace file_ns = blender::nodes::node_composite_glare_cc;
83 
84  static bNodeType ntype;
85 
91 
92  nodeRegisterType(&ntype);
93 }
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
Definition: node.cc:4390
#define CMP_NODE_GLARE
Definition: BKE_node.h:1272
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)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
@ UI_ITEM_R_SLIDER
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_glare_declare(NodeDeclarationBuilder &b)
static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode *node)
static void node_composit_buts_glare(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_cmp_glare()
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
char angle size
float angle_ofs
char angle streaks
float threshold
char angle star_45
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