Cleanup: rename BLI_array_count -> len
Match naming convention used everywhere else. Count should only be used when this isn't directly accessible.
This commit is contained in:
@@ -62,9 +62,10 @@
|
||||
* Doing the realloc in a macro isn't so simple,
|
||||
* so use a function the macros can use.
|
||||
*/
|
||||
void _bli_array_grow_func(void **arr_p, const void *arr_static,
|
||||
const int sizeof_arr_p, const int arr_count, const int num,
|
||||
const char *alloc_str);
|
||||
void _bli_array_grow_func(
|
||||
void **arr_p, const void *arr_static,
|
||||
const int sizeof_arr_p, const int arr_len, const int num,
|
||||
const char *alloc_str);
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -74,18 +75,18 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static,
|
||||
|
||||
/** use ``sizeof(*(arr))`` to ensure the array exists and is an array */
|
||||
#define BLI_array_declare(arr) \
|
||||
int _##arr##_count = ((void)(sizeof(*(arr))), 0); \
|
||||
int _##arr##_len = ((void)(sizeof(*(arr))), 0); \
|
||||
void *_##arr##_static = NULL
|
||||
|
||||
/**
|
||||
* this will use stack space, up to maxstatic array elements, before
|
||||
* switching to dynamic heap allocation */
|
||||
#define BLI_array_staticdeclare(arr, maxstatic) \
|
||||
int _##arr##_count = 0; \
|
||||
int _##arr##_len = 0; \
|
||||
char _##arr##_static[maxstatic * sizeof(*(arr))]
|
||||
|
||||
/** returns the logical size of the array, not including buffering. */
|
||||
#define BLI_array_count(arr) ((void)0, _##arr##_count)
|
||||
#define BLI_array_len(arr) ((void)0, _##arr##_len)
|
||||
|
||||
/**
|
||||
* Grow the array by a fixed number of items.
|
||||
@@ -95,23 +96,23 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static,
|
||||
#define BLI_array_reserve(arr, num) (void)( \
|
||||
(((void *)(arr) == NULL) && \
|
||||
((void *)(_##arr##_static) != NULL) && \
|
||||
/* don't add _##arr##_count below because it must be zero */ \
|
||||
(_bli_array_totalsize_static(arr) >= _##arr##_count + (num))) ? \
|
||||
/* don't add _##arr##_len below because it must be zero */ \
|
||||
(_bli_array_totalsize_static(arr) >= _##arr##_len + (num))) ? \
|
||||
/* we have an empty array and a static var big enough */ \
|
||||
(void)(arr = (void *)_##arr##_static) \
|
||||
: \
|
||||
/* use existing static array or allocate */ \
|
||||
(LIKELY(_bli_array_totalsize(arr) >= _##arr##_count + (num)) ? \
|
||||
(LIKELY(_bli_array_totalsize(arr) >= _##arr##_len + (num)) ? \
|
||||
(void)0 /* do nothing */ : \
|
||||
_bli_array_grow_func((void **)&(arr), _##arr##_static, \
|
||||
sizeof(*(arr)), _##arr##_count, num, \
|
||||
sizeof(*(arr)), _##arr##_len, num, \
|
||||
"BLI_array." #arr)) \
|
||||
)
|
||||
|
||||
|
||||
/** returns length of array */
|
||||
#define BLI_array_grow_items(arr, num) \
|
||||
(BLI_array_reserve(arr, num), (_##arr##_count += num))
|
||||
(BLI_array_reserve(arr, num), (_##arr##_len += num))
|
||||
|
||||
#define BLI_array_grow_one(arr) \
|
||||
BLI_array_grow_items(arr, 1)
|
||||
@@ -119,7 +120,7 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static,
|
||||
/** appends an item to the array. */
|
||||
#define BLI_array_append(arr, item) ( \
|
||||
(void) BLI_array_grow_one(arr), \
|
||||
(void) (arr[_##arr##_count - 1] = item) \
|
||||
(void) (arr[_##arr##_len - 1] = item) \
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -127,13 +128,13 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static,
|
||||
* item is not a pointer, but actual data value.*/
|
||||
#define BLI_array_append_r(arr, item) ( \
|
||||
(void) BLI_array_grow_one(arr), \
|
||||
(void) (arr[_##arr##_count - 1] = item), \
|
||||
(&arr[_##arr##_count - 1]) \
|
||||
(void) (arr[_##arr##_len - 1] = item), \
|
||||
(&arr[_##arr##_len - 1]) \
|
||||
)
|
||||
|
||||
/** appends (grows) & returns a pointer to the uninitialized memory */
|
||||
#define BLI_array_append_ret(arr) \
|
||||
(BLI_array_reserve(arr, 1), &arr[(_##arr##_count++)])
|
||||
(BLI_array_reserve(arr, 1), &arr[(_##arr##_len++)])
|
||||
|
||||
#define BLI_array_free(arr) { \
|
||||
if (arr && (char *)arr != _##arr##_static) { \
|
||||
@@ -143,26 +144,26 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static,
|
||||
} ((void)0)
|
||||
|
||||
#define BLI_array_pop(arr) ( \
|
||||
(arr && _##arr##_count) ? \
|
||||
arr[--_##arr##_count] : \
|
||||
(arr && _##arr##_len) ? \
|
||||
arr[--_##arr##_len] : \
|
||||
NULL \
|
||||
)
|
||||
|
||||
/**
|
||||
* resets the logical size of an array to zero, but doesn't
|
||||
* Resets the logical size of an array to zero, but doesn't
|
||||
* free the memory. */
|
||||
#define BLI_array_clear(arr) \
|
||||
{ _##arr##_count = 0; } (void)0
|
||||
{ _##arr##_len = 0; } ((void)0)
|
||||
|
||||
/**
|
||||
* set the count of the array, doesn't actually increase the allocated array
|
||||
* Set the length of the array, doesn't actually increase the allocated array
|
||||
* size. don't use this unless you know what you're doing. */
|
||||
#define BLI_array_count_set(arr, count) \
|
||||
{ _##arr##_count = (count); }(void)0
|
||||
#define BLI_array_len_set(arr, len) \
|
||||
{ _##arr##_len = (len); } ((void)0)
|
||||
|
||||
/** only to prevent unused warnings */
|
||||
#define BLI_array_fake_user(arr) \
|
||||
((void)_##arr##_count, \
|
||||
((void)_##arr##_len, \
|
||||
(void)_##arr##_static)
|
||||
|
||||
/** \} */
|
||||
@@ -191,7 +192,7 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static,
|
||||
#define BLI_array_fixedstack_free(arr) \
|
||||
if (_##arr##_is_static) { \
|
||||
MEM_freeN(arr); \
|
||||
} (void)0
|
||||
} ((void)0)
|
||||
|
||||
/** \} */
|
||||
|
||||
|
||||
@@ -66,21 +66,23 @@
|
||||
/**
|
||||
* This function is only to be called via macros.
|
||||
*
|
||||
* \note The caller must adjust \a arr_count
|
||||
* \note The caller must adjust \a arr_len
|
||||
*/
|
||||
void _bli_array_grow_func(void **arr_p, const void *arr_static,
|
||||
const int sizeof_arr_p, const int arr_count, const int num,
|
||||
const char *alloc_str)
|
||||
void _bli_array_grow_func(
|
||||
void **arr_p, const void *arr_static,
|
||||
const int sizeof_arr_p, const int arr_len, const int num,
|
||||
const char *alloc_str)
|
||||
{
|
||||
void *arr = *arr_p;
|
||||
void *arr_tmp;
|
||||
|
||||
arr_tmp = MEM_mallocN(sizeof_arr_p *
|
||||
((num < arr_count) ?
|
||||
(arr_count * 2 + 2) : (arr_count + num)), alloc_str);
|
||||
arr_tmp = MEM_mallocN(
|
||||
sizeof_arr_p *
|
||||
((num < arr_len) ?
|
||||
(arr_len * 2 + 2) : (arr_len + num)), alloc_str);
|
||||
|
||||
if (arr) {
|
||||
memcpy(arr_tmp, arr, sizeof_arr_p * arr_count);
|
||||
memcpy(arr_tmp, arr, sizeof_arr_p * arr_len);
|
||||
|
||||
if (arr != arr_static) {
|
||||
MEM_freeN(arr);
|
||||
@@ -91,6 +93,6 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static,
|
||||
|
||||
/* caller must do */
|
||||
#if 0
|
||||
arr_count += num;
|
||||
arr_len += num;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1282,8 +1282,8 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
|
||||
}
|
||||
|
||||
/* create region face */
|
||||
f_new = BLI_array_count(edges) ?
|
||||
BM_face_create_ngon(bm, v1, v2, edges, BLI_array_count(edges), faces[0], BM_CREATE_NOP) : NULL;
|
||||
f_new = BLI_array_len(edges) ?
|
||||
BM_face_create_ngon(bm, v1, v2, edges, BLI_array_len(edges), faces[0], BM_CREATE_NOP) : NULL;
|
||||
if (UNLIKELY(f_new == NULL)) {
|
||||
/* Invalid boundary region to join faces */
|
||||
goto error;
|
||||
@@ -1347,11 +1347,11 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
|
||||
|
||||
/* delete old geometry */
|
||||
if (do_del) {
|
||||
for (i = 0; i < BLI_array_count(deledges); i++) {
|
||||
for (i = 0; i < BLI_array_len(deledges); i++) {
|
||||
BM_edge_kill(bm, deledges[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < BLI_array_count(delverts); i++) {
|
||||
for (i = 0; i < BLI_array_len(delverts); i++) {
|
||||
BM_vert_kill(bm, delverts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,8 +482,8 @@ BMEdge *BM_vert_collapse_faces(
|
||||
BLI_array_append(faces, f);
|
||||
}
|
||||
|
||||
if (BLI_array_count(faces) >= 2) {
|
||||
BMFace *f2 = BM_faces_join(bm, faces, BLI_array_count(faces), true);
|
||||
if (BLI_array_len(faces) >= 2) {
|
||||
BMFace *f2 = BM_faces_join(bm, faces, BLI_array_len(faces), true);
|
||||
if (f2) {
|
||||
BMLoop *l_a, *l_b;
|
||||
|
||||
@@ -499,7 +499,7 @@ BMEdge *BM_vert_collapse_faces(
|
||||
}
|
||||
}
|
||||
|
||||
BLI_assert(BLI_array_count(faces) < 8);
|
||||
BLI_assert(BLI_array_len(faces) < 8);
|
||||
|
||||
BLI_array_free(faces);
|
||||
}
|
||||
@@ -608,7 +608,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
|
||||
} while (l != e->l);
|
||||
|
||||
/* flag existing faces so we can differentiate oldfaces from new faces */
|
||||
for (i = 0; i < BLI_array_count(oldfaces); i++) {
|
||||
for (i = 0; i < BLI_array_len(oldfaces); i++) {
|
||||
BM_ELEM_API_FLAG_ENABLE(oldfaces[i], _FLAG_OVERLAP);
|
||||
oldfaces[i] = BM_face_copy(bm, bm, oldfaces[i], true, true);
|
||||
BM_ELEM_API_FLAG_DISABLE(oldfaces[i], _FLAG_OVERLAP);
|
||||
@@ -639,7 +639,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
|
||||
int i, j;
|
||||
|
||||
/* interpolate new/changed loop data from copied old faces */
|
||||
for (i = 0; i < BLI_array_count(oldfaces); i++) {
|
||||
for (i = 0; i < BLI_array_len(oldfaces); i++) {
|
||||
float f_center_old[3];
|
||||
|
||||
BM_face_calc_center_mean(oldfaces[i], f_center_old);
|
||||
@@ -671,7 +671,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
|
||||
}
|
||||
|
||||
/* destroy the old faces */
|
||||
for (i = 0; i < BLI_array_count(oldfaces); i++) {
|
||||
for (i = 0; i < BLI_array_len(oldfaces); i++) {
|
||||
BM_face_verts_kill(bm, oldfaces[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -665,7 +665,7 @@ bool BM_face_split_edgenet(
|
||||
BM_ELEM_API_FLAG_DISABLE(l_iter->v, VERT_VISIT);
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
|
||||
if (BLI_array_count(face_arr)) {
|
||||
if (BLI_array_len(face_arr)) {
|
||||
bmesh_face_swap_data(f, face_arr[0]);
|
||||
BM_face_kill(bm, face_arr[0]);
|
||||
face_arr[0] = f;
|
||||
@@ -674,13 +674,13 @@ bool BM_face_split_edgenet(
|
||||
BM_ELEM_API_FLAG_DISABLE(f, FACE_NET);
|
||||
}
|
||||
|
||||
for (i = 0; i < BLI_array_count(face_arr); i++) {
|
||||
for (i = 0; i < BLI_array_len(face_arr); i++) {
|
||||
BM_ELEM_API_FLAG_DISABLE(face_arr[i], FACE_NET);
|
||||
}
|
||||
|
||||
if (r_face_arr) {
|
||||
*r_face_arr = face_arr;
|
||||
*r_face_arr_len = BLI_array_count(face_arr);
|
||||
*r_face_arr_len = BLI_array_len(face_arr);
|
||||
}
|
||||
else {
|
||||
if (face_arr) {
|
||||
|
||||
@@ -179,7 +179,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
BMW_end(®walker);
|
||||
|
||||
for (i = 0; i < BLI_array_count(faces); i++) {
|
||||
for (i = 0; i < BLI_array_len(faces); i++) {
|
||||
f_iter = faces[i];
|
||||
BMO_face_flag_disable(bm, f_iter, FACE_TAG);
|
||||
BMO_face_flag_enable(bm, f_iter, FACE_ORIG);
|
||||
@@ -198,7 +198,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
|
||||
/* track how many faces we should end up with */
|
||||
int totface_target = bm->totface;
|
||||
|
||||
for (i = 0; i < BLI_array_count(regions); i++) {
|
||||
for (i = 0; i < BLI_array_len(regions); i++) {
|
||||
BMFace *f_new;
|
||||
int tot = 0;
|
||||
|
||||
@@ -259,7 +259,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
cleanup:
|
||||
/* free/cleanup */
|
||||
for (i = 0; i < BLI_array_count(regions); i++) {
|
||||
for (i = 0; i < BLI_array_len(regions); i++) {
|
||||
if (regions[i]) MEM_freeN(regions[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -179,22 +179,22 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
if (!count) {
|
||||
edges1 = edges;
|
||||
BLI_array_count_set(edges1, BLI_array_count(edges));
|
||||
BLI_array_len_set(edges1, BLI_array_len(edges));
|
||||
}
|
||||
else {
|
||||
edges2 = edges;
|
||||
BLI_array_count_set(edges2, BLI_array_count(edges));
|
||||
BLI_array_len_set(edges2, BLI_array_len(edges));
|
||||
}
|
||||
|
||||
BLI_array_clear(edges);
|
||||
count++;
|
||||
}
|
||||
|
||||
if (edges1 && BLI_array_count(edges1) > 2 &&
|
||||
BM_edge_share_vert_check(edges1[0], edges1[BLI_array_count(edges1) - 1]))
|
||||
if (edges1 && BLI_array_len(edges1) > 2 &&
|
||||
BM_edge_share_vert_check(edges1[0], edges1[BLI_array_len(edges1) - 1]))
|
||||
{
|
||||
if (edges2 && BLI_array_count(edges2) > 2 &&
|
||||
BM_edge_share_vert_check(edges2[0], edges2[BLI_array_count(edges2) - 1]))
|
||||
if (edges2 && BLI_array_len(edges2) > 2 &&
|
||||
BM_edge_share_vert_check(edges2[0], edges2[BLI_array_len(edges2) - 1]))
|
||||
{
|
||||
BLI_array_free(edges1);
|
||||
BLI_array_free(edges2);
|
||||
@@ -206,8 +206,8 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
if (edges2 && BLI_array_count(edges2) > 2 &&
|
||||
BM_edge_share_vert_check(edges2[0], edges2[BLI_array_count(edges2) - 1]))
|
||||
if (edges2 && BLI_array_len(edges2) > 2 &&
|
||||
BM_edge_share_vert_check(edges2[0], edges2[BLI_array_len(edges2) - 1]))
|
||||
{
|
||||
edges2 = NULL;
|
||||
}
|
||||
@@ -218,23 +218,23 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
|
||||
float dvec1[3];
|
||||
float dvec2[3];
|
||||
|
||||
if (BLI_array_count(edges1) == 1) {
|
||||
if (BLI_array_len(edges1) == 1) {
|
||||
v1 = edges1[0]->v1;
|
||||
v2 = edges1[0]->v2;
|
||||
}
|
||||
else {
|
||||
v1 = BM_vert_in_edge(edges1[1], edges1[0]->v1) ? edges1[0]->v2 : edges1[0]->v1;
|
||||
i = BLI_array_count(edges1) - 1;
|
||||
i = BLI_array_len(edges1) - 1;
|
||||
v2 = BM_vert_in_edge(edges1[i - 1], edges1[i]->v1) ? edges1[i]->v2 : edges1[i]->v1;
|
||||
}
|
||||
|
||||
if (BLI_array_count(edges2) == 1) {
|
||||
if (BLI_array_len(edges2) == 1) {
|
||||
v3 = edges2[0]->v1;
|
||||
v4 = edges2[0]->v2;
|
||||
}
|
||||
else {
|
||||
v3 = BM_vert_in_edge(edges2[1], edges2[0]->v1) ? edges2[0]->v2 : edges2[0]->v1;
|
||||
i = BLI_array_count(edges2) - 1;
|
||||
i = BLI_array_len(edges2) - 1;
|
||||
v4 = BM_vert_in_edge(edges2[i - 1], edges2[i]->v1) ? edges2[i]->v2 : edges2[i]->v1;
|
||||
}
|
||||
|
||||
@@ -265,9 +265,9 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
|
||||
else if (edges1) {
|
||||
BMVert *v1, *v2;
|
||||
|
||||
if (BLI_array_count(edges1) > 1) {
|
||||
if (BLI_array_len(edges1) > 1) {
|
||||
v1 = BM_vert_in_edge(edges1[1], edges1[0]->v1) ? edges1[0]->v2 : edges1[0]->v1;
|
||||
i = BLI_array_count(edges1) - 1;
|
||||
i = BLI_array_len(edges1) - 1;
|
||||
v2 = BM_vert_in_edge(edges1[i - 1], edges1[i]->v1) ? edges1[i]->v2 : edges1[i]->v1;
|
||||
e = BM_edge_create(bm, v1, v2, NULL, BM_CREATE_NO_DOUBLE);
|
||||
BMO_edge_flag_enable(bm, e, ELE_NEW);
|
||||
|
||||
@@ -1157,7 +1157,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
|
||||
loops[a] = l;
|
||||
}
|
||||
|
||||
vlen = BLI_array_count(loops);
|
||||
vlen = BLI_array_len(loops);
|
||||
|
||||
/* find the boundary of one of the split edges */
|
||||
for (a = 1; a < vlen; a++) {
|
||||
@@ -1236,9 +1236,9 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
|
||||
* - concave corner of an ngon.
|
||||
* - 2 edges being used in 2+ ngons.
|
||||
*/
|
||||
// BM_face_splits_check_legal(bm, face, loops_split, BLI_array_count(loops_split));
|
||||
// BM_face_splits_check_legal(bm, face, loops_split, BLI_array_len(loops_split));
|
||||
|
||||
for (j = 0; j < BLI_array_count(loops_split); j++) {
|
||||
for (j = 0; j < BLI_array_len(loops_split); j++) {
|
||||
if (loops_split[j][0]) {
|
||||
BMFace *f_new;
|
||||
BLI_assert(BM_edge_exists(loops_split[j][0]->v, loops_split[j][1]->v) == NULL);
|
||||
|
||||
@@ -3209,7 +3209,7 @@ static void build_center_ngon(BMesh *bm, BevVert *bv, int mat_nr)
|
||||
BLI_array_append(ve, NULL);
|
||||
}
|
||||
} while ((v = v->next) != vm->boundstart);
|
||||
bev_create_ngon(bm, vv, BLI_array_count(vv), vf, frep, ve, mat_nr, true);
|
||||
bev_create_ngon(bm, vv, BLI_array_len(vv), vf, frep, ve, mat_nr, true);
|
||||
|
||||
BLI_array_free(vv);
|
||||
BLI_array_free(vf);
|
||||
@@ -3960,7 +3960,7 @@ static int bevel_edge_order_extend(BMesh *bm, BevVert *bv, int i)
|
||||
BLI_array_append(sucs, bme2);
|
||||
}
|
||||
}
|
||||
nsucs = BLI_array_count(sucs);
|
||||
nsucs = BLI_array_len(sucs);
|
||||
|
||||
bestj = j = i;
|
||||
for (sucindex = 0; sucindex < nsucs; sucindex++) {
|
||||
@@ -4500,15 +4500,15 @@ static bool bev_rebuild_polygon(BMesh *bm, BevelParams *bp, BMFace *f)
|
||||
}
|
||||
}
|
||||
if (do_rebuild) {
|
||||
n = BLI_array_count(vv);
|
||||
n = BLI_array_len(vv);
|
||||
f_new = bev_create_ngon(bm, vv, n, NULL, f, NULL, -1, true);
|
||||
|
||||
for (k = 0; k < BLI_array_count(vv_fix); k++) {
|
||||
for (k = 0; k < BLI_array_len(vv_fix); k++) {
|
||||
bev_merge_uvs(bm, vv_fix[k]);
|
||||
}
|
||||
|
||||
/* copy attributes from old edges */
|
||||
BLI_assert(n == BLI_array_count(ee));
|
||||
BLI_assert(n == BLI_array_len(ee));
|
||||
bme_prev = ee[n - 1];
|
||||
for (k = 0; k < n; k++) {
|
||||
bme_new = BM_edge_exists(vv[k], vv[(k + 1) % n]);
|
||||
|
||||
@@ -1762,7 +1762,7 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
|
||||
}
|
||||
|
||||
kcd->linehits = linehits;
|
||||
kcd->totlinehit = BLI_array_count(linehits);
|
||||
kcd->totlinehit = BLI_array_len(linehits);
|
||||
|
||||
/* find position along screen line, used for sorting */
|
||||
for (i = 0; i < kcd->totlinehit; i++) {
|
||||
|
||||
@@ -4071,7 +4071,7 @@ static int loop_find_region(
|
||||
BLI_array_append(stack, l->f);
|
||||
BLI_gset_insert(visit_face_set, l->f);
|
||||
|
||||
while (BLI_array_count(stack) > 0) {
|
||||
while (BLI_array_len(stack) > 0) {
|
||||
BMIter liter1, liter2;
|
||||
BMLoop *l1, *l2;
|
||||
|
||||
@@ -4099,7 +4099,7 @@ static int loop_find_region(
|
||||
BLI_array_free(stack);
|
||||
|
||||
*region_out = region;
|
||||
return BLI_array_count(region);
|
||||
return BLI_array_len(region);
|
||||
}
|
||||
|
||||
static int verg_radial(const void *va, const void *vb)
|
||||
|
||||
@@ -1187,7 +1187,7 @@ static int *getSurroundingVerts(Mesh *me, int vert, int *count)
|
||||
}
|
||||
|
||||
/* Append a and b verts to array, if not yet present. */
|
||||
k = BLI_array_count(verts);
|
||||
k = BLI_array_len(verts);
|
||||
/* XXX Maybe a == b is enough? */
|
||||
while (k-- && !(a == b && a == -1)) {
|
||||
if (verts[k] == a)
|
||||
@@ -1209,7 +1209,7 @@ static int *getSurroundingVerts(Mesh *me, int vert, int *count)
|
||||
}
|
||||
|
||||
/* Do not free the array! */
|
||||
*count = BLI_array_count(verts);
|
||||
*count = BLI_array_len(verts);
|
||||
return verts;
|
||||
}
|
||||
|
||||
|
||||
@@ -482,10 +482,10 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
|
||||
}
|
||||
NODE_TYPES_END
|
||||
|
||||
qsort(sorted_ntypes, BLI_array_count(sorted_ntypes), sizeof(bNodeType *), ui_node_item_name_compare);
|
||||
qsort(sorted_ntypes, BLI_array_len(sorted_ntypes), sizeof(bNodeType *), ui_node_item_name_compare);
|
||||
|
||||
/* generate UI */
|
||||
for (int j = 0; j < BLI_array_count(sorted_ntypes); j++) {
|
||||
for (int j = 0; j < BLI_array_len(sorted_ntypes); j++) {
|
||||
bNodeType *ntype = sorted_ntypes[j];
|
||||
NodeLinkItem *items;
|
||||
int totitems;
|
||||
|
||||
@@ -1746,11 +1746,11 @@ static void uv_weld_align(bContext *C, int tool)
|
||||
}
|
||||
|
||||
/* now we have all verts, make into a line */
|
||||
if (BLI_array_count(eve_line) > 2) {
|
||||
if (BLI_array_len(eve_line) > 2) {
|
||||
|
||||
/* we know the returns from these must be valid */
|
||||
const float *uv_start = uv_sel_co_from_eve(scene, ima, em, eve_line[0]);
|
||||
const float *uv_end = uv_sel_co_from_eve(scene, ima, em, eve_line[BLI_array_count(eve_line) - 1]);
|
||||
const float *uv_end = uv_sel_co_from_eve(scene, ima, em, eve_line[BLI_array_len(eve_line) - 1]);
|
||||
/* For t & u modes */
|
||||
float a = 0.0f;
|
||||
|
||||
@@ -1768,7 +1768,7 @@ static void uv_weld_align(bContext *C, int tool)
|
||||
}
|
||||
|
||||
/* go over all verts except for endpoints */
|
||||
for (i = 0; i < BLI_array_count(eve_line); i++) {
|
||||
for (i = 0; i < BLI_array_len(eve_line); i++) {
|
||||
BM_ITER_ELEM (l, &liter, eve_line[i], BM_LOOPS_OF_VERT) {
|
||||
tf = BM_ELEM_CD_GET_VOID_P(l->f, cd_poly_tex_offset);
|
||||
|
||||
@@ -1904,7 +1904,7 @@ static int uv_remove_doubles_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
for (uv_a_index = 0; uv_a_index < BLI_array_count(vert_arr); uv_a_index++) {
|
||||
for (uv_a_index = 0; uv_a_index < BLI_array_len(vert_arr); uv_a_index++) {
|
||||
if (vert_arr[uv_a_index].weld == false) {
|
||||
float uv_min[2];
|
||||
float uv_max[2];
|
||||
@@ -1918,7 +1918,7 @@ static int uv_remove_doubles_exec(bContext *C, wmOperator *op)
|
||||
copy_v2_v2(uv_min, uv_a);
|
||||
|
||||
vert_arr[uv_a_index].weld = true;
|
||||
for (uv_b_index = uv_a_index + 1; uv_b_index < BLI_array_count(vert_arr); uv_b_index++) {
|
||||
for (uv_b_index = uv_a_index + 1; uv_b_index < BLI_array_len(vert_arr); uv_b_index++) {
|
||||
uv_b = vert_arr[uv_b_index].uv_loop->uv;
|
||||
if ((vert_arr[uv_b_index].weld == false) &&
|
||||
(len_manhattan_v2v2(uv_a, uv_b) < threshold))
|
||||
@@ -1928,10 +1928,10 @@ static int uv_remove_doubles_exec(bContext *C, wmOperator *op)
|
||||
vert_arr[uv_b_index].weld = true;
|
||||
}
|
||||
}
|
||||
if (BLI_array_count(loop_arr)) {
|
||||
if (BLI_array_len(loop_arr)) {
|
||||
float uv_mid[2];
|
||||
mid_v2_v2v2(uv_mid, uv_min, uv_max);
|
||||
for (uv_b_index = 0; uv_b_index < BLI_array_count(loop_arr); uv_b_index++) {
|
||||
for (uv_b_index = 0; uv_b_index < BLI_array_len(loop_arr); uv_b_index++) {
|
||||
copy_v2_v2(loop_arr[uv_b_index]->uv, uv_mid);
|
||||
}
|
||||
}
|
||||
@@ -1966,12 +1966,12 @@ static int uv_remove_doubles_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
for (uv_a_index = 0; uv_a_index < BLI_array_count(loop_arr); uv_a_index++) {
|
||||
for (uv_a_index = 0; uv_a_index < BLI_array_len(loop_arr); uv_a_index++) {
|
||||
float dist_best = FLT_MAX, dist;
|
||||
const float *uv_best = NULL;
|
||||
|
||||
uv_a = loop_arr[uv_a_index]->uv;
|
||||
for (uv_b_index = 0; uv_b_index < BLI_array_count(loop_arr_unselected); uv_b_index++) {
|
||||
for (uv_b_index = 0; uv_b_index < BLI_array_len(loop_arr_unselected); uv_b_index++) {
|
||||
uv_b = loop_arr_unselected[uv_b_index]->uv;
|
||||
dist = len_manhattan_v2v2(uv_a, uv_b);
|
||||
if ((dist < threshold) && (dist < dist_best)) {
|
||||
|
||||
@@ -1304,9 +1304,9 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
|
||||
else if (split_face->len > 4) {
|
||||
/* Maintain a dynamic vert array containing the split_face's
|
||||
* vertices, avoids frequent allocs in collapse_face_corners() */
|
||||
if (BLI_array_count(vert_buf) < split_face->len) {
|
||||
if (BLI_array_len(vert_buf) < split_face->len) {
|
||||
BLI_array_grow_items(vert_buf, (split_face->len -
|
||||
BLI_array_count(vert_buf)));
|
||||
BLI_array_len(vert_buf)));
|
||||
}
|
||||
|
||||
/* Get split face's verts */
|
||||
|
||||
Reference in New Issue
Block a user