26const MultiValueMap<bke::GeometryComponent::Type, bke::AttrDomain> &
35 {AttrDomain::Point, AttrDomain::Edge, AttrDomain::Face});
39 return supported_types_and_domains;
41 return supported_types_and_domains;
52 if (iter.
domain != domain) {
66 for (const int new_i : range) {
67 const int old_i = old_by_new_map[new_i];
68 array_utils::copy(src.slice(src_offsets[old_i]), dst.span.slice(dst_offsets[new_i]));
80 for (const int64_t i : range) {
81 data[permutation[i]] = i;
92 bke::AttrDomain::Point,
93 bke::AttrDomain::Point,
96 dst_mesh.attributes_for_write());
98 array_utils::gather(new_by_old_map.
as_span(),
99 dst_mesh.edges().cast<
int>(),
100 dst_mesh.edges_for_write().cast<
int>());
102 new_by_old_map.
as_span(), dst_mesh.corner_verts(), dst_mesh.corner_verts_for_write());
110 bke::AttrDomain::Edge,
111 bke::AttrDomain::Edge,
114 dst_mesh.attributes_for_write());
117 new_by_old_map.
as_span(), dst_mesh.corner_edges(), dst_mesh.corner_edges_for_write());
125 bke::AttrDomain::Face,
126 bke::AttrDomain::Face,
129 dst_mesh.attributes_for_write());
130 const Span<int> old_offsets = src_mesh.face_offsets();
132 offset_indices::gather_group_sizes(old_offsets, old_by_new_map, new_offsets);
133 offset_indices::accumulate_counts_to_offsets(new_offsets);
135 bke::AttrDomain::Corner,
139 dst_mesh.attributes_for_write());
148 case bke::AttrDomain::Point:
151 case bke::AttrDomain::Edge:
154 case bke::AttrDomain::Face:
160 dst_mesh.tag_positions_changed();
161 dst_mesh.tag_topology_changed();
168 bke::gather_attributes(src_pointcloud.
attributes(),
169 bke::AttrDomain::Point,
170 bke::AttrDomain::Point,
173 dst_pointcloud.attributes_for_write());
174 dst_pointcloud.tag_positions_changed();
175 dst_pointcloud.tag_radii_changed();
182 bke::gather_attributes(src_curves.
attributes(),
183 bke::AttrDomain::Curve,
184 bke::AttrDomain::Curve,
191 offset_indices::gather_group_sizes(old_offsets, old_by_new_map, new_offsets);
192 offset_indices::accumulate_counts_to_offsets(new_offsets);
195 bke::AttrDomain::Point,
207 bke::gather_attributes(src_instances.
attributes(),
208 bke::AttrDomain::Instance,
209 bke::AttrDomain::Instance,
220 if (!bke::attribute_name_is_anonymous(iter.
name)) {
232 for (
const std::string &unused_id : unused_ids) {
233 attributes.
remove(unused_id);
255 return dst_pointcloud;
275 src_curve_geometry, old_by_new_map, attribute_filter);
286 return dst_instances;
300 *src_mesh_component->get(), old_by_new_map, domain, attribute_filter);
307 *src_points_component->get(), old_by_new_map, attribute_filter);
314 *src_curves_component->get(), old_by_new_map, attribute_filter);
321 *src_instances_component->get(), old_by_new_map, attribute_filter);
struct Curves * BKE_curves_copy_for_eval(const struct Curves *curves_src)
Low-level operations for curves.
Mesh * BKE_mesh_copy_for_eval(const Mesh &source)
General operations for point clouds.
PointCloud * BKE_pointcloud_copy_for_eval(const PointCloud *pointcloud_src)
#define BLI_assert_unreachable()
Span< T > as_span() const
void add_multiple(const Key &key, Span< Value > values)
void add(const Key &key, const Value &value)
constexpr Span< T > as_span() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
void append(const T &value)
void remove(const int64_t index)
void foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) const
eCustomDataType data_type
GAttributeReader get() const
MutableAttributeAccessor attributes_for_write()
Span< int > offsets() const
void tag_topology_changed()
AttributeAccessor attributes() const
MutableSpan< int > offsets_for_write()
virtual bool is_empty() const
bke::MutableAttributeAccessor attributes_for_write()
bke::AttributeAccessor attributes() const
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type)
static void reorder_instaces_exec(const bke::Instances &src_instances, const Span< int > old_by_new_map, bke::Instances &dst_instances)
static void reorder_curves_exec(const bke::CurvesGeometry &src_curves, const Span< int > old_by_new_map, bke::CurvesGeometry &dst_curves)
static void reorder_mesh_faces_exec(const Mesh &src_mesh, const Span< int > old_by_new_map, Mesh &dst_mesh)
static Array< int > invert_permutation(const Span< int > permutation)
Mesh * reorder_mesh(const Mesh &src_mesh, Span< int > old_by_new_map, bke::AttrDomain domain, const bke::AttributeFilter &attribute_filter)
static void reorder_mesh_verts_exec(const Mesh &src_mesh, const Span< int > old_by_new_map, Mesh &dst_mesh)
static void clean_unused_attributes(const bke::AttributeFilter &attribute_filter, bke::MutableAttributeAccessor attributes)
static void reorder_attributes_group_to_group(const bke::AttributeAccessor src_attributes, const bke::AttrDomain domain, const OffsetIndices< int > src_offsets, const OffsetIndices< int > dst_offsets, const Span< int > old_by_new_map, bke::MutableAttributeAccessor dst_attributes)
PointCloud * reorder_points(const PointCloud &src_pointcloud, Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter)
static void reorder_mesh_exec(const Mesh &src_mesh, const Span< int > old_by_new_map, const bke::AttrDomain domain, Mesh &dst_mesh)
static void reorder_mesh_edges_exec(const Mesh &src_mesh, const Span< int > old_by_new_map, Mesh &dst_mesh)
static void reorder_points_exec(const PointCloud &src_pointcloud, const Span< int > old_by_new_map, PointCloud &dst_pointcloud)
bke::CurvesGeometry reorder_curves_geometry(const bke::CurvesGeometry &src_curves, Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter)
const MultiValueMap< bke::GeometryComponent::Type, bke::AttrDomain > & components_supported_reordering()
bke::GeometryComponentPtr reordered_component(const bke::GeometryComponent &src_component, Span< int > old_by_new_map, bke::AttrDomain domain, const bke::AttributeFilter &attribute_filter)
bke::Instances * reorder_instaces(const bke::Instances &src_instances, Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter)
Curves * reorder_curves(const Curves &src_curves, Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
bool allow_skip(const StringRef name) const