code cleanup: de-duplicate bmesh face creation code,
This commit is contained in:
@@ -185,7 +185,7 @@ BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, i
|
|||||||
BLI_array_append(edges2, e);
|
BLI_array_append(edges2, e);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
e2 = bm_disk_edge_next(e2, v);
|
e2 = bmesh_disk_edge_next(e2, v);
|
||||||
if (e2 != e && BM_ELEM_API_FLAG_TEST(e2, _FLAG_MF)) {
|
if (e2 != e && BM_ELEM_API_FLAG_TEST(e2, _FLAG_MF)) {
|
||||||
v = BM_edge_other_vert(e2, v);
|
v = BM_edge_other_vert(e2, v);
|
||||||
break;
|
break;
|
||||||
|
@@ -52,7 +52,7 @@ static int bm_edge_splice(BMesh *bm, BMEdge *e, BMEdge *etarget);
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BMVert *BM_vert_create(BMesh *bm, const float co[3], const struct BMVert *example)
|
BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example)
|
||||||
{
|
{
|
||||||
BMVert *v = BLI_mempool_calloc(bm->vpool);
|
BMVert *v = BLI_mempool_calloc(bm->vpool);
|
||||||
|
|
||||||
@@ -236,6 +236,40 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short co
|
|||||||
return f2;
|
return f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* only create the face, since this calloc's the length is initialized to 0,
|
||||||
|
* leave adding loops to the caller.
|
||||||
|
*/
|
||||||
|
BM_INLINE BMFace *bm_face_create__internal(BMesh *bm)
|
||||||
|
{
|
||||||
|
BMFace *f;
|
||||||
|
|
||||||
|
f = BLI_mempool_calloc(bm->fpool);
|
||||||
|
|
||||||
|
#ifdef USE_DEBUG_INDEX_MEMCHECK
|
||||||
|
DEBUG_MEMCHECK_INDEX_INVALIDATE(f)
|
||||||
|
#else
|
||||||
|
BM_elem_index_set(f, -1); /* set_ok_invalid */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bm->elem_index_dirty |= BM_FACE; /* may add to middle of the pool */
|
||||||
|
|
||||||
|
bm->totface++;
|
||||||
|
|
||||||
|
f->head.htype = BM_FACE;
|
||||||
|
|
||||||
|
/* allocate flag */
|
||||||
|
f->oflags = BLI_mempool_calloc(bm->toolflagpool);
|
||||||
|
|
||||||
|
CustomData_bmesh_set_default(&bm->pdata, &f->head.data);
|
||||||
|
|
||||||
|
#ifdef USE_BMESH_HOLES
|
||||||
|
f->totbounds = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, int nodouble)
|
BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, int nodouble)
|
||||||
{
|
{
|
||||||
BMFace *f = NULL;
|
BMFace *f = NULL;
|
||||||
@@ -258,19 +292,7 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f = BLI_mempool_calloc(bm->fpool);
|
f = bm_face_create__internal(bm);
|
||||||
|
|
||||||
#ifdef USE_DEBUG_INDEX_MEMCHECK
|
|
||||||
DEBUG_MEMCHECK_INDEX_INVALIDATE(f)
|
|
||||||
#else
|
|
||||||
BM_elem_index_set(f, -1); /* set_ok_invalid */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bm->elem_index_dirty |= BM_FACE; /* may add to middle of the pool */
|
|
||||||
|
|
||||||
bm->totface++;
|
|
||||||
|
|
||||||
f->head.htype = BM_FACE;
|
|
||||||
|
|
||||||
startl = lastl = bm_face_boundary_add(bm, f, verts[0], edges[0]);
|
startl = lastl = bm_face_boundary_add(bm, f, verts[0], edges[0]);
|
||||||
|
|
||||||
@@ -287,20 +309,11 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
|
|||||||
lastl = l;
|
lastl = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate flag */
|
|
||||||
f->oflags = BLI_mempool_calloc(bm->toolflagpool);
|
|
||||||
|
|
||||||
CustomData_bmesh_set_default(&bm->pdata, &f->head.data);
|
|
||||||
|
|
||||||
startl->prev = lastl;
|
startl->prev = lastl;
|
||||||
lastl->next = startl;
|
lastl->next = startl;
|
||||||
|
|
||||||
f->len = len;
|
f->len = len;
|
||||||
|
|
||||||
#ifdef USE_BMESH_HOLES
|
|
||||||
f->totbounds = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BM_CHECK_ELEMENT(bm, f);
|
BM_CHECK_ELEMENT(bm, f);
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
@@ -608,7 +621,7 @@ void BM_vert_kill(BMesh *bm, BMVert *v)
|
|||||||
|
|
||||||
e = v->e;
|
e = v->e;
|
||||||
while (v->e) {
|
while (v->e) {
|
||||||
nexte = bm_disk_edge_next(e, v);
|
nexte = bmesh_disk_edge_next(e, v);
|
||||||
BM_edge_kill(bm, e);
|
BM_edge_kill(bm, e);
|
||||||
e = nexte;
|
e = nexte;
|
||||||
}
|
}
|
||||||
@@ -804,7 +817,7 @@ static int UNUSED_FUNCTION(count_flagged_disk)(BMVert *v, int flag)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
i += BM_ELEM_API_FLAG_TEST(e, flag) ? 1 : 0;
|
i += BM_ELEM_API_FLAG_TEST(e, flag) ? 1 : 0;
|
||||||
e = bm_disk_edge_next(e, v);
|
e = bmesh_disk_edge_next(e, v);
|
||||||
} while (e != v->e);
|
} while (e != v->e);
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
@@ -834,7 +847,7 @@ static int disk_is_flagged(BMVert *v, int flag)
|
|||||||
l = l->radial_next;
|
l = l->radial_next;
|
||||||
} while (l != e->l);
|
} while (l != e->l);
|
||||||
|
|
||||||
e = bm_disk_edge_next(e, v);
|
e = bmesh_disk_edge_next(e, v);
|
||||||
} while (e != v->e);
|
} while (e != v->e);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1034,40 +1047,20 @@ error:
|
|||||||
|
|
||||||
/* BMESH_TODO - this is only used once, investigate sharing code with BM_face_create
|
/* BMESH_TODO - this is only used once, investigate sharing code with BM_face_create
|
||||||
*/
|
*/
|
||||||
static BMFace *bm_face_create__internal(BMesh *bm, BMFace *UNUSED(example))
|
static BMFace *bm_face_create__sfme(BMesh *bm, BMFace *UNUSED(example))
|
||||||
{
|
{
|
||||||
BMFace *f;
|
BMFace *f;
|
||||||
#ifdef USE_BMESH_HOLES
|
#ifdef USE_BMESH_HOLES
|
||||||
BMLoopList *lst;
|
BMLoopList *lst;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
f = BLI_mempool_calloc(bm->fpool);
|
f = bm_face_create__internal(bm);
|
||||||
|
|
||||||
#ifdef USE_BMESH_HOLES
|
#ifdef USE_BMESH_HOLES
|
||||||
lst = BLI_mempool_calloc(bm->looplistpool);
|
lst = BLI_mempool_calloc(bm->looplistpool);
|
||||||
#endif
|
|
||||||
|
|
||||||
f->head.htype = BM_FACE;
|
|
||||||
#ifdef USE_BMESH_HOLES
|
|
||||||
BLI_addtail(&f->loops, lst);
|
BLI_addtail(&f->loops, lst);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_DEBUG_INDEX_MEMCHECK
|
|
||||||
DEBUG_MEMCHECK_INDEX_INVALIDATE(f)
|
|
||||||
#else
|
|
||||||
BM_elem_index_set(f, -1); /* set_ok_invalid */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bm->elem_index_dirty |= BM_FACE; /* may add to middle of the pool */
|
|
||||||
|
|
||||||
bm->totface++;
|
|
||||||
|
|
||||||
/* allocate flag */
|
|
||||||
f->oflags = BLI_mempool_calloc(bm->toolflagpool);
|
|
||||||
|
|
||||||
CustomData_bmesh_set_default(&bm->pdata, &f->head.data);
|
|
||||||
|
|
||||||
f->len = 0;
|
|
||||||
|
|
||||||
#ifdef USE_BMESH_HOLES
|
#ifdef USE_BMESH_HOLES
|
||||||
f->totbounds = 1;
|
f->totbounds = 1;
|
||||||
#endif
|
#endif
|
||||||
@@ -1144,7 +1137,7 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
|
|||||||
/* allocate new edge between v1 and v2 */
|
/* allocate new edge between v1 and v2 */
|
||||||
e = BM_edge_create(bm, v1, v2, example, FALSE);
|
e = BM_edge_create(bm, v1, v2, example, FALSE);
|
||||||
|
|
||||||
f2 = bm_face_create__internal(bm, f);
|
f2 = bm_face_create__sfme(bm, f);
|
||||||
f1loop = bm_loop_create(bm, v2, e, f, v2loop);
|
f1loop = bm_loop_create(bm, v2, e, f, v2loop);
|
||||||
f2loop = bm_loop_create(bm, v1, e, f2, v1loop);
|
f2loop = bm_loop_create(bm, v1, e, f2, v1loop);
|
||||||
|
|
||||||
@@ -1436,7 +1429,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
|
|||||||
len = bmesh_disk_count(kv);
|
len = bmesh_disk_count(kv);
|
||||||
|
|
||||||
if (len == 2) {
|
if (len == 2) {
|
||||||
oe = bm_disk_edge_next(ke, kv);
|
oe = bmesh_disk_edge_next(ke, kv);
|
||||||
tv = bmesh_edge_other_vert_get(ke, kv);
|
tv = bmesh_edge_other_vert_get(ke, kv);
|
||||||
ov = bmesh_edge_other_vert_get(oe, kv);
|
ov = bmesh_edge_other_vert_get(oe, kv);
|
||||||
halt = bmesh_verts_in_edge(kv, tv, oe); /* check for double edge */
|
halt = bmesh_verts_in_edge(kv, tv, oe); /* check for double edge */
|
||||||
@@ -1953,7 +1946,7 @@ static BMVert *bm_urmv_loop(BMesh *bm, BMLoop *sl)
|
|||||||
* will leave the original sv on some *other* fan (not the
|
* will leave the original sv on some *other* fan (not the
|
||||||
* one-face fan that holds the unglue face). */
|
* one-face fan that holds the unglue face). */
|
||||||
while (sv->e == sl->e || sv->e == sl->prev->e) {
|
while (sv->e == sl->e || sv->e == sl->prev->e) {
|
||||||
sv->e = bm_disk_edge_next(sv->e, sv);
|
sv->e = bmesh_disk_edge_next(sv->e, sv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Split all fans connected to the vert, duplicating it for
|
/* Split all fans connected to the vert, duplicating it for
|
||||||
|
@@ -53,7 +53,7 @@ const char bm_iter_itype_htype_map[BM_ITYPE_MAX] = {
|
|||||||
/*
|
/*
|
||||||
* note, we have BM_vert_at_index/BM_edge_at_index/BM_face_at_index for arrays
|
* note, we have BM_vert_at_index/BM_edge_at_index/BM_face_at_index for arrays
|
||||||
*/
|
*/
|
||||||
void *BM_iter_at_index(struct BMesh *bm, const char itype, void *data, int index)
|
void *BM_iter_at_index(BMesh *bm, const char itype, void *data, int index)
|
||||||
{
|
{
|
||||||
BMIter iter;
|
BMIter iter;
|
||||||
void *val;
|
void *val;
|
||||||
@@ -83,7 +83,7 @@ void *BM_iter_at_index(struct BMesh *bm, const char itype, void *data, int index
|
|||||||
* to avoid multiple calls to BM_iter_at_index.
|
* to avoid multiple calls to BM_iter_at_index.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int BM_iter_as_array(struct BMesh *bm, const char type, void *data, void **array, const int len)
|
int BM_iter_as_array(BMesh *bm, const char type, void *data, void **array, const int len)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ void *bmiter__edge_of_vert_step(BMIter *iter)
|
|||||||
BMEdge *current = iter->nextedge;
|
BMEdge *current = iter->nextedge;
|
||||||
|
|
||||||
if (iter->nextedge)
|
if (iter->nextedge)
|
||||||
iter->nextedge = bm_disk_edge_next(iter->nextedge, iter->vdata);
|
iter->nextedge = bmesh_disk_edge_next(iter->nextedge, iter->vdata);
|
||||||
|
|
||||||
if (iter->nextedge == iter->firstedge) iter->nextedge = NULL;
|
if (iter->nextedge == iter->firstedge) iter->nextedge = NULL;
|
||||||
|
|
||||||
|
@@ -452,7 +452,7 @@ void BM_select_mode_set(BMesh *bm, int selectmode)
|
|||||||
/**
|
/**
|
||||||
* counts number of elements with flag set
|
* counts number of elements with flag set
|
||||||
*/
|
*/
|
||||||
int BM_mesh_count_flag(struct BMesh *bm, const char htype, const char hflag, int respecthide)
|
int BM_mesh_count_flag(BMesh *bm, const char htype, const char hflag, int respecthide)
|
||||||
{
|
{
|
||||||
BMElem *ele;
|
BMElem *ele;
|
||||||
BMIter iter;
|
BMIter iter;
|
||||||
@@ -484,7 +484,7 @@ int BM_mesh_count_flag(struct BMesh *bm, const char htype, const char hflag, int
|
|||||||
* \note use BM_elem_flag_test(ele, BM_ELEM_SELECT) to test selection
|
* \note use BM_elem_flag_test(ele, BM_ELEM_SELECT) to test selection
|
||||||
* \note by design, this will not touch the editselection history stuff
|
* \note by design, this will not touch the editselection history stuff
|
||||||
*/
|
*/
|
||||||
void _bm_elem_select_set(struct BMesh *bm, BMHeader *head, int select)
|
void _bm_elem_select_set(BMesh *bm, BMHeader *head, int select)
|
||||||
{
|
{
|
||||||
switch (head->htype) {
|
switch (head->htype) {
|
||||||
case BM_VERT:
|
case BM_VERT:
|
||||||
|
@@ -113,7 +113,7 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
|
|||||||
/* v->e we keep, what else */
|
/* v->e we keep, what else */
|
||||||
e = v->e;
|
e = v->e;
|
||||||
do {
|
do {
|
||||||
e = bm_disk_edge_next(e, v);
|
e = bmesh_disk_edge_next(e, v);
|
||||||
if (!(BM_edge_share_face_count(e, v->e))) {
|
if (!(BM_edge_share_face_count(e, v->e))) {
|
||||||
keepedge = e;
|
keepedge = e;
|
||||||
baseedge = v->e;
|
baseedge = v->e;
|
||||||
@@ -180,7 +180,7 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
|
|||||||
done = 0;
|
done = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
e = bm_disk_edge_next(e, v);
|
e = bmesh_disk_edge_next(e, v);
|
||||||
} while (e != v->e);
|
} while (e != v->e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,7 +426,7 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
|
|||||||
/* now interpolate the vertex data */
|
/* now interpolate the vertex data */
|
||||||
BM_data_interp_from_verts(bm, kv, tv, kv, fac);
|
BM_data_interp_from_verts(bm, kv, tv, kv, fac);
|
||||||
|
|
||||||
e2 = bm_disk_edge_next(ke, kv);
|
e2 = bmesh_disk_edge_next(ke, kv);
|
||||||
tv2 = BM_edge_other_vert(e2, kv);
|
tv2 = BM_edge_other_vert(e2, kv);
|
||||||
|
|
||||||
if (join_faces) {
|
if (join_faces) {
|
||||||
|
@@ -338,7 +338,7 @@ void BMO_slot_bool_set(BMOperator *op, const char *slotname, const int i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* only supports square mats */
|
/* only supports square mats */
|
||||||
void BMO_slot_mat_set(struct BMOperator *op, const char *slotname, const float *mat, int size)
|
void BMO_slot_mat_set(BMOperator *op, const char *slotname, const float *mat, int size)
|
||||||
{
|
{
|
||||||
BMOpSlot *slot = BMO_slot_get(op, slotname);
|
BMOpSlot *slot = BMO_slot_get(op, slotname);
|
||||||
BLI_assert(slot->slottype == BMO_OP_SLOT_MAT);
|
BLI_assert(slot->slottype == BMO_OP_SLOT_MAT);
|
||||||
@@ -361,7 +361,7 @@ void BMO_slot_mat_set(struct BMOperator *op, const char *slotname, const float *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BMO_slot_mat4_get(struct BMOperator *op, const char *slotname, float r_mat[4][4])
|
void BMO_slot_mat4_get(BMOperator *op, const char *slotname, float r_mat[4][4])
|
||||||
{
|
{
|
||||||
BMOpSlot *slot = BMO_slot_get(op, slotname);
|
BMOpSlot *slot = BMO_slot_get(op, slotname);
|
||||||
BLI_assert(slot->slottype == BMO_OP_SLOT_MAT);
|
BLI_assert(slot->slottype == BMO_OP_SLOT_MAT);
|
||||||
@@ -371,7 +371,7 @@ void BMO_slot_mat4_get(struct BMOperator *op, const char *slotname, float r_mat[
|
|||||||
copy_m4_m4(r_mat, (float (*)[4])slot->data.p);
|
copy_m4_m4(r_mat, (float (*)[4])slot->data.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BMO_slot_mat3_set(struct BMOperator *op, const char *slotname, float r_mat[3][3])
|
void BMO_slot_mat3_set(BMOperator *op, const char *slotname, float r_mat[3][3])
|
||||||
{
|
{
|
||||||
BMOpSlot *slot = BMO_slot_get(op, slotname);
|
BMOpSlot *slot = BMO_slot_get(op, slotname);
|
||||||
BLI_assert(slot->slottype == BMO_OP_SLOT_MAT);
|
BLI_assert(slot->slottype == BMO_OP_SLOT_MAT);
|
||||||
@@ -510,7 +510,7 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char hty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int BMO_slot_buf_count(struct BMesh *UNUSED(bm), struct BMOperator *op, const char *slotname)
|
int BMO_slot_buf_count(BMesh *UNUSED(bm), BMOperator *op, const char *slotname)
|
||||||
{
|
{
|
||||||
BMOpSlot *slot = BMO_slot_get(op, slotname);
|
BMOpSlot *slot = BMO_slot_get(op, slotname);
|
||||||
BLI_assert(slot->slottype > BMO_OP_SLOT_VEC);
|
BLI_assert(slot->slottype > BMO_OP_SLOT_VEC);
|
||||||
@@ -603,7 +603,7 @@ void *BMO_Grow_Array(BMesh *bm, BMOperator *op, int slotcode, int totadd)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void BMO_slot_map_to_flag(struct BMesh *bm, struct BMOperator *op,
|
void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op,
|
||||||
const char *slotname, const short oflag)
|
const char *slotname, const short oflag)
|
||||||
{
|
{
|
||||||
GHashIterator it;
|
GHashIterator it;
|
||||||
@@ -859,7 +859,7 @@ int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag)
|
|||||||
for (i = 0, curedge = v->e; i < len; i++) {
|
for (i = 0, curedge = v->e; i < len; i++) {
|
||||||
if (BMO_elem_flag_test(bm, curedge, oflag))
|
if (BMO_elem_flag_test(bm, curedge, oflag))
|
||||||
count++;
|
count++;
|
||||||
curedge = bm_disk_edge_next(curedge, v);
|
curedge = bmesh_disk_edge_next(curedge, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1096,7 +1096,7 @@ void *BMO_iter_step(BMOIter *iter)
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
else if (iter->slot->slottype == BMO_OP_SLOT_MAPPING) {
|
else if (iter->slot->slottype == BMO_OP_SLOT_MAPPING) {
|
||||||
struct BMOElemMapping *map;
|
BMOElemMapping *map;
|
||||||
void *ret = BLI_ghashIterator_getKey(&iter->giter);
|
void *ret = BLI_ghashIterator_getKey(&iter->giter);
|
||||||
map = BLI_ghashIterator_getValue(&iter->giter);
|
map = BLI_ghashIterator_getValue(&iter->giter);
|
||||||
|
|
||||||
|
@@ -262,7 +262,7 @@ int BM_vert_is_wire(BMesh *UNUSED(bm), BMVert *v)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
curedge = bm_disk_edge_next(curedge, v);
|
curedge = bmesh_disk_edge_next(curedge, v);
|
||||||
} while (curedge != v->e);
|
} while (curedge != v->e);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -297,7 +297,7 @@ int BM_vert_is_manifold(BMesh *UNUSED(bm), BMVert *v)
|
|||||||
|
|
||||||
/* count edges while looking for non-manifold edges */
|
/* count edges while looking for non-manifold edges */
|
||||||
oe = v->e;
|
oe = v->e;
|
||||||
for (len = 0, e = v->e; e != oe || (e == oe && len == 0); len++, e = bm_disk_edge_next(e, v)) {
|
for (len = 0, e = v->e; e != oe || (e == oe && len == 0); len++, e = bmesh_disk_edge_next(e, v)) {
|
||||||
if (e->l == NULL) {
|
if (e->l == NULL) {
|
||||||
/* loose edge */
|
/* loose edge */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -413,7 +413,7 @@ int BM_edge_share_face_count(BMEdge *e1, BMEdge *e2)
|
|||||||
/**
|
/**
|
||||||
* Tests to see if e1 shares a vertex with e2
|
* Tests to see if e1 shares a vertex with e2
|
||||||
*/
|
*/
|
||||||
int BM_edge_share_vert_count(struct BMEdge *e1, struct BMEdge *e2)
|
int BM_edge_share_vert_count(BMEdge *e1, BMEdge *e2)
|
||||||
{
|
{
|
||||||
return (e1->v1 == e2->v1 ||
|
return (e1->v1 == e2->v1 ||
|
||||||
e1->v1 == e2->v2 ||
|
e1->v1 == e2->v2 ||
|
||||||
@@ -424,7 +424,7 @@ int BM_edge_share_vert_count(struct BMEdge *e1, struct BMEdge *e2)
|
|||||||
/**
|
/**
|
||||||
* Return the shared vertex between the two edges or NULL
|
* Return the shared vertex between the two edges or NULL
|
||||||
*/
|
*/
|
||||||
BMVert *BM_edge_share_vert(struct BMEdge *e1, struct BMEdge *e2)
|
BMVert *BM_edge_share_vert(BMEdge *e1, BMEdge *e2)
|
||||||
{
|
{
|
||||||
if (BM_vert_in_edge(e2, e1->v1)) {
|
if (BM_vert_in_edge(e2, e1->v1)) {
|
||||||
return e1->v1;
|
return e1->v1;
|
||||||
@@ -507,9 +507,9 @@ float BM_vert_edge_angle(BMesh *UNUSED(bm), BMVert *v)
|
|||||||
* get the edges and count them both at once */
|
* get the edges and count them both at once */
|
||||||
|
|
||||||
if ((e1 = v->e) &&
|
if ((e1 = v->e) &&
|
||||||
(e2 = bm_disk_edge_next(e1, v)) &&
|
(e2 = bmesh_disk_edge_next(e1, v)) &&
|
||||||
/* make sure we come full circle and only have 2 connected edges */
|
/* make sure we come full circle and only have 2 connected edges */
|
||||||
(e1 == bm_disk_edge_next(e2, v)))
|
(e1 == bmesh_disk_edge_next(e2, v)))
|
||||||
{
|
{
|
||||||
BMVert *v1 = BM_edge_other_vert(e1, v);
|
BMVert *v1 = BM_edge_other_vert(e1, v);
|
||||||
BMVert *v2 = BM_edge_other_vert(e2, v);
|
BMVert *v2 = BM_edge_other_vert(e2, v);
|
||||||
|
@@ -150,7 +150,7 @@ int bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv)
|
|||||||
* cycle order and all non-manifold conditions are represented trivially.
|
* cycle order and all non-manifold conditions are represented trivially.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int bmesh_disk_edge_append(struct BMEdge *e, struct BMVert *v)
|
int bmesh_disk_edge_append(BMEdge *e, BMVert *v)
|
||||||
{
|
{
|
||||||
if (!v->e) {
|
if (!v->e) {
|
||||||
BMDiskLink *dl1 = BM_DISK_EDGE_LINK_GET(e, v);
|
BMDiskLink *dl1 = BM_DISK_EDGE_LINK_GET(e, v);
|
||||||
@@ -176,7 +176,7 @@ int bmesh_disk_edge_append(struct BMEdge *e, struct BMVert *v)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bmesh_disk_edge_remove(struct BMEdge *e, struct BMVert *v)
|
void bmesh_disk_edge_remove(BMEdge *e, BMVert *v)
|
||||||
{
|
{
|
||||||
BMDiskLink *dl1, *dl2;
|
BMDiskLink *dl1, *dl2;
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ void bmesh_disk_edge_remove(struct BMEdge *e, struct BMVert *v)
|
|||||||
* Pointer to the next edge in the disk cycle for the vertex v.
|
* Pointer to the next edge in the disk cycle for the vertex v.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct BMEdge *bm_disk_edge_next(struct BMEdge *e, struct BMVert *v)
|
BMEdge *bmesh_disk_edge_next(BMEdge *e, BMVert *v)
|
||||||
{
|
{
|
||||||
if (v == e->v1)
|
if (v == e->v1)
|
||||||
return e->v1_disk_link.next;
|
return e->v1_disk_link.next;
|
||||||
@@ -215,7 +215,7 @@ struct BMEdge *bm_disk_edge_next(struct BMEdge *e, struct BMVert *v)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BMEdge *bm_disk_edge_prev(BMEdge *e, BMVert *v)
|
BMEdge *bmesh_disk_edge_prev(BMEdge *e, BMVert *v)
|
||||||
{
|
{
|
||||||
if (v == e->v1)
|
if (v == e->v1)
|
||||||
return e->v1_disk_link.prev;
|
return e->v1_disk_link.prev;
|
||||||
@@ -235,13 +235,13 @@ BMEdge *bmesh_disk_edge_exists(BMVert *v1, BMVert *v2)
|
|||||||
if (bmesh_verts_in_edge(v1, v2, e_iter)) {
|
if (bmesh_verts_in_edge(v1, v2, e_iter)) {
|
||||||
return e_iter;
|
return e_iter;
|
||||||
}
|
}
|
||||||
} while ((e_iter = bm_disk_edge_next(e_iter, v1)) != e_first);
|
} while ((e_iter = bmesh_disk_edge_next(e_iter, v1)) != e_first);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bmesh_disk_count(struct BMVert *v)
|
int bmesh_disk_count(BMVert *v)
|
||||||
{
|
{
|
||||||
if (v->e) {
|
if (v->e) {
|
||||||
BMEdge *e_first, *e_iter;
|
BMEdge *e_first, *e_iter;
|
||||||
@@ -259,7 +259,7 @@ int bmesh_disk_count(struct BMVert *v)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
} while ((e_iter = bm_disk_edge_next(e_iter, v)) != e_first);
|
} while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e_first);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -278,10 +278,10 @@ int bmesh_disk_validate(int len, BMEdge *e, BMVert *v)
|
|||||||
|
|
||||||
e_iter = e;
|
e_iter = e;
|
||||||
do {
|
do {
|
||||||
if (len != 1 && bm_disk_edge_prev(e_iter, v) == e_iter) {
|
if (len != 1 && bmesh_disk_edge_prev(e_iter, v) == e_iter) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} while ((e_iter = bm_disk_edge_next(e_iter, v)) != e);
|
} while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -308,7 +308,7 @@ int bmesh_disk_facevert_count(BMVert *v)
|
|||||||
if (e_iter->l) {
|
if (e_iter->l) {
|
||||||
count += bmesh_radial_facevert_count(e_iter->l, v);
|
count += bmesh_radial_facevert_count(e_iter->l, v);
|
||||||
}
|
}
|
||||||
} while ((e_iter = bm_disk_edge_next(e_iter, v)) != e_first);
|
} while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e_first);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -325,7 +325,7 @@ int bmesh_disk_facevert_count(BMVert *v)
|
|||||||
* to it.
|
* to it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct BMEdge *bmesh_disk_faceedge_find_first(struct BMEdge *e, struct BMVert *v)
|
BMEdge *bmesh_disk_faceedge_find_first(BMEdge *e, BMVert *v)
|
||||||
{
|
{
|
||||||
BMEdge *searchedge = NULL;
|
BMEdge *searchedge = NULL;
|
||||||
searchedge = e;
|
searchedge = e;
|
||||||
@@ -333,20 +333,20 @@ struct BMEdge *bmesh_disk_faceedge_find_first(struct BMEdge *e, struct BMVert *v
|
|||||||
if (searchedge->l && bmesh_radial_facevert_count(searchedge->l, v)) {
|
if (searchedge->l && bmesh_radial_facevert_count(searchedge->l, v)) {
|
||||||
return searchedge;
|
return searchedge;
|
||||||
}
|
}
|
||||||
} while ((searchedge = bm_disk_edge_next(searchedge, v)) != e);
|
} while ((searchedge = bmesh_disk_edge_next(searchedge, v)) != e);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BMEdge *bmesh_disk_faceedge_find_next(struct BMEdge *e, struct BMVert *v)
|
BMEdge *bmesh_disk_faceedge_find_next(BMEdge *e, BMVert *v)
|
||||||
{
|
{
|
||||||
BMEdge *searchedge = NULL;
|
BMEdge *searchedge = NULL;
|
||||||
searchedge = bm_disk_edge_next(e, v);
|
searchedge = bmesh_disk_edge_next(e, v);
|
||||||
do {
|
do {
|
||||||
if (searchedge->l && bmesh_radial_facevert_count(searchedge->l, v)) {
|
if (searchedge->l && bmesh_radial_facevert_count(searchedge->l, v)) {
|
||||||
return searchedge;
|
return searchedge;
|
||||||
}
|
}
|
||||||
} while ((searchedge = bm_disk_edge_next(searchedge, v)) != e);
|
} while ((searchedge = bmesh_disk_edge_next(searchedge, v)) != e);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,7 +47,8 @@ int bmesh_loop_validate(BMFace *f);
|
|||||||
/* DISK CYCLE MANAGMENT */
|
/* DISK CYCLE MANAGMENT */
|
||||||
int bmesh_disk_edge_append(BMEdge *e, BMVert *v);
|
int bmesh_disk_edge_append(BMEdge *e, BMVert *v);
|
||||||
void bmesh_disk_edge_remove(BMEdge *e, BMVert *v);
|
void bmesh_disk_edge_remove(BMEdge *e, BMVert *v);
|
||||||
BMEdge *bm_disk_edge_next(BMEdge *e, BMVert *v);
|
BMEdge *bmesh_disk_edge_next(BMEdge *e, BMVert *v);
|
||||||
|
BMEdge *bmesh_disk_edge_prev(BMEdge *e, BMVert *v);
|
||||||
int bmesh_disk_facevert_count(BMVert *v);
|
int bmesh_disk_facevert_count(BMVert *v);
|
||||||
BMEdge *bmesh_disk_faceedge_find_first(BMEdge *e, BMVert *v);
|
BMEdge *bmesh_disk_faceedge_find_first(BMEdge *e, BMVert *v);
|
||||||
BMEdge *bmesh_disk_faceedge_find_next(BMEdge *e, BMVert *v);
|
BMEdge *bmesh_disk_faceedge_find_next(BMEdge *e, BMVert *v);
|
||||||
|
@@ -152,7 +152,7 @@ static int BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
e = v->e;
|
e = v->e;
|
||||||
elast = bm_disk_edge_next(e, v);
|
elast = bmesh_disk_edge_next(e, v);
|
||||||
|
|
||||||
/* BMESH_TODO, figure out if its possible we had a double edge here and need to splice it,
|
/* BMESH_TODO, figure out if its possible we had a double edge here and need to splice it,
|
||||||
* last bool arg */
|
* last bool arg */
|
||||||
@@ -274,7 +274,7 @@ static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
e1 = v->e; /* we just use the first two edges */
|
e1 = v->e; /* we just use the first two edges */
|
||||||
e2 = bm_disk_edge_next(v->e, v);
|
e2 = bmesh_disk_edge_next(v->e, v);
|
||||||
if (e1 == e2) {
|
if (e1 == e2) {
|
||||||
//printf("You need at least two edges to use BME_bevel_split_edge()\n");
|
//printf("You need at least two edges to use BME_bevel_split_edge()\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -964,7 +964,7 @@ static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int option
|
|||||||
BM_face_split(bm, l->f, l->next->v, l->prev->v, &l, l->e); /* clip this corner off */
|
BM_face_split(bm, l->f, l->next->v, l->prev->v, &l, l->e); /* clip this corner off */
|
||||||
if(l2->f->len > 3)
|
if(l2->f->len > 3)
|
||||||
BM_face_split(bm, l2->f, l2->next->v, l2->prev->v, &l, l2->e); /* clip this corner off */
|
BM_face_split(bm, l2->f, l2->next->v, l2->prev->v, &l, l2->e); /* clip this corner off */
|
||||||
curedge = bm_disk_edge_next(curedge, v);
|
curedge = bmesh_disk_edge_next(curedge, v);
|
||||||
} while(curedge != v->e);
|
} while(curedge != v->e);
|
||||||
BME_Bevel_Dissolve_Disk(bm, v);
|
BME_Bevel_Dissolve_Disk(bm, v);
|
||||||
}
|
}
|
||||||
|
@@ -1645,7 +1645,7 @@ void EDBM_convertsel(BMEditMesh *em, short oldmode, short selectmode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDBM_deselect_by_material(struct BMEditMesh *em, const short index, const short select)
|
void EDBM_deselect_by_material(BMEditMesh *em, const short index, const short select)
|
||||||
{
|
{
|
||||||
BMIter iter;
|
BMIter iter;
|
||||||
BMFace *efa;
|
BMFace *efa;
|
||||||
@@ -1692,7 +1692,7 @@ void EDBM_select_swap(BMEditMesh *em) /* exported for UV */
|
|||||||
// if (EM_texFaceCheck())
|
// if (EM_texFaceCheck())
|
||||||
}
|
}
|
||||||
|
|
||||||
int EDBM_select_interior_faces(struct BMEditMesh *em)
|
int EDBM_select_interior_faces(BMEditMesh *em)
|
||||||
{
|
{
|
||||||
BMesh *bm = em->bm;
|
BMesh *bm = em->bm;
|
||||||
BMIter iter;
|
BMIter iter;
|
||||||
|
Reference in New Issue
Block a user