Blender V4.3
node_geo_set_point_radius.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
8
10
12{
13 b.add_input<decl::Geometry>("Points").supported_type(GeometryComponent::Type::PointCloud);
14 b.add_input<decl::Bool>("Selection").default_value(true).hide_value().field_on_all();
15 b.add_input<decl::Float>("Radius")
16 .default_value(0.05f)
17 .min(0.0f)
19 .field_on_all();
20 b.add_output<decl::Geometry>("Points").propagate_all();
21}
22
24{
25 GeometrySet geometry_set = params.extract_input<GeometrySet>("Points");
26 const Field<bool> selection = params.extract_input<Field<bool>>("Selection");
27 const Field<float> radius = params.extract_input<Field<float>>("Radius");
28
29 geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
30 if (PointCloud *pointcloud = geometry_set.get_pointcloud_for_write()) {
31 bke::try_capture_field_on_geometry(pointcloud->attributes_for_write(),
32 bke::PointCloudFieldContext(*pointcloud),
33 "radius",
35 selection,
36 radius);
37 }
38 });
39
40 params.set_output("Points", std::move(geometry_set));
41}
42
43static void node_register()
44{
45 static blender::bke::bNodeType ntype;
46
47 geo_node_type_base(&ntype, GEO_NODE_SET_POINT_RADIUS, "Set Point Radius", NODE_CLASS_GEOMETRY);
49 ntype.declare = node_declare;
51}
53
54} // namespace blender::nodes::node_geo_set_point_radius_cc
#define NODE_CLASS_GEOMETRY
Definition BKE_node.hh:418
#define NOD_REGISTER_NODE(REGISTER_FUNC)
@ PROP_DISTANCE
Definition RNA_types.hh:159
local_group_size(16, 16) .push_constant(Type b
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
bool try_capture_field_on_geometry(MutableAttributeAccessor attributes, const fn::FieldContext &field_context, const StringRef attribute_id, AttrDomain domain, const fn::Field< bool > &selection, const fn::GField &field)
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
PointCloud * get_pointcloud_for_write()
void modify_geometry_sets(ForeachSubGeometryCallback callback)
Defines a node type.
Definition BKE_node.hh:218
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:339
NodeDeclareFunction declare
Definition BKE_node.hh:347