Blender V5.3
node_geo_input_voxel_index.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
8
10
12{
13 b.use_custom_socket_order();
14 b.allow_any_socket_order();
15 b.add_output<decl::Int>("X"_ustr)
16 .structure_type(StructureType::Field)
18 "X coordinate of the voxel in index space, or the minimum X coordinate of a tile");
19 b.add_output<decl::Int>("Y"_ustr)
20 .structure_type(StructureType::Field)
22 "Y coordinate of the voxel in index space, or the minimum Y coordinate of a tile");
23 b.add_output<decl::Int>("Z"_ustr)
24 .structure_type(StructureType::Field)
26 "Z coordinate of the voxel in index space, or the minimum Z coordinate of a tile");
27 auto &panel =
28 b.add_panel("Tile"_ustr).default_closed(true).translation_context(BLT_I18NCONTEXT_ID_VOLUME);
29 panel.add_output<decl::Bool>("Is Tile"_ustr)
30 .structure_type(StructureType::Field)
32 "True if the field is evaluated on a tile, i.e. on multiple voxels at once. If this is "
33 "false, the extent is always 1");
34 panel.add_output<decl::Int>("Extent X"_ustr)
35 .structure_type(StructureType::Field)
37 "Number of voxels in the X direction of the tile, or 1 if the field is evaluated on a "
38 "voxel");
39 panel.add_output<decl::Int>("Extent Y"_ustr)
40 .structure_type(StructureType::Field)
42 "Number of voxels in the Y direction of the tile, or 1 if the field is evaluated on a "
43 "voxel");
44 panel.add_output<decl::Int>("Extent Z"_ustr)
45 .structure_type(StructureType::Field)
47 "Number of voxels in the Z direction of the tile, or 1 if the field is evaluated on a "
48 "voxel");
49}
50
52{
53#ifdef WITH_OPENVDB
54 if (params.output_is_required("X"_ustr)) {
55 params.set_output("X"_ustr,
57 }
58 if (params.output_is_required("Y"_ustr)) {
59 params.set_output("Y"_ustr,
61 }
62 if (params.output_is_required("Z"_ustr)) {
63 params.set_output("Z"_ustr,
65 }
66 if (params.output_is_required("Is Tile"_ustr)) {
68 }
69 if (params.output_is_required("Extent X"_ustr)) {
70 params.set_output("Extent X"_ustr,
72 }
73 if (params.output_is_required("Extent Y"_ustr)) {
74 params.set_output("Extent Y"_ustr,
76 }
77 if (params.output_is_required("Extent Z"_ustr)) {
78 params.set_output("Extent Z"_ustr,
80 }
81#else
83#endif
84}
85
86static void node_register()
87{
88 static bke::bNodeType ntype;
89
90 geo_node_type_base(&ntype, "GeometryNodeInputVoxelIndex"_ustr);
91 ntype.ui_name = "Voxel Index";
92 ntype.ui_description =
93 "Retrieve the integer coordinates of the voxel that the field is evaluated on";
96 ntype.declare = node_declare;
98}
100
101} // namespace blender::nodes::node_geo_input_voxel_index_cc
#define NODE_CLASS_INPUT
Definition BKE_node.hh:478
#define BLT_I18NCONTEXT_ID_VOLUME
#define NOD_REGISTER_NODE(REGISTER_FUNC)
static GField from_input(Args &&...args)
Definition FN_field.hh:482
static constexpr Value Z
static constexpr Value X
static constexpr Value Y
bool output_is_required(const UString identifier) const
void set_output(const UString identifier, T &&value)
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
void node_geo_exec_with_missing_openvdb(GeoNodeExecParams &params)
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
Defines a node type.
Definition BKE_node.hh:265
std::string ui_description
Definition BKE_node.hh:271
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:385
NodeDeclareFunction declare
Definition BKE_node.hh:393