Cleanup: redundant index loop for monkey-create

Also rename face vars (the faces aren't temp),
and quiet old-style-definition warning.
This commit is contained in:
Campbell Barton 2016-11-18 06:08:51 +11:00
parent d294509dd8
commit a1a8343281
3 changed files with 13 additions and 14 deletions

View File

@ -320,7 +320,7 @@ const char *BKE_undo_get_name(int nr, bool *r_active)
}
/* return the name of the last item */
const char *BKE_undo_get_name_last()
const char *BKE_undo_get_name_last(void)
{
UndoElem *uel = undobase.last;
return (uel ? uel->name : NULL);

View File

@ -135,7 +135,7 @@ BMLoop *BM_face_find_longest_loop(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNUL
BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMEdge *BM_edge_find_double(BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMFace* BM_face_exists(BMVert **varr, int len) ATTR_NONNULL(1);
BMFace *BM_face_exists(BMVert **varr, int len) ATTR_NONNULL(1);
bool BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
bool BM_face_exists_multi_edge(BMEdge **earr, int len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();

View File

@ -1174,7 +1174,7 @@ void BM_mesh_calc_uvs_sphere(BMesh *bm, const short oflag)
}
BMIter iter2;
BMLoop* l;
BMLoop *l;
int loop_index;
float minx = 1.0f;
@ -1236,14 +1236,14 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
int uvi = 0;
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
for (i = 0; i < monkeynf; i++) {
BMFace* temp1 = BM_face_create_quad_tri(bm,
BMFace *f_new_a = BM_face_create_quad_tri(bm,
tv[monkeyf[i][0] + i - monkeyo],
tv[monkeyf[i][1] + i - monkeyo],
tv[monkeyf[i][2] + i - monkeyo],
(monkeyf[i][3] != monkeyf[i][2]) ? tv[monkeyf[i][3] + i - monkeyo] : NULL,
NULL, BM_CREATE_NOP);
BMFace* temp2 = BM_face_create_quad_tri(bm,
BMFace *f_new_b = BM_face_create_quad_tri(bm,
tv[monkeynv + monkeyf[i][2] + i - monkeyo],
tv[monkeynv + monkeyf[i][1] + i - monkeyo],
tv[monkeynv + monkeyf[i][0] + i - monkeyo],
@ -1252,20 +1252,19 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
/* Set the UVs here, the iteration order of the faces is not guaranteed,
* so it's best to set the UVs right after the face is created. */
if(calc_uvs) {
BMLoop* l;
if (calc_uvs) {
BMLoop *l;
BMIter liter;
int loop_index;
BM_ITER_ELEM_INDEX (l, &liter, temp1, BM_LOOPS_OF_FACE, loop_index) {
BM_ITER_ELEM (l, &liter, f_new_a, BM_LOOPS_OF_FACE) {
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
luv->uv[0] = monkeyuvs[uvi*2 + 0];
luv->uv[1] = monkeyuvs[uvi*2 + 1];
luv->uv[0] = monkeyuvs[uvi * 2 + 0];
luv->uv[1] = monkeyuvs[uvi * 2 + 1];
uvi++;
}
BM_ITER_ELEM_INDEX (l, &liter, temp2, BM_LOOPS_OF_FACE, loop_index) {
BM_ITER_ELEM (l, &liter, f_new_b, BM_LOOPS_OF_FACE) {
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
luv->uv[0] = monkeyuvs[uvi*2 + 0];
luv->uv[1] = monkeyuvs[uvi*2 + 1];
luv->uv[0] = monkeyuvs[uvi * 2 + 0];
luv->uv[1] = monkeyuvs[uvi * 2 + 1];
uvi++;
}