rename BM_vert_at_index -> BM_vert_at_index_find (since this searches the mempool).

needed for other changes - coming.
This commit is contained in:
Campbell Barton 2013-10-27 10:01:35 +00:00
parent e293a0b153
commit dee671276d
4 changed files with 13 additions and 13 deletions

@ -829,17 +829,17 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx)
BLI_ghash_free(fptr_map, NULL, NULL);
}
BMVert *BM_vert_at_index(BMesh *bm, const int index)
BMVert *BM_vert_at_index_find(BMesh *bm, const int index)
{
return BLI_mempool_findelem(bm->vpool, index);
}
BMEdge *BM_edge_at_index(BMesh *bm, const int index)
BMEdge *BM_edge_at_index_find(BMesh *bm, const int index)
{
return BLI_mempool_findelem(bm->epool, index);
}
BMFace *BM_face_at_index(BMesh *bm, const int index)
BMFace *BM_face_at_index_find(BMesh *bm, const int index)
{
return BLI_mempool_findelem(bm->fpool, index);
}

@ -49,9 +49,9 @@ int BM_mesh_elem_count(BMesh *bm, const char htype);
void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx);
BMVert *BM_vert_at_index(BMesh *bm, const int index);
BMEdge *BM_edge_at_index(BMesh *bm, const int index);
BMFace *BM_face_at_index(BMesh *bm, const int index);
BMVert *BM_vert_at_index_find(BMesh *bm, const int index);
BMEdge *BM_edge_at_index_find(BMesh *bm, const int index);
BMFace *BM_face_at_index_find(BMesh *bm, const int index);
typedef struct BMAllocTemplate {
int totvert, totedge, totloop, totface;

@ -400,7 +400,7 @@ static void knife_start_cut(KnifeTool_OpData *kcd)
BMVert *v0;
knife_input_ray_segment(kcd, kcd->curr.mval, 1.0f, origin, origin_ofs);
v0 = BM_vert_at_index(kcd->em->bm, 0);
v0 = BM_vert_at_index_find(kcd->em->bm, 0);
if (v0) {
closest_to_line_v3(kcd->prev.cage, v0->co, origin_ofs, origin);
copy_v3_v3(kcd->prev.co, kcd->prev.cage); /*TODO: do we need this? */

@ -392,7 +392,7 @@ static void findnearestvert__doClosest(void *userData, BMVert *eve, const float
static bool findnearestvert__backbufIndextest(void *handle, unsigned int index)
{
BMEditMesh *em = (BMEditMesh *)handle;
BMVert *eve = BM_vert_at_index(em->bm, index - 1);
BMVert *eve = BM_vert_at_index_find(em->bm, index - 1);
return !(eve && BM_elem_flag_test(eve, BM_ELEM_SELECT));
}
/**
@ -420,7 +420,7 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist, const bool sel, c
0, NULL, NULL);
}
eve = index ? BM_vert_at_index(vc->em->bm, index - 1) : NULL;
eve = index ? BM_vert_at_index_find(vc->em->bm, index - 1) : NULL;
if (eve && distance < *r_dist) {
*r_dist = distance;
@ -436,7 +436,7 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist, const bool sel, c
static int lastSelectedIndex = 0;
static BMVert *lastSelected = NULL;
if (lastSelected && BM_vert_at_index(vc->em->bm, lastSelectedIndex) != lastSelected) {
if (lastSelected && BM_vert_at_index_find(vc->em->bm, lastSelectedIndex) != lastSelected) {
lastSelectedIndex = 0;
lastSelected = NULL;
}
@ -512,7 +512,7 @@ BMEdge *EDBM_edge_find_nearest(ViewContext *vc, float *r_dist)
view3d_validate_backbuf(vc);
index = view3d_sample_backbuf_rect(vc, vc->mval, 50, bm_solidoffs, bm_wireoffs, &distance, 0, NULL, NULL);
eed = index ? BM_edge_at_index(vc->em->bm, index - 1) : NULL;
eed = index ? BM_edge_at_index_find(vc->em->bm, index - 1) : NULL;
if (eed && distance < *r_dist) {
*r_dist = distance;
@ -585,7 +585,7 @@ BMFace *EDBM_face_find_nearest(ViewContext *vc, float *r_dist)
view3d_validate_backbuf(vc);
index = view3d_sample_backbuf(vc, vc->mval[0], vc->mval[1]);
efa = index ? BM_face_at_index(vc->em->bm, index - 1) : NULL;
efa = index ? BM_face_at_index_find(vc->em->bm, index - 1) : NULL;
if (efa) {
struct { float mval_fl[2]; float dist; BMFace *toFace; } data;
@ -612,7 +612,7 @@ BMFace *EDBM_face_find_nearest(ViewContext *vc, float *r_dist)
static int lastSelectedIndex = 0;
static BMFace *lastSelected = NULL;
if (lastSelected && BM_face_at_index(vc->em->bm, lastSelectedIndex) != lastSelected) {
if (lastSelected && BM_face_at_index_find(vc->em->bm, lastSelectedIndex) != lastSelected) {
lastSelectedIndex = 0;
lastSelected = NULL;
}