BMesh: remove BM_face_create_ngon_vcloud
Instead, add BM_verts_sort_radial_plane and use regular creation API.
This commit is contained in:
parent
53e7a4a83c
commit
2a2ae9c3fa
|
@ -387,15 +387,11 @@ BMFace *BM_face_create_ngon_verts(
|
|||
*
|
||||
* \note Since this is a vcloud there is no direction.
|
||||
*/
|
||||
BMFace *BM_face_create_ngon_vcloud(
|
||||
BMesh *bm, BMVert **vert_arr, int len,
|
||||
const BMFace *f_example, const eBMCreateFlag create_flag)
|
||||
void BM_verts_sort_radial_plane(BMVert **vert_arr, int len)
|
||||
{
|
||||
struct SortIntByFloat *vang = BLI_array_alloca(vang, len);
|
||||
BMVert **vert_arr_map = BLI_array_alloca(vert_arr_map, len);
|
||||
|
||||
BMFace *f;
|
||||
|
||||
float totv_inv = 1.0f / (float)len;
|
||||
int i = 0;
|
||||
|
||||
|
@ -472,6 +468,7 @@ BMFace *BM_face_create_ngon_vcloud(
|
|||
for (i = 0; i < len; i++) {
|
||||
vang[i].sort_value = angle_signed_on_axis_v3v3v3_v3(far, cent, vert_arr[i]->co, nor);
|
||||
vang[i].data = i;
|
||||
vert_arr_map[i] = vert_arr[i];
|
||||
}
|
||||
|
||||
/* sort by angle and magic! - we have our ngon */
|
||||
|
@ -479,14 +476,9 @@ BMFace *BM_face_create_ngon_vcloud(
|
|||
|
||||
/* --- */
|
||||
|
||||
/* create edges and find the winding (if faces are attached to any existing edges) */
|
||||
for (i = 0; i < len; i++) {
|
||||
vert_arr_map[i] = vert_arr[vang[i].data];
|
||||
vert_arr[i] = vert_arr_map[vang[i].data];
|
||||
}
|
||||
|
||||
f = BM_face_create_ngon_verts(bm, vert_arr_map, len, f_example, create_flag, true, true);
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
|
|
|
@ -34,6 +34,9 @@ bool BM_verts_from_edges(BMVert **vert_arr, BMEdge **edge_arr, const int len);
|
|||
bool BM_edges_from_verts(BMEdge **edge_arr, BMVert **vert_arr, const int len);
|
||||
void BM_edges_from_verts_ensure(BMesh *bm, BMEdge **edge_arr, BMVert **vert_arr, const int len);
|
||||
|
||||
/* sort before creation */
|
||||
void BM_verts_sort_radial_plane(BMVert **vert_arr, int len);
|
||||
|
||||
BMFace *BM_face_create_quad_tri(
|
||||
BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
|
||||
const BMFace *f_example, const eBMCreateFlag create_flag);
|
||||
|
@ -50,10 +53,6 @@ BMFace *BM_face_create_ngon_verts(
|
|||
const BMFace *f_example, const eBMCreateFlag create_flag,
|
||||
const bool calc_winding, const bool create_edges);
|
||||
|
||||
BMFace *BM_face_create_ngon_vcloud(
|
||||
BMesh *bm, BMVert **vert_arr, int len,
|
||||
const BMFace *f_example, const eBMCreateFlag create_flag);
|
||||
|
||||
void BM_elem_attrs_copy_ex(
|
||||
BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v,
|
||||
const char hflag_mask);
|
||||
|
|
|
@ -290,7 +290,11 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
|||
BMFace *f;
|
||||
|
||||
BMO_iter_as_array(op->slots_in, "geom", BM_VERT, (void **)vert_arr, totv);
|
||||
f = BM_face_create_ngon_vcloud(bm, vert_arr, totv, NULL, BM_CREATE_NO_DOUBLE);
|
||||
|
||||
BM_verts_sort_radial_plane(vert_arr, totv);
|
||||
|
||||
/* create edges and find the winding (if faces are attached to any existing edges) */
|
||||
f = BM_face_create_ngon_verts(bm, vert_arr, totv, NULL, BM_CREATE_NO_DOUBLE, true, true);
|
||||
|
||||
if (f) {
|
||||
BMO_face_flag_enable(bm, f, ELE_OUT);
|
||||
|
|
Loading…
Reference in New Issue