if (!uvedit_face_visible_test(scene, ima, efa, tf))
continue;
- i = 0;
- BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+ BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
luv_next = BM_ELEM_CD_GET_VOID_P(l->next, cd_loop_uv_offset);
mindist_squared = dist_squared;
}
-
- i++;
}
}
}
}
}
else {
- a = 0;
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ BM_ITER_MESH_INDEX (efa, &iter, em->bm, BM_FACES_OF_MESH, a) {
if (efa == hit->efa) {
stack[stacksize] = a;
stacksize++;
flag[a] = 1;
break;
}
-
- a++;
}
}
while (stacksize > 0) {
- int j;
stacksize--;
a = stack[stacksize];
-
- j = 0;
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (j == a)
- break;
- j++;
- }
+ efa = EDBM_face_at_index(em, a);
- i = 0;
- BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+ BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
/* make_uv_vert_map_EM sets verts tmp.l to the indices */
vlist = EDBM_uv_vert_map_at_index(vmap, BM_elem_index_get(l->v));
stacksize++;
}
}
-
- i++;
}
}
if (!extend) {
- a = 0;
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ BM_ITER_MESH_INDEX (efa, &iter, em->bm, BM_FACES_OF_MESH, a) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
else
luv->flag &= ~MLOOPUV_VERTSEL;
}
- a++;
}
}
else {
- a = 0;
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ BM_ITER_MESH_INDEX (efa, &iter, em->bm, BM_FACES_OF_MESH, a) {
if (!flag[a]) {
- a++;
continue;
}
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- if (luv->flag & MLOOPUV_VERTSEL)
+ if (luv->flag & MLOOPUV_VERTSEL) {
break;
+ }
}
- if (l)
+ if (l) {
break;
-
- a++;
+ }
}
if (efa) {
- a = 0;
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ BM_ITER_MESH_INDEX (efa, &iter, em->bm, BM_FACES_OF_MESH, a) {
if (!flag[a]) {
- a++;
continue;
}
luv->flag &= ~MLOOPUV_VERTSEL;
}
-
- a++;
}
}
else {
- a = 0;
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ BM_ITER_MESH_INDEX (efa, &iter, em->bm, BM_FACES_OF_MESH, a) {
if (!flag[a]) {
- a++;
continue;
}
luv->flag |= MLOOPUV_VERTSEL;
}
-
- a++;
}
}
}
NearestHit hit;
int i, selectmode, sticky, sync, *hitv = NULL;
bool select = true;
- BLI_array_declare(hitv);
int flush = 0, hitlen = 0; /* 0 == don't flush, 1 == sel, -1 == desel; only use when selection sync is enabled */
float limit[2], **hituv = NULL;
- BLI_array_declare(hituv);
float penalty[2];
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
/* find edge */
uv_find_nearest_edge(scene, ima, em, co, &hit);
if (hit.efa == NULL) {
- BLI_array_free(hitv);
- BLI_array_free(hituv);
return OPERATOR_CANCELLED;
}
/* find vertex */
uv_find_nearest_vert(scene, ima, em, co, penalty, &hit);
if (hit.efa == NULL) {
- BLI_array_free(hitv);
- BLI_array_free(hituv);
return OPERATOR_CANCELLED;
}
/* mark 1 vertex as being hit */
- BLI_array_grow_items(hitv, hit.efa->len);
- BLI_array_grow_items(hituv, hit.efa->len);
+ hitv = BLI_array_alloca(hitv, hit.efa->len);
+ hituv = BLI_array_alloca(hituv, hit.efa->len);
fill_vn_i(hitv, hit.efa->len, 0xFFFFFFFF);
hitv[hit.lindex] = hit.vert1;
/* find edge */
uv_find_nearest_edge(scene, ima, em, co, &hit);
if (hit.efa == NULL) {
- BLI_array_free(hitv);
- BLI_array_free(hituv);
return OPERATOR_CANCELLED;
}
/* mark 2 edge vertices as being hit */
- BLI_array_grow_items(hitv, hit.efa->len);
- BLI_array_grow_items(hituv, hit.efa->len);
+ hitv = BLI_array_alloca(hitv, hit.efa->len);
+ hituv = BLI_array_alloca(hituv, hit.efa->len);
fill_vn_i(hitv, hit.efa->len, 0xFFFFFFFF);
hitv[hit.lindex] = hit.vert1;
/* find face */
uv_find_nearest_face(scene, ima, em, co, &hit);
if (hit.efa == NULL) {
- BLI_array_free(hitv);
- BLI_array_free(hituv);
return OPERATOR_CANCELLED;
}
/* mark all face vertices as being hit */
- BLI_array_grow_items(hitv, hit.efa->len);
- BLI_array_grow_items(hituv, hit.efa->len);
- i = 0;
- BM_ITER_ELEM (l, &liter, hit.efa, BM_LOOPS_OF_FACE) {
+ hitv = BLI_array_alloca(hitv, hit.efa->len);
+ hituv = BLI_array_alloca(hituv, hit.efa->len);
+ BM_ITER_ELEM_INDEX (l, &liter, hit.efa, BM_LOOPS_OF_FACE, i) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
hituv[i] = luv->uv;
hitv[i] = BM_elem_index_get(l->v);
- i++;
}
hitlen = hit.efa->len;
uv_find_nearest_vert(scene, ima, em, co, NULL, &hit);
if (hit.efa == NULL) {
- BLI_array_free(hitv);
- BLI_array_free(hituv);
return OPERATOR_CANCELLED;
}
}
else {
hitlen = 0;
- BLI_array_free(hitv);
- BLI_array_free(hituv);
return OPERATOR_CANCELLED;
}
DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
- BLI_array_free(hitv);
- BLI_array_free(hituv);
-
return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED;
}