Blender V5.0
edit.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
8
9#include "BKE_attribute.hh"
10#include "BKE_pointcloud.hh"
11
12#include "ED_pointcloud.hh"
13
15
17{
18 if (mask.size() == src.totpoint) {
20 }
25 {},
26 mask,
27 dst->attributes_for_write());
29 return dst;
30}
31
33{
34 const bke::AttributeAccessor attributes = pointcloud.attributes();
35 const VArray<bool> selection = *attributes.lookup_or_default<bool>(
36 ".selection", bke::AttrDomain::Point, true);
37 IndexMaskMemory memory;
38 const IndexMask mask = IndexMask::from_bools_inverse(selection, memory);
39 if (mask.size() == pointcloud.totpoint) {
40 return false;
41 }
42
43 PointCloud *pointcloud_new = copy_selection(pointcloud, mask);
45 return true;
46}
47
48} // namespace blender::ed::pointcloud
General operations for point clouds.
PointCloud * BKE_pointcloud_copy_for_eval(const PointCloud *pointcloud_src)
void BKE_pointcloud_nomain_to_pointcloud(PointCloud *pointcloud_src, PointCloud *pointcloud_dst)
PointCloud * BKE_pointcloud_new_nomain(int totpoint)
void pointcloud_copy_parameters(const PointCloud &src, PointCloud &dst)
AttributeSet attributes
static IndexMask from_bools_inverse(const VArray< bool > &bools, IndexMaskMemory &memory)
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void gather_attributes(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
bool remove_selection(PointCloud &pointcloud)
Definition edit.cc:32
PointCloud * copy_selection(const PointCloud &src, const IndexMask &mask)
Definition edit.cc:16