25 for (const int i : range) {
26 const int vert_index = map[i];
27 dst[i] = src[vert_index];
39 curves.offsets_for_write().drop_back(1).copy_from(curve_offsets);
40 curves.offsets_for_write().last() = vert_indices.
size();
43 curves.cyclic_for_write().fill(
false);
44 curves.cyclic_for_write().slice(cyclic_curves).fill(
true);
57 if (!attribute_id.should_be_kept()) {
64 if (!mesh_attribute) {
70 using T = decltype(dummy);
71 bke::SpanAttributeWriter<T> attribute =
72 curves_attributes.lookup_or_add_for_write_only_span<T>(attribute_id, ATTR_DOMAIN_POINT);
73 copy_with_map<T>(mesh_attribute.typed<T>(), vert_indices, attribute.span);
91 Span<std::pair<int, int>> edges)
94 vert_indices.
reserve(edges.size());
99 for (
const std::pair<int, int> &edge : edges) {
100 neighbor_count[edge.first]++;
101 neighbor_count[edge.second]++;
107 for (
const int i :
verts.index_range()) {
108 neighbor_offsets[i] = start;
109 start += neighbor_count[i];
116 for (
const int i : edges.index_range()) {
117 const int v1 = edges[i].first;
118 const int v2 = edges[i].second;
119 neighbors[neighbor_offsets[
v1] + used_slots[
v1]] =
v2;
120 neighbors[neighbor_offsets[
v2] + used_slots[
v2]] =
v1;
126 Array<int> unused_edges = std::move(used_slots);
128 for (
const int start_vert :
verts.index_range()) {
130 if (neighbor_count[start_vert] == 2) {
135 if (unused_edges[start_vert] == 0) {
139 for (
const int i :
IndexRange(neighbor_count[start_vert])) {
140 int current_vert = start_vert;
141 int next_vert = neighbors[neighbor_offsets[current_vert] + i];
143 if (unused_edges[next_vert] == 0) {
149 vert_indices.
append(current_vert);
153 int last_vert = current_vert;
154 current_vert = next_vert;
156 vert_indices.
append(current_vert);
157 unused_edges[current_vert]--;
158 unused_edges[last_vert]--;
160 if (neighbor_count[current_vert] != 2) {
164 const int offset = neighbor_offsets[current_vert];
165 const int next_a = neighbors[
offset];
166 const int next_b = neighbors[
offset + 1];
167 next_vert = (last_vert == next_a) ? next_b : next_a;
173 const int cyclic_start = curve_offsets.
size();
176 for (
const int start_vert :
verts.index_range()) {
177 if (unused_edges[start_vert] != 2) {
181 int current_vert = start_vert;
182 int next_vert = neighbors[neighbor_offsets[current_vert]];
185 vert_indices.
append(current_vert);
188 while (next_vert != start_vert) {
189 const int last_vert = current_vert;
190 current_vert = next_vert;
192 vert_indices.
append(current_vert);
193 unused_edges[current_vert]--;
194 unused_edges[last_vert]--;
196 const int offset = neighbor_offsets[current_vert];
197 const int next_a = neighbors[
offset];
198 const int next_b = neighbors[
offset + 1];
199 next_vert = (last_vert == next_a) ? next_b : next_a;
205 return {std::move(vert_indices), std::move(curve_offsets), cyclic_curves};
216 for (
const int i : selection) {
219 return selected_edges;
Low-level operations for curves.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to curves
ATTR_WARN_UNUSED_RESULT const BMVert * v2
const CPPType & type() const
constexpr IndexRange drop_front(int64_t n) const
constexpr int64_t size() const
void append(const T &value)
IndexRange index_range() const
void reserve(const int64_t min_capacity)
bool is_builtin(const AttributeIDRef &attribute_id) const
Set< AttributeIDRef > all_ids() const
GAttributeReader lookup(const AttributeIDRef &attribute_id) const
SyclQueue void void * src
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
AttributeAccessor mesh_attributes(const Mesh &mesh)
static Vector< std::pair< int, int > > get_selected_edges(const Mesh &mesh, const IndexMask selection)
bke::CurvesGeometry create_curve_from_vert_indices(const Mesh &mesh, Span< int > vert_indices, Span< int > curve_offsets, IndexRange cyclic_curves)
static CurveFromEdgesOutput edges_to_curve_point_indices(Span< MVert > verts, Span< std::pair< int, int >> edges)
bke::CurvesGeometry mesh_to_curve_convert(const Mesh &mesh, const IndexMask selection)
static void copy_with_map(const VArray< T > &src, Span< int > map, MutableSpan< T > dst)
void parallel_for(IndexRange range, int64_t grain_size, const Function &function)
void devirtualize_varray(const VArray< T > &varray, const Func &func, bool enable=true)
SocketIndexByIdentifierMap * map
Vector< int > curve_offsets
Vector< int > vert_indices