28const MultiValueMap<bke::GeometryComponent::Type, bke::AttrDomain> &
37 {AttrDomain::Point, AttrDomain::Edge, AttrDomain::Face});
41 return supported_types_and_domains;
43 return supported_types_and_domains;
55 if (iter.
domain != domain) {
72 for (const int new_i : range) {
73 const int old_i = old_by_new_map[new_i];
74 array_utils::copy(src.slice(src_offsets[old_i]), dst.span.slice(dst_offsets[new_i]));
86 for (const int64_t i : range) {
87 data[permutation[i]] = i;
101 bke::gather_attributes(src_attributes,
102 bke::AttrDomain::Point,
103 bke::AttrDomain::Point,
108 bke::copy_attributes(src_attributes,
109 bke::AttrDomain::Edge,
110 bke::AttrDomain::Edge,
111 bke::attribute_filter_with_skip_ref(attribute_filter, {
".edge_verts"}),
114 bke::copy_attributes(src_attributes,
115 bke::AttrDomain::Face,
116 bke::AttrDomain::Face,
121 &dst_mesh.
runtime->face_offsets_sharing_info);
123 src_mesh.
runtime->face_offsets_sharing_info,
125 &dst_mesh.
runtime->face_offsets_sharing_info);
127 bke::copy_attributes(src_attributes,
128 bke::AttrDomain::Corner,
129 bke::AttrDomain::Corner,
130 bke::attribute_filter_with_skip_ref(attribute_filter, {
".corner_vert"}),
136 array_utils::gather(new_by_old_map.
as_span(),
137 src_mesh.edges().cast<
int>(),
138 dst_mesh.edges_for_write().cast<
int>());
142 new_by_old_map.
as_span(), src_mesh.corner_verts(), dst_mesh.corner_verts_for_write());
153 bke::copy_attributes(src_attributes,
154 bke::AttrDomain::Point,
155 bke::AttrDomain::Point,
159 bke::gather_attributes(src_attributes,
160 bke::AttrDomain::Edge,
161 bke::AttrDomain::Edge,
166 bke::copy_attributes(src_attributes,
167 bke::AttrDomain::Face,
168 bke::AttrDomain::Face,
173 &dst_mesh.
runtime->face_offsets_sharing_info);
175 src_mesh.
runtime->face_offsets_sharing_info,
177 &dst_mesh.
runtime->face_offsets_sharing_info);
179 bke::copy_attributes(src_attributes,
180 bke::AttrDomain::Corner,
181 bke::AttrDomain::Corner,
182 bke::attribute_filter_with_skip_ref(attribute_filter, {
".corner_edge"}),
189 new_by_old_map.
as_span(), src_mesh.corner_edges(), dst_mesh.corner_edges_for_write());
200 bke::copy_attributes(src_attributes,
201 bke::AttrDomain::Point,
202 bke::AttrDomain::Point,
206 bke::copy_attributes(src_attributes,
207 bke::AttrDomain::Edge,
208 bke::AttrDomain::Edge,
212 bke::gather_attributes(src_attributes,
213 bke::AttrDomain::Face,
214 bke::AttrDomain::Face,
219 const Span<int> old_offsets = src_mesh.face_offsets();
221 offset_indices::gather_group_sizes(old_offsets, old_by_new_map, new_offsets);
222 offset_indices::accumulate_counts_to_offsets(new_offsets);
224 bke::AttrDomain::Corner,
239 case bke::AttrDomain::Point:
242 case bke::AttrDomain::Edge:
245 case bke::AttrDomain::Face:
251 dst_mesh.tag_positions_changed();
252 dst_mesh.tag_topology_changed();
260 bke::gather_attributes(src_pointcloud.
attributes(),
261 bke::AttrDomain::Point,
262 bke::AttrDomain::Point,
265 dst_pointcloud.attributes_for_write());
266 dst_pointcloud.tag_positions_changed();
267 dst_pointcloud.tag_radii_changed();
275 bke::gather_attributes(src_curves.
attributes(),
276 bke::AttrDomain::Curve,
277 bke::AttrDomain::Curve,
284 offset_indices::gather_group_sizes(old_offsets, old_by_new_map, new_offsets);
285 offset_indices::accumulate_counts_to_offsets(new_offsets);
288 bke::AttrDomain::Point,
298 bke::curves::nurbs::gather_custom_knots(
299 src_curves, IndexMask::from_indices(old_by_new_map, memory), 0, dst_curves);
310 bke::gather_attributes(src_instances.
attributes(),
311 bke::AttrDomain::Instance,
312 bke::AttrDomain::Instance,
324 array_utils::gather(old_transforms, old_by_new_map, new_transforms);
332 Mesh *dst_mesh = bke::mesh_new_no_attributes(
343 PointCloud *dst_pointcloud = bke::pointcloud_new_no_attributes(src_pointcloud.
totpoint);
345 return dst_pointcloud;
364 Curves *dst_curves = bke::curves_new_nomain(0, 0);
366 src_curve_geometry, old_by_new_map, attribute_filter);
376 return dst_instances;
390 *src_mesh_component->get(), old_by_new_map, domain, attribute_filter);
397 *src_points_component->get(), old_by_new_map, attribute_filter);
403 Curves *result_curves = reorder_curves(
404 *src_curves_component->get(), old_by_new_map, attribute_filter);
411 *src_instances_component->get(), old_by_new_map, attribute_filter);
Low-level operations for curves.
Low-level operations for curves.
void BKE_mesh_copy_parameters_for_eval(Mesh *me_dst, const Mesh *me_src)
General operations for point clouds.
#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 foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) const
eCustomDataType data_type
GAttributeReader get() const
MutableAttributeAccessor attributes_for_write()
void nurbs_custom_knots_update_size()
Span< int > offsets() const
void tag_topology_changed()
AttributeAccessor attributes() const
MutableSpan< int > offsets_for_write()
bool nurbs_has_custom_knots() const
virtual bool is_empty() const
int add_reference(const InstanceReference &reference)
Span< float4x4 > transforms() const
Span< InstanceReference > references() const
void resize(int capacity)
bke::MutableAttributeAccessor attributes_for_write()
bke::AttributeAccessor attributes() const
int instances_num() const
MutableSpan< float4x4 > transforms_for_write()
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)
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, const bke::AttributeFilter &attribute_filter, bke::MutableAttributeAccessor dst_attributes)
static void copy_and_reorder_instaces(const bke::Instances &src_instances, const Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter, bke::Instances &dst_instances)
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)
PointCloud * reorder_points(const PointCloud &src_pointcloud, Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter)
static void copy_and_reorder_points(const PointCloud &src_pointcloud, const Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter, PointCloud &dst_pointcloud)
static void copy_and_reorder_curves(const bke::CurvesGeometry &src_curves, const Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter, bke::CurvesGeometry &dst_curves)
static void copy_and_reorder_mesh_verts(const Mesh &src_mesh, const Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter, Mesh &dst_mesh)
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()
static void copy_and_reorder_mesh_faces(const Mesh &src_mesh, const Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter, Mesh &dst_mesh)
static void copy_and_reorder_mesh_edges(const Mesh &src_mesh, const Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter, Mesh &dst_mesh)
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)
static void copy_and_reorder_mesh(const Mesh &src_mesh, const Span< int > old_by_new_map, const bke::AttrDomain domain, const bke::AttributeFilter &attribute_filter, Mesh &dst_mesh)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
ListBase vertex_group_names
MeshRuntimeHandle * runtime
int * face_offset_indices
bool allow_skip(const StringRef name) const