Blender V5.0
node_geo_gizmo_dial.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
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>("Up").default_value({0, 0, 1}).subtype(PROP_XYZ);
23 b.add_input<decl::Bool>("Screen Space")
24 .default_value(true)
25 .description(
26 "If true, the gizmo is displayed in screen space. Otherwise it's in object space");
27 b.add_input<decl::Float>("Radius").default_value(1.0f);
28 b.add_output<decl::Geometry>("Transform");
29}
30
31static void node_init(bNodeTree * /*tree*/, bNode *node)
32{
34 node->storage = storage;
35}
36
37static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
38{
39 layout->prop(ptr, "color_id", UI_ITEM_NONE, "", ICON_NONE);
40}
41
42static void node_rna(StructRNA *srna)
43{
45 "color_id",
46 "Color",
47 "",
50}
51
52static void node_register()
53{
54 static bke::bNodeType ntype;
55 geo_node_type_base(&ntype, "GeometryNodeGizmoDial", GEO_NODE_GIZMO_DIAL);
56 ntype.ui_name = "Dial Gizmo";
57 ntype.ui_description = "Show a dial gizmo in the viewport for a value";
58 ntype.enum_name_legacy = "GIZMO_DIAL";
61 ntype, "NodeGeometryDialGizmo", node_free_standard_storage, node_copy_standard_storage);
62 ntype.declare = node_declare;
64 ntype.initfunc = node_init;
66
67 node_rna(ntype.rna_ext.srna);
68}
70
71} // namespace blender::nodes::node_geo_gizmo_dial_cc
#define NODE_CLASS_INTERFACE
Definition BKE_node.hh:459
#define NODE_STORAGE_FUNCS(StorageT)
Definition BKE_node.hh:1240
#define GEO_NODE_GIZMO_DIAL
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
@ PROP_XYZ
Definition RNA_types.hh:269
@ PROP_TRANSLATION
Definition RNA_types.hh:261
#define UI_ITEM_NONE
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
Definition node.cc:5414
static void node_declare(NodeDeclarationBuilder &b)
static void node_init(bNodeTree *, bNode *node)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
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, std::string idname, const std::optional< int16_t > legacy_type)
void node_free_standard_storage(bNode *node)
Definition node_util.cc:42
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
Definition node_util.cc:54
const EnumPropertyItem rna_enum_geometry_nodes_gizmo_color_items[]
StructRNA * srna
void * storage
Defines a node type.
Definition BKE_node.hh:238
std::string ui_description
Definition BKE_node.hh:244
void(* initfunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:289
const char * enum_name_legacy
Definition BKE_node.hh:247
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:259
NodeDeclareFunction declare
Definition BKE_node.hh:362
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
PointerRNA * ptr
Definition wm_files.cc:4238