code cleanup:
- use BM_ITER_* macros in more places. - avoid sign int conversion when calling EDBM_backbuf_check()
This commit is contained in:
@@ -44,10 +44,10 @@
|
||||
void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
BMIter iter, liter;
|
||||
BMFace *f, *nf;
|
||||
BMFace *f, *f_new;
|
||||
BMLoop *(*loops_split)[2] = NULL;
|
||||
BLI_array_declare(loops_split);
|
||||
BMLoop *l, *nl, *lastl = NULL;
|
||||
BMLoop *l, *l_new;
|
||||
BMVert *(*verts_pair)[2] = NULL;
|
||||
BLI_array_declare(verts_pair);
|
||||
int i;
|
||||
@@ -56,7 +56,8 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
/* BMESH_TODO, loop over vert faces:
|
||||
* faster then looping over all faces, then searching each for flagged verts*/
|
||||
for (f = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); f; f = BM_iter_step(&iter)) {
|
||||
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
|
||||
BMLoop *l_last;
|
||||
BLI_array_empty(loops_split);
|
||||
BLI_array_empty(verts_pair);
|
||||
|
||||
@@ -64,22 +65,21 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
|
||||
lastl = NULL;
|
||||
for ( ; l; l = BM_iter_step(&liter)) {
|
||||
l_last = NULL;
|
||||
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
|
||||
if (BMO_elem_flag_test(bm, l->v, VERT_INPUT)) {
|
||||
if (!lastl) {
|
||||
lastl = l;
|
||||
if (!l_last) {
|
||||
l_last = l;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lastl != l->prev && lastl != l->next) {
|
||||
if (l_last != l->prev && l_last != l->next) {
|
||||
BLI_array_grow_one(loops_split);
|
||||
loops_split[BLI_array_count(loops_split) - 1][0] = lastl;
|
||||
loops_split[BLI_array_count(loops_split) - 1][0] = l_last;
|
||||
loops_split[BLI_array_count(loops_split) - 1][1] = l;
|
||||
|
||||
}
|
||||
lastl = l;
|
||||
l_last = l;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,16 +106,16 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
for (i = 0; i < BLI_array_count(verts_pair); i++) {
|
||||
nf = BM_face_split(bm, f, verts_pair[i][0], verts_pair[i][1], &nl, NULL, false);
|
||||
f = nf;
|
||||
f_new = BM_face_split(bm, f, verts_pair[i][0], verts_pair[i][1], &l_new, NULL, false);
|
||||
f = f_new;
|
||||
|
||||
if (!nl || !nf) {
|
||||
if (!l_new || !f_new) {
|
||||
BMO_error_raise(bm, op, BMERR_CONNECTVERT_FAILED, NULL);
|
||||
BLI_array_free(loops_split);
|
||||
return;
|
||||
}
|
||||
BMO_elem_flag_enable(bm, nf, FACE_NEW);
|
||||
BMO_elem_flag_enable(bm, nl->e, EDGE_OUT);
|
||||
BMO_elem_flag_enable(bm, f_new, FACE_NEW);
|
||||
BMO_elem_flag_enable(bm, l_new->e, EDGE_OUT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -334,10 +334,7 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
|
||||
mult_m4_m4m4(mtx, imtx, obedit->obmat);
|
||||
}
|
||||
|
||||
for (edge = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL);
|
||||
edge;
|
||||
edge = BM_iter_step(&iter))
|
||||
{
|
||||
BM_ITER_MESH (edge, &iter, bm, BM_EDGES_OF_MESH) {
|
||||
if (BM_elem_flag_test(edge, hflag) &&
|
||||
BM_edge_is_boundary(edge) &&
|
||||
BM_elem_flag_test(edge->l->f, hflag))
|
||||
@@ -3920,9 +3917,10 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
|
||||
/* find two vertices with valence count == 1, more or less is wrong */
|
||||
v1 = NULL;
|
||||
v2 = NULL;
|
||||
for (eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL); eve; eve = BM_iter_step(&iter)) {
|
||||
|
||||
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
|
||||
valence = 0;
|
||||
for (eed = BM_iter_new(&eiter, em->bm, BM_EDGES_OF_VERT, eve); eed; eed = BM_iter_step(&eiter)) {
|
||||
BM_ITER_ELEM (eed, &eiter, eve, BM_EDGES_OF_VERT) {
|
||||
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
|
||||
valence++;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ static int tree_element_active_renderlayer(bContext *C, TreeElement *te, TreeSto
|
||||
* CTRL+LMB: Select/Deselect object and all cildren
|
||||
* CTRL+SHIFT+LMB: Add/Remove object and all children
|
||||
*/
|
||||
static void set_select_recursive(Scene *scene, Object *ob_parent, bool select)
|
||||
static void do_outliner_object_select_recursive(Scene *scene, Object *ob_parent, bool select)
|
||||
{
|
||||
Base *base;
|
||||
|
||||
@@ -201,7 +201,7 @@ static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops
|
||||
|
||||
if (recursive) {
|
||||
/* Recursive select/deselect */
|
||||
set_select_recursive(scene, ob, (ob->flag & SELECT) != 0);
|
||||
do_outliner_object_select_recursive(scene, ob, (ob->flag & SELECT) != 0);
|
||||
}
|
||||
|
||||
if (C) {
|
||||
|
||||
@@ -177,10 +177,9 @@ static void edbm_backbuf_check_and_select_verts(BMEditMesh *em, int select)
|
||||
{
|
||||
BMVert *eve;
|
||||
BMIter iter;
|
||||
int index = bm_wireoffs;
|
||||
unsigned int index = bm_wireoffs;
|
||||
|
||||
eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
|
||||
for (; eve; eve = BM_iter_step(&iter), index++) {
|
||||
for (eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL); eve; eve = BM_iter_step(&iter), index++) {
|
||||
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
|
||||
if (EDBM_backbuf_check(index)) {
|
||||
BM_vert_select_set(em->bm, eve, select);
|
||||
@@ -209,7 +208,7 @@ static void edbm_backbuf_check_and_select_faces(BMEditMesh *em, int select)
|
||||
{
|
||||
BMFace *efa;
|
||||
BMIter iter;
|
||||
int index = 1;
|
||||
unsigned int index = 1;
|
||||
|
||||
efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
|
||||
for (; efa; efa = BM_iter_step(&iter), index++) {
|
||||
@@ -226,11 +225,11 @@ static void edbm_backbuf_check_and_select_faces(BMEditMesh *em, int select)
|
||||
static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, int select)
|
||||
{
|
||||
MVert *mv = me->mvert;
|
||||
int a;
|
||||
unsigned int index;
|
||||
|
||||
if (mv) {
|
||||
for (a = 1; a <= me->totvert; a++, mv++) {
|
||||
if (EDBM_backbuf_check(a)) {
|
||||
for (index = 1; index <= me->totvert; index++, mv++) {
|
||||
if (EDBM_backbuf_check(index)) {
|
||||
if (!(mv->flag & ME_HIDE)) {
|
||||
mv->flag = select ? (mv->flag | SELECT) : (mv->flag & ~SELECT);
|
||||
}
|
||||
@@ -243,11 +242,11 @@ static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, int select)
|
||||
static void edbm_backbuf_check_and_select_tfaces(Mesh *me, int select)
|
||||
{
|
||||
MPoly *mpoly = me->mpoly;
|
||||
int a;
|
||||
unsigned int index;
|
||||
|
||||
if (mpoly) {
|
||||
for (a = 1; a <= me->totpoly; a++, mpoly++) {
|
||||
if (EDBM_backbuf_check(a)) {
|
||||
for (index = 1; index <= me->totpoly; index++, mpoly++) {
|
||||
if (EDBM_backbuf_check(index)) {
|
||||
mpoly->flag = select ? (mpoly->flag | ME_FACE_SEL) : (mpoly->flag & ~ME_FACE_SEL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user