33 int i, i_prev =
len - 1;
34 for (i = 0; i <
len; i++) {
36 if (vert_arr[i] ==
nullptr) {
46 int i, i_prev =
len - 1;
47 for (i = 0; i <
len; i++) {
49 if (edge_arr[i_prev] ==
nullptr) {
59 int i, i_prev =
len - 1;
60 for (i = 0; i <
len; i++) {
88 }
while ((l_iter = l_iter->
next) != l_first);
95 if (l_other && l_other != l_iter) {
100 if (l_other->
v == l_iter->
v) {
102 l_src[1] = l_other->
next;
105 l_src[0] = l_other->
next;
109 for (j = 0; j < 2; j++) {
112 if ((filter_fn ==
nullptr) || filter_fn(l_src[j], user_data)) {
119 }
while ((l_iter = l_iter->
next) != l_first);
124 }
while ((l_iter = l_iter->
next) != l_first);
146 for (i = 0; i <
len; i++) {
155 e_iter = e_first = v1->
e;
176 edges_sort[i] = e_iter;
179 verts_sort[i] = v_iter;
186 if (v_iter != verts_sort[0]) [[unlikely]] {
201 for (i = 0; i <
len; i++) {
235 const bool calc_winding,
236 const bool create_edges)
240 uint winding[2] = {0, 0};
241 int i, i_prev =
len - 1;
242 BMVert *v_winding[2] = {vert_arr[i_prev], vert_arr[0]};
246 for (i = 0; i <
len; i++) {
253 if (edge_arr[i] ==
nullptr) {
261 if (edge_arr[i]->
l) {
262 BMVert *test_v1, *test_v2;
265 winding[(vert_arr[i_prev] == test_v2)]++;
276 if (winding[0] < winding[1]) {
294 v_winding[winding[0]],
295 v_winding[winding[1]],
304 using AngleIndex = std::pair<float, int>;
308 float nor[3], cent[3];
309 int index_tangent = 0;
311 const float *far = vert_arr[index_tangent]->
co;
314 for (
int i = 0; i <
len; i++) {
317 vert_arr_map[i] = vert_arr[i];
321 std::ranges::sort(vang,
322 [](
const AngleIndex &a,
const AngleIndex &
b) {
return a.first <
b.first; });
326 for (
int i = 0; i <
len; i++) {
327 vert_arr[i] = vert_arr_map[vang[i].second];
433 }
while ((l_iter = l_iter->
next) != l_first);
437 if (f_new ==
nullptr) [[unlikely]] {
455 }
while ((l_iter = l_iter->
next) != l_first);
478 const Mesh *me_src_array[],
479 const int me_src_array_len,
483 if (allocsize ==
nullptr) {
488 for (
int i = 0; i < me_src_array_len; i++) {
489 const Mesh *me_src = me_src_array[i];
494 attribute_info.
add(attr.name(), {attr.domain(), attr.data_type()});
498 for (
const int i : attribute_info.
names.index_range()) {
502 attribute_info.
kinds[i].data_type);
507 for (
int i = 0; i < me_src_array_len; i++) {
508 const Mesh *me_src = me_src_array[i];
534 if (allocsize ==
nullptr) {
558 if (allocsize ==
nullptr) {
570 for (
int i = 0; i < 4; i++) {
571 if (!(htypes[i] & htype)) {
576 const int size = *(&allocsize->
totvert + i);
591 BMVert *
v, *v_new, **vtable =
nullptr;
592 BMEdge *
e, *e_new, **etable =
nullptr;
593 BMFace *f, *f_new, **ftable =
nullptr;
682 eletable =
reinterpret_cast<BMElem **
>(vtable);
685 eletable =
reinterpret_cast<BMElem **
>(etable);
688 eletable =
reinterpret_cast<BMElem **
>(ftable);
CustomData interface, see also DNA_customdata_types.h.
Read Blender memory allocation and freeing.
#define BLI_assert_unreachable()
#define BM_ELEM_SELECT_UV_EDGE
#define BM_FACE_FIRST_LOOP(p)
#define BM_elem_index_get(ele)
#define BM_elem_index_set(ele, index)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
#define BM_select_history_store(bm, ele)
#define BMALLOC_TEMPLATE_FROM_BM(bm)
#define BM_ELEM_API_FLAG_DISABLE(element, f)
#define BM_ELEM_API_FLAG_TEST(element, f)
#define BM_ELEM_API_FLAG_ENABLE(element, f)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
std::optional< eCustomDataType > attr_type_to_custom_data_type(AttrType attr_type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
BMFace * BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len, const BMFace *f_example, const eBMCreateFlag create_flag, const bool create_edges)
void BM_mesh_copy_init_customdata(BMesh *bm_dst, BMesh *bm_src, const BMAllocTemplate *allocsize)
bool CustomData_merge_layout(const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
MINLINE void copy_v3_v3(float r[3], const float a[3])
static bool bm_edges_sort_winding(BMVert *v1, BMVert *v2, BMEdge **edges, const int len, BMEdge **edges_sort, BMVert **verts_sort)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
ATTR_WARN_UNUSED_RESULT const BMLoop * l
BMCustomDataCopyMap CustomData_bmesh_copy_map_calc(const CustomData &src, const CustomData &dst, eCustomDataMask mask_exclude=0)
BMVert * BM_edge_share_vert(BMEdge *e1, BMEdge *e2)
bool BM_verts_from_edges(BMVert **vert_arr, BMEdge **edge_arr, const int len)
void BM_verts_calc_normal_from_cloud_ex(BMVert **varr, int varr_len, float r_normal[3], float r_center[3], int *r_index_tangent)
ATTR_WARN_UNUSED_RESULT const BMVert * v
void CustomData_bmesh_copy_block(CustomData &data, void *src_block, void **dst_block)
BMVert * BM_vert_create(BMesh *bm, const float co[3], const BMVert *v_example, const eBMCreateFlag create_flag)
Main function for creating a new vertex.
BMFace * BM_face_create(BMesh *bm, BMVert *const *verts, BMEdge *const *edges, const int len, const BMFace *f_example, const eBMCreateFlag create_flag)
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BMFace * BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4, const BMFace *f_example, const eBMCreateFlag create_flag)
Make Quad/Triangle.
void CustomData_init_layout_from(const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
float angle_signed_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
BMesh * BM_mesh_copy(BMesh *bm_old)
bool BM_edges_from_verts(BMEdge **edge_arr, BMVert **vert_arr, const int len)
void BM_face_copy_shared(BMesh *bm, BMFace *f, BMLoopFilterFunc filter_fn, void *user_data)
copies face loop data from shared adjacent faces.
void * CustomData_add_layer_named(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem, StringRef name)
void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select)
void BM_elem_select_copy(BMesh *bm_dst, void *ele_dst_v, const void *ele_src_v)
const CustomData_MeshMasks CD_MASK_BMESH
const BMAllocTemplate bm_mesh_allocsize_default
void BM_edge_ordered_verts(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
static BMFace * bm_mesh_copy_new_face(BMesh *bm_new, const BMCustomDataCopyMap &face_map, const BMCustomDataCopyMap &loop_map, BMVert **vtable, BMEdge **etable, BMFace *f)
BMFace * BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len, const BMFace *f_example, const eBMCreateFlag create_flag, const bool calc_winding, const bool create_edges)
void BM_verts_sort_radial_plane(BMVert **vert_arr, int len)
void BM_edges_from_verts_ensure(BMesh *bm, BMEdge **edge_arr, BMVert **vert_arr, const int len)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
void BM_mesh_copy_init_customdata_all_layers(BMesh *bm_dst, BMesh *bm_src, const char htype, const BMAllocTemplate *allocsize)
BMFace * BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, const int len, const BMFace *f_example, const eBMCreateFlag create_flag)
Make NGon.
void CustomData_bmesh_init_pool(CustomData *data, int totelem, char htype)
BLI_INLINE BMEdge * bmesh_disk_edge_next(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BM_mesh_copy_init_customdata_from_mesh_array(BMesh *bm_dst, const Mesh *me_src_array[], const int me_src_array_len, const BMAllocTemplate *allocsize)
void BM_elem_attrs_copy(BMesh *bm, const BMCustomDataCopyMap &map, const BMVert *src, BMVert *dst)
bool(*)(const BMLoop *, void *user_data) BMLoopFilterFunc
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const BMeshCreateParams *params)
BMesh Make Mesh.
void BM_mesh_copy_init_customdata_from_mesh(BMesh *bm_dst, const Mesh *me_src, const BMAllocTemplate *allocsize)
BMEdge * BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, const eBMCreateFlag create_flag)
Main function for creating a new edge.
bool BM_attribute_stored_in_bmesh_builtin(const StringRef name)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static CustomData & get_bmesh_custom_data(BMesh &bm, const bke::AttrDomain domain)
struct BMLoop * radial_next
ListBaseT< BMEditSelection > selected
struct AttributeStorage attribute_storage
void add(const StringRef name, const AttributeDomainAndType &kind)
Vector< AttributeDomainAndType, 16 > kinds
VectorSet< StringRef, 16 > names