Blender V5.0
node_geo_gizmo_transform.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 "RNA_enum_types.hh"
8
10#include "UI_resources.hh"
11
13
15
17{
18 b.add_input<decl::Matrix>("Value").multi_input();
19 b.add_input<decl::Vector>("Position").subtype(PROP_TRANSLATION);
20 b.add_input<decl::Rotation>("Rotation")
22 "Local rotation of the gizmo. Only used if the local transforms are used in the 3D "
23 "view");
24 b.add_output<decl::Geometry>("Transform");
25}
26
39
40static void node_layout_ex(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
41{
42 layout->use_property_split_set(true);
43 layout->use_property_decorate_set(false);
44
45 {
46 uiLayout *row = &layout->column(true, IFACE_("Translation"));
47 row->prop(ptr, "use_translation_x", UI_ITEM_NONE, IFACE_("X"), ICON_NONE);
48 row->prop(ptr, "use_translation_y", UI_ITEM_NONE, IFACE_("Y"), ICON_NONE);
49 row->prop(ptr, "use_translation_z", UI_ITEM_NONE, IFACE_("Z"), ICON_NONE);
50 }
51 {
52 uiLayout *row = &layout->column(true, IFACE_("Rotation"));
53 row->prop(ptr, "use_rotation_x", UI_ITEM_NONE, IFACE_("X"), ICON_NONE);
54 row->prop(ptr, "use_rotation_y", UI_ITEM_NONE, IFACE_("Y"), ICON_NONE);
55 row->prop(ptr, "use_rotation_z", UI_ITEM_NONE, IFACE_("Z"), ICON_NONE);
56 }
57 {
58 uiLayout *row = &layout->column(true, IFACE_("Scale"));
59 row->prop(ptr, "use_scale_x", UI_ITEM_NONE, IFACE_("X"), ICON_NONE);
60 row->prop(ptr, "use_scale_y", UI_ITEM_NONE, IFACE_("Y"), ICON_NONE);
61 row->prop(ptr, "use_scale_z", UI_ITEM_NONE, IFACE_("Z"), ICON_NONE);
62 }
63}
64
65static void node_register()
66{
67 static bke::bNodeType ntype;
68 geo_node_type_base(&ntype, "GeometryNodeGizmoTransform", GEO_NODE_GIZMO_TRANSFORM);
69 ntype.ui_name = "Transform Gizmo";
70 ntype.ui_description = "Show a transform gizmo in the viewport";
71 ntype.enum_name_legacy = "GIZMO_TRANSFORM";
74 ntype, "NodeGeometryTransformGizmo", node_free_standard_storage, node_copy_standard_storage);
75 ntype.declare = node_declare;
77 ntype.initfunc = node_init;
79}
81
82} // namespace blender::nodes::node_geo_gizmo_transform_cc
#define NODE_CLASS_INTERFACE
Definition BKE_node.hh:459
#define NODE_STORAGE_FUNCS(StorageT)
Definition BKE_node.hh:1240
#define GEO_NODE_GIZMO_TRANSFORM
#define IFACE_(msgid)
@ GEO_NODE_TRANSFORM_GIZMO_USE_ROTATION_Z
@ GEO_NODE_TRANSFORM_GIZMO_USE_SCALE_Z
@ GEO_NODE_TRANSFORM_GIZMO_USE_ROTATION_X
@ GEO_NODE_TRANSFORM_GIZMO_USE_ROTATION_Y
@ GEO_NODE_TRANSFORM_GIZMO_USE_TRANSLATION_Z
@ GEO_NODE_TRANSFORM_GIZMO_USE_TRANSLATION_Y
@ GEO_NODE_TRANSFORM_GIZMO_USE_SCALE_X
@ GEO_NODE_TRANSFORM_GIZMO_USE_SCALE_Y
@ GEO_NODE_TRANSFORM_GIZMO_USE_TRANSLATION_X
#define NOD_REGISTER_NODE(REGISTER_FUNC)
@ 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_init(bNodeTree *, bNode *node)
static void node_layout_ex(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
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
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
void(* draw_buttons_ex)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:261
const char * enum_name_legacy
Definition BKE_node.hh:247
NodeDeclareFunction declare
Definition BKE_node.hh:362
void use_property_decorate_set(bool is_sep)
uiLayout & column(bool align)
void use_property_split_set(bool value)
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