rename iterator type from htype to itype (htype means header type for BMesh elements)

This commit is contained in:
Campbell Barton
2011-12-07 20:55:28 +00:00
parent d1183814c4
commit 4b09f86c32
5 changed files with 27 additions and 26 deletions

View File

@@ -47,12 +47,12 @@ a different face hole boundary*/
#define BM_LOOPS_OF_LOOP 12
#define BM_LOOPS_OF_EDGE 13
#define BM_ITER(ele, iter, bm, type, data) \
ele = BMIter_New(iter, bm, type, data); \
#define BM_ITER(ele, iter, bm, itype, data) \
ele = BMIter_New(iter, bm, itype, data); \
for ( ; ele; ele=BMIter_Step(iter))
#define BM_ITER_INDEX(ele, iter, bm, type, data, indexvar) \
ele = BMIter_New(iter, bm, type, data); \
#define BM_ITER_INDEX(ele, iter, bm, itype, data, indexvar) \
ele = BMIter_New(iter, bm, itype, data); \
for (indexvar=0; ele; indexvar++, ele=BMIter_Step(iter))
/*Iterator Structure*/
@@ -66,14 +66,15 @@ typedef struct BMIter {
struct BMesh *bm;
void (*begin)(struct BMIter *iter);
void *(*step)(struct BMIter *iter);
union{
void *p;
int i;
long l;
float f;
union {
void *p;
int i;
long l;
float f;
} filter;
int htype, count;
}BMIter;
int count;
char itype;
} BMIter;
void *BMIter_AtIndex(struct BMesh *bm, const char htype, void *data, int index);
int BMIter_AsArray(struct BMesh *bm, const char htype, void *data, void **array, const int len);

View File

@@ -36,7 +36,7 @@
/*
* note, we have BM_Vert_AtIndex/BM_Edge_AtIndex/BM_Face_AtIndex for arrays
*/
void *BMIter_AtIndex(struct BMesh *bm, const char htype, void *data, int index)
void *BMIter_AtIndex(struct BMesh *bm, const char itype, void *data, int index)
{
BMIter iter;
void *val;
@@ -45,7 +45,7 @@ void *BMIter_AtIndex(struct BMesh *bm, const char htype, void *data, int index)
/*sanity check*/
if (index < 0) return NULL;
val=BMIter_New(&iter, bm, htype, data);
val=BMIter_New(&iter, bm, itype, data);
i = 0;
while (i < index) {
@@ -64,7 +64,7 @@ void *BMIter_AtIndex(struct BMesh *bm, const char htype, void *data, int index)
* to avoid multiple calls to BMIter_AtIndex.
*/
int BMIter_AsArray(struct BMesh *bm, const char htype, void *data, void **array, const int len)
int BMIter_AsArray(struct BMesh *bm, const char type, void *data, void **array, const int len)
{
int i= 0;
@@ -74,7 +74,7 @@ int BMIter_AsArray(struct BMesh *bm, const char htype, void *data, void **array,
BMIter iter;
void *val;
BM_ITER(val, &iter, bm, htype, data) {
BM_ITER(val, &iter, bm, type, data) {
array[i]= val;
i++;
if (i == len) {

View File

@@ -60,14 +60,14 @@ BM_INLINE void *BMIter_Step(BMIter *iter)
* to return the first element of the iterator.
*
*/
BM_INLINE void *BMIter_New(BMIter *iter, BMesh *bm, const char htype, void *data)
BM_INLINE void *BMIter_New(BMIter *iter, BMesh *bm, const char itype, void *data)
{
/* int argtype; */
iter->htype = htype;
iter->itype = itype;
iter->bm = bm;
/* inlining optimizes out this switch when called with the defined type */
switch(htype){
switch(itype){
case BM_VERTS_OF_MESH:
iter->begin = bmiter__vert_of_mesh_begin;
iter->step = bmiter__vert_of_mesh_step;

View File

@@ -59,7 +59,7 @@ static void recount_totsels(BMesh *bm)
{
BMIter iter;
BMHeader *ele;
int types[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH};
const char itypes[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH};
int *tots[3];
int i;
@@ -70,7 +70,7 @@ static void recount_totsels(BMesh *bm)
tots[2] = &bm->totfacesel;
for (i=0; i<3; i++) {
ele = BMIter_New(&iter, bm, types[i], NULL);
ele = BMIter_New(&iter, bm, itypes[i], NULL);
for ( ; ele; ele=BMIter_Step(&iter)) {
if (BM_TestHFlag(ele, BM_SELECT)) *tots[i] += 1;
}
@@ -637,7 +637,7 @@ void BM_validate_selections(BMesh *bm)
void BM_clear_flag_all(BMesh *bm, const char hflag)
{
int types[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH};
const char itypes[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH};
BMIter iter;
BMHeader *ele;
int i;
@@ -646,7 +646,7 @@ void BM_clear_flag_all(BMesh *bm, const char hflag)
BM_clear_selection_history(bm);
for (i=0; i<3; i++) {
ele = BMIter_New(&iter, bm, types[i], NULL);
ele = BMIter_New(&iter, bm, itypes[i], NULL);
for ( ; ele; ele=BMIter_Step(&iter)) {
if (hflag & BM_SELECT) BM_Select(bm, ele, 0);
BM_ClearHFlag(ele, hflag);

View File

@@ -121,7 +121,7 @@ void EDBM_stats_update(BMEditMesh *em)
{
BMIter iter;
BMHeader *ele;
int types[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH};
const char itypes[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH};
int *tots[3];
int i;
@@ -132,7 +132,7 @@ void EDBM_stats_update(BMEditMesh *em)
em->bm->totvertsel = em->bm->totedgesel = em->bm->totfacesel = 0;
for (i=0; i<3; i++) {
ele = BMIter_New(&iter, em->bm, types[i], NULL);
ele = BMIter_New(&iter, em->bm, itypes[i], NULL);
for ( ; ele; ele=BMIter_Step(&iter)) {
if (BM_TestHFlag(ele, BM_SELECT)) {
(*tots[i])++;
@@ -509,13 +509,13 @@ void EDBM_clear_flag_all(BMEditMesh *em, const char hflag)
void EDBM_set_flag_all(BMEditMesh *em, const char hflag)
{
int types[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH};
const char itypes[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH};
BMIter iter;
BMHeader *ele;
int i;
for (i=0; i<3; i++) {
ele= BMIter_New(&iter, em->bm, types[i], NULL);
ele= BMIter_New(&iter, em->bm, itypes[i], NULL);
for ( ; ele; ele=BMIter_Step(&iter)) {
if (hflag & BM_SELECT) {
BM_Select(em->bm, ele, 1);