47 curves.offsets_for_write().drop_back(1).copy_from(curve_offsets);
48 curves.offsets_for_write().last() = vert_indices.
size();
54 curves.cyclic_for_write().slice(cyclic_curves).fill(
true);
59 mesh_attributes, curves_attributes, skip_storage, attribute_filter);
64 attribute_filter_with_skip,
76 if (attribute_filter_with_skip.allow_skip(iter.
name)) {
123 Array<int> neighbor_offsets_data(verts_num + 1, 0);
125 edges.
cast<
int>(), neighbor_offsets_data);
132 const int v1 = edges[i][0];
133 const int v2 = edges[i][1];
134 neighbors[neighbor_offsets[v1].start() + used_slots[v1]] =
v2;
135 neighbors[neighbor_offsets[
v2].start() + used_slots[
v2]] = v1;
145 Array<int> unused_edges = std::move(used_slots);
147 for (
const int start_vert :
IndexRange(verts_num)) {
149 if (neighbor_offsets[start_vert].size() == 2) {
154 if (unused_edges[start_vert] == 0) {
158 for (
const int neighbor : neighbors.
as_span().slice(neighbor_offsets[start_vert])) {
159 int current_vert = start_vert;
160 int next_vert = neighbor;
162 if (unused_edges[next_vert] == 0) {
168 vert_indices.
append(current_vert);
172 int last_vert = current_vert;
173 current_vert = next_vert;
175 vert_indices.
append(current_vert);
176 unused_edges[current_vert]--;
177 unused_edges[last_vert]--;
179 if (neighbor_offsets[current_vert].size() != 2) {
183 const int offset = neighbor_offsets[current_vert].start();
184 const int next_a = neighbors[offset];
185 const int next_b = neighbors[offset + 1];
186 next_vert = (last_vert == next_a) ? next_b : next_a;
192 const int cyclic_start = curve_offsets.
size();
196 for (
const int start_vert :
IndexRange(verts_num)) {
197 if (unused_edges[start_vert] != 2) {
201 int current_vert = start_vert;
202 int next_vert = neighbors[neighbor_offsets[current_vert].start()];
205 vert_indices.
append(current_vert);
208 while (next_vert != start_vert) {
209 const int last_vert = current_vert;
210 current_vert = next_vert;
212 vert_indices.
append(current_vert);
213 unused_edges[current_vert]--;
214 unused_edges[last_vert]--;
216 const int offset = neighbor_offsets[current_vert].start();
217 const int next_a = neighbors[offset];
218 const int next_b = neighbors[offset + 1];
219 next_vert = (last_vert == next_a) ? next_b : next_a;
225 return {std::move(vert_indices), std::move(curve_offsets), cyclic_curves};
245 if (selection.
size() == edges.
size()) {
258 if (selection.
size() == faces.
size()) {
260 mesh.runtime->face_offsets_sharing_info,
262 &
curves.runtime->curve_offsets_sharing_info);
285 if (selection.
size() == faces.
size()) {
286 return mesh.corner_verts();
308 mesh, faces, points_by_curve, selection, point_to_vert_data);
312 src_attributes, dst_attributes, skip_storage, attribute_filter);
317 attribute_filter_with_skip,
328 if (attribute_filter_with_skip.allow_skip(iter.
name)) {
344 attribute_filter_with_skip,
351 attribute_filter_with_skip,
Low-level operations for curves.
#define PRF_scope(category)
Span< T > as_span() const
MutableSpan< T > as_mutable_span()
void reinitialize(const int64_t new_size)
CommonVArrayInfo common_info() const
const CPPType & type() const
constexpr bool is_empty() const
constexpr IndexRange()=default
constexpr IndexRange drop_front(int64_t n) const
Span< NewT > constexpr cast() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
void append(const T &value)
IndexRange index_range() const
void reserve(const int64_t min_capacity)
Set< StringRefNull > all_names() const
void foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) const
bool is_builtin(const StringRef name) const
GAttributeReader get() const
bool add(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef name, AttrDomain domain, AttrType data_type)
#define storage(slot, qualifiers)
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, exec_mode::Mode mode=exec_mode::parallel)
void gather_group_to_group(const OffsetIndices< int > src_offsets, const OffsetIndices< int > dst_offsets, const IndexMask &selection, const Span< T > src, MutableSpan< T > dst)
void gather(GSpan src, Span< int > map, GMutableSpan dst)
auto attribute_filter_with_skip_ref(const AttributeFilter &filter, const Span< StringRef > skip)
void gather_attributes(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
void gather_attributes_group_to_group(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
static Span< int > create_point_to_vert_map(const Mesh &mesh, const OffsetIndices< int > faces, const OffsetIndices< int > points_by_curve, const IndexMask &selection, Array< int > &map_data)
static auto filter_builtin_attributes(const bke::AttributeAccessor &mesh_attributes, const bke::AttributeAccessor &curves_attributes, Set< StringRef > &storage, const bke::AttributeFilter &attribute_filter)
static bke::CurvesGeometry create_curves_for_faces(const Mesh &mesh, const OffsetIndices< int > faces, const IndexMask &selection)
static BLI_NOINLINE CurveFromEdgesOutput edges_to_curve_point_indices(const int verts_num, const Span< int2 > edges)
bke::CurvesGeometry mesh_edges_to_curves_convert(const Mesh &mesh, const IndexMask &selection, const bke::AttributeFilter &attribute_filter)
bke::CurvesGeometry create_curve_from_vert_indices(const bke::AttributeAccessor &mesh_attributes, Span< int > vert_indices, Span< int > curve_offsets, IndexRange cyclic_curves, const bke::AttributeFilter &attribute_filter)
void debug_randomize_curve_order(bke::CurvesGeometry *curves)
static BLI_NOINLINE bke::CurvesGeometry edges_to_curves_convert(const Mesh &mesh, const Span< int2 > edges, const bke::AttributeFilter &attribute_filter)
bke::CurvesGeometry mesh_faces_to_curves_convert(const Mesh &mesh, const IndexMask &selection, const bke::AttributeFilter &attribute_filter)
void copy_shared_pointer(T *src_ptr, const ImplicitSharingInfo *src_sharing_info, T **r_dst_ptr, const ImplicitSharingInfo **r_dst_sharing_info)
OffsetIndices< int > build_reverse_offsets(Span< int > indices, MutableSpan< int > offsets)
OffsetIndices< int > gather_selected_offsets(OffsetIndices< int > src_offsets, const IndexMask &selection, int start_offset, MutableSpan< int > dst_offsets)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
void BKE_defgroup_copy_list(ListBaseT< bDeformGroup > *outbase, const ListBaseT< bDeformGroup > *inbase)
Vector< int > curve_offsets
Vector< int > vert_indices