55 const AttrDomain domain,
59 if (mesh ==
nullptr) {
63 const int domain_size = mesh->attributes().domain_size(domain);
64 if (domain_size == 0) {
75 evaluator.add(position_field);
76 evaluator.add(radius_field);
78 const IndexMask selection = evaluator.get_evaluated_selection_as_mask();
80 const VArray<float> radii_eval = evaluator.get_evaluated<
float>(1);
82 const bool share_arrays = selection.
size() == domain_size;
83 const bool share_position = share_arrays && positions_eval.
is_span() &&
85 mesh->vert_positions().data();
92 pointcloud->
totpoint = mesh->verts_num;
95 pointcloud->attributes_for_write().add<
float3>(
"position", AttrDomain::Point,
init);
114 attributes.remove(
"radius");
115 attributes.remove(
"position");
118 const StringRef attribute_id = entry.key;
129 dst_attributes.
add(attribute_id, AttrDomain::Point, data_type,
init);
133 attribute_id, AttrDomain::Point, data_type);
152 static auto max_zero_fn = mf::build::SI1_SO<float, float>(
154 [](
float value) {
return std::max(0.0f, value); },
155 mf::build::exec_presets::AllSpanOrSingle());
200 params.set_output(
"Points", std::move(geometry_set));
210 "Create a point in the point cloud for each selected vertex"},
215 "Create a point in the point cloud for each selected edge"},
220 "Create a point in the point cloud for each selected face"},
225 "Create a point in the point cloud for each selected face corner"},
226 {0,
nullptr, 0,
nullptr,
nullptr},
CustomData interface, see also DNA_customdata_types.h.
bool CustomData_free_layer_named(CustomData *data, blender::StringRef name, const int totelem)
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_GEOMETRY
General operations for point clouds.
PointCloud * BKE_pointcloud_new_nomain(int totpoint)
GeometryNodeMeshToPointsMode
@ GEO_NODE_MESH_TO_POINTS_FACES
@ GEO_NODE_MESH_TO_POINTS_VERTICES
@ GEO_NODE_MESH_TO_POINTS_CORNERS
@ GEO_NODE_MESH_TO_POINTS_EDGES
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
const void * data() const
GSpan get_internal_span() const
Span< T > get_internal_span() const
GAttributeReader lookup(const StringRef attribute_id) const
bool add(const StringRef attribute_id, const AttrDomain domain, const eCustomDataType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type)
void set_selection(Field< bool > selection)
static std::shared_ptr< FieldOperation > Create(std::shared_ptr< const mf::MultiFunction > function, Vector< GField > inputs={})
local_group_size(16, 16) .push_constant(Type b
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, int64_t grain_size=4096)
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))
void node_register_type(bNodeType *ntype)
static void node_register()
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_init(bNodeTree *, bNode *node)
static void node_rna(StructRNA *srna)
static void node_declare(NodeDeclarationBuilder &b)
static void geometry_set_mesh_to_points(GeometrySet &geometry_set, const Field< float3 > &position_field, const Field< float > &radius_field, const Field< bool > &selection_field, const AttrDomain domain, const AttributeFilter &attribute_filter)
static void node_geo_exec(GeoNodeExecParams params)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
const ImplicitSharingInfo * sharing_info
const ImplicitSharingInfo * sharing_info
void gather_attributes_for_propagation(Span< GeometryComponent::Type > component_types, GeometryComponent::Type dst_component_type, bool include_instances, const AttributeFilter &attribute_filter, Map< StringRef, AttributeKind > &r_attributes) const
void replace_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void keep_only_during_modify(Span< GeometryComponent::Type > component_types)
const Mesh * get_mesh() const
void modify_geometry_sets(ForeachSubGeometryCallback callback)
void remove_geometry_during_modify()
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare