Blender V5.3
node_geo_set_points_type.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
7#include "BKE_pointcloud.hh"
8
9#include "NOD_rna_define.hh"
10
12#include "UI_resources.hh"
13
14#include "RNA_enum_types.hh"
15
17
18#include "node_geometry_util.hh"
19
21
23{
24 b.use_custom_socket_order();
25 b.allow_any_socket_order();
26 b.add_input<decl::Geometry>("Points"_ustr)
28 .description("Point cloud to change the type of");
29 b.add_output<decl::Geometry>("Points"_ustr).propagate_all_geometry().align_with_previous();
30 b.add_input<decl::Menu>("Type"_ustr)
33}
34
36{
37 const auto dst_type = params.get_input<PointCloudType>("Type"_ustr);
38 GeometrySet geometry_set = params.extract_input<GeometrySet>("Points"_ustr);
39 geometry::foreach_real_geometry(geometry_set, [&](GeometrySet &geometry_set) {
40 if (!geometry_set.has_pointcloud()) {
41 return;
42 }
43 if (geometry_set.get_pointcloud()->type == dst_type) {
44 return;
45 }
46 PointCloud *dst_pointcloud = geometry_set.get_pointcloud_for_write();
47 dst_pointcloud->type = dst_type;
48 });
49 params.set_output("Points"_ustr, std::move(geometry_set));
50}
51
52static void node_register()
53{
54 static bke::bNodeType ntype;
55 geo_node_type_base(&ntype, "GeometryNodePointsSetType"_ustr);
56 ntype.ui_name = "Set Point Cloud Type";
57 ntype.ui_description = "Change the type of point cloud";
59 ntype.declare = node_declare;
61
63}
65
66} // namespace blender::nodes::node_geo_points_type_cc
#define NODE_CLASS_GEOMETRY
Definition BKE_node.hh:492
General operations for point clouds.
#define NOD_REGISTER_NODE(REGISTER_FUNC)
T extract_input(const UString identifier)
T get_input(const UString identifier) const
void set_output(const UString identifier, T &&value)
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
void foreach_real_geometry(bke::GeometrySet &geometry, FunctionRef< void(bke::GeometrySet &geometry_set)> fn)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
const EnumPropertyItem rna_enum_pointcloud_type_items[]
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