Blender V4.3
node_geo_gizmo_linear.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
7#include "NOD_rna_define.hh"
8
9#include "RNA_enum_types.hh"
10
11#include "UI_interface.hh"
12#include "UI_resources.hh"
13
15
17
19{
20 b.add_input<decl::Float>("Value").hide_value().multi_input();
21 b.add_input<decl::Vector>("Position").subtype(PROP_TRANSLATION);
22 b.add_input<decl::Vector>("Direction").default_value({0, 0, 1}).subtype(PROP_XYZ);
23 b.add_output<decl::Geometry>("Transform");
24}
25
26static void node_init(bNodeTree * /*tree*/, bNode *node)
27{
28 NodeGeometryLinearGizmo *storage = MEM_cnew<NodeGeometryLinearGizmo>(__func__);
29 node->storage = storage;
30}
31
32static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
33{
34 uiItemR(layout, ptr, "color_id", UI_ITEM_NONE, "", ICON_NONE);
35 uiItemR(layout, ptr, "draw_style", UI_ITEM_NONE, "", ICON_NONE);
36}
37
38static void node_rna(StructRNA *srna)
39{
41 "color_id",
42 "Color",
43 "",
47 "draw_style",
48 "Draw Style",
49 "",
51 NOD_storage_enum_accessors(draw_style));
52}
53
54static void node_register()
55{
56 static bke::bNodeType ntype;
57 geo_node_type_base(&ntype, GEO_NODE_GIZMO_LINEAR, "Linear Gizmo", NODE_CLASS_INTERFACE);
59 &ntype, "NodeGeometryLinearGizmo", node_free_standard_storage, node_copy_standard_storage);
60 ntype.declare = node_declare;
62 ntype.initfunc = node_init;
64
65 node_rna(ntype.rna_ext.srna);
66}
68
69} // namespace blender::nodes::node_geo_gizmo_linear_cc
#define NODE_CLASS_INTERFACE
Definition BKE_node.hh:416
#define NODE_STORAGE_FUNCS(StorageT)
Definition BKE_node.hh:1799
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
@ PROP_XYZ
Definition RNA_types.hh:172
@ PROP_TRANSLATION
Definition RNA_types.hh:164
#define UI_ITEM_NONE
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
local_group_size(16, 16) .push_constant(Type b
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
Definition node.cc:4632
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_init(bNodeTree *, bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
Definition node_util.cc:46
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
Definition node_util.cc:58
const EnumPropertyItem rna_enum_geometry_nodes_linear_gizmo_draw_style_items[]
const EnumPropertyItem rna_enum_geometry_nodes_gizmo_color_items[]
StructRNA * srna
Definition RNA_types.hh:780
Defines a node type.
Definition BKE_node.hh:218
void(* initfunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:267
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:238
NodeDeclareFunction declare
Definition BKE_node.hh:347
PointerRNA * ptr
Definition wm_files.cc:4126