Blender V4.3
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 "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::Matrix>("Value").multi_input();
21 b.add_input<decl::Vector>("Position").subtype(PROP_TRANSLATION);
22 b.add_input<decl::Rotation>("Rotation")
23 .description(
24 "Local rotation of the gizmo. Only used if the local transforms are used in the 3D "
25 "view");
26 b.add_output<decl::Geometry>("Transform");
27}
28
41
42static void node_layout_ex(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
43{
44 uiLayoutSetPropSep(layout, true);
45 uiLayoutSetPropDecorate(layout, false);
46
47 {
48 uiLayout *row = uiLayoutColumnWithHeading(layout, true, IFACE_("Translation"));
49 uiItemR(row, ptr, "use_translation_x", UI_ITEM_NONE, IFACE_("X"), ICON_NONE);
50 uiItemR(row, ptr, "use_translation_y", UI_ITEM_NONE, IFACE_("Y"), ICON_NONE);
51 uiItemR(row, ptr, "use_translation_z", UI_ITEM_NONE, IFACE_("Z"), ICON_NONE);
52 }
53 {
54 uiLayout *row = uiLayoutColumnWithHeading(layout, true, IFACE_("Rotation"));
55 uiItemR(row, ptr, "use_rotation_x", UI_ITEM_NONE, IFACE_("X"), ICON_NONE);
56 uiItemR(row, ptr, "use_rotation_y", UI_ITEM_NONE, IFACE_("Y"), ICON_NONE);
57 uiItemR(row, ptr, "use_rotation_z", UI_ITEM_NONE, IFACE_("Z"), ICON_NONE);
58 }
59 {
60 uiLayout *row = uiLayoutColumnWithHeading(layout, true, IFACE_("Scale"));
61 uiItemR(row, ptr, "use_scale_x", UI_ITEM_NONE, IFACE_("X"), ICON_NONE);
62 uiItemR(row, ptr, "use_scale_y", UI_ITEM_NONE, IFACE_("Y"), ICON_NONE);
63 uiItemR(row, ptr, "use_scale_z", UI_ITEM_NONE, IFACE_("Z"), ICON_NONE);
64 }
65}
66
67static void node_register()
68{
69 static bke::bNodeType ntype;
70 geo_node_type_base(&ntype, GEO_NODE_GIZMO_TRANSFORM, "Transform Gizmo", NODE_CLASS_INTERFACE);
72 "NodeGeometryTransformGizmo",
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:416
#define NODE_STORAGE_FUNCS(StorageT)
Definition BKE_node.hh:1799
#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:164
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
#define UI_ITEM_NONE
uiLayout * uiLayoutColumnWithHeading(uiLayout *layout, bool align, const char *heading)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
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_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, 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
Defines a node type.
Definition BKE_node.hh:218
void(* initfunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:267
void(* draw_buttons_ex)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:240
NodeDeclareFunction declare
Definition BKE_node.hh:347
PointerRNA * ptr
Definition wm_files.cc:4126