Blender V5.3
node_geo_get_geometry_bundle.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
9
11
13{
14 b.use_custom_socket_order();
15 b.allow_any_socket_order();
16
17 b.add_input<decl::Geometry>("Geometry"_ustr).description("Geometry to get the bundle of");
18 b.add_output<decl::Geometry>("Geometry"_ustr).propagate_all().align_with_previous();
19 b.add_output<decl::Bundle>("Bundle"_ustr).propagate_all();
20 b.add_input<decl::Bool>("Remove"_ustr)
21 .default_value(false)
23 "Removing the bundle from the geometry can be beneficial to avoid unnecessary data "
24 "copies");
25}
26
28{
29 GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry"_ustr);
30 const bool remove = params.extract_input<bool>("Remove"_ustr);
31 BundlePtr bundle;
32 if (remove) {
33 bundle = std::move(geometry_set.bundle_ptr());
34 }
35 else {
36 bundle = geometry_set.bundle_ptr();
37 }
38 params.set_output("Geometry"_ustr, std::move(geometry_set));
39 params.set_output("Bundle"_ustr, std::move(bundle));
40}
41
42static void node_register()
43{
44 static bke::bNodeType ntype;
45
46 geo_node_type_base(&ntype, "GeometryNodeGetGeometryBundle"_ustr);
47 ntype.ui_name = "Get Geometry Bundle";
48 ntype.ui_description = "Get the bundle of a geometry";
51 ntype.declare = node_declare;
54}
56
57} // namespace blender::nodes::node_geo_get_geometry_bundle
#define NODE_CLASS_GEOMETRY
Definition BKE_node.hh:492
#define NOD_REGISTER_NODE(REGISTER_FUNC)
T extract_input(const UString identifier)
void set_output(const UString identifier, T &&value)
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
static void node_declare(NodeDeclarationBuilder &b)
static void node_geo_exec(GeoNodeExecParams params)
ImplicitSharingPtr< Bundle > BundlePtr
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
const nodes::BundlePtr & bundle_ptr() const
static constexpr int _160
Definition BKE_node.hh:246
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