Cleanup: rename 'count' to 'len'

Reserve the term count for values that require calculation
(typically linked lists).
This commit is contained in:
2021-07-06 12:05:27 +10:00
parent 432bfbf7a3
commit 3382b07ad6
17 changed files with 27 additions and 27 deletions

View File

@@ -59,7 +59,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
/* will over alloc if some edges can't be rotated */
edge_array = MEM_mallocN(
sizeof(*edge_array) * (size_t)BMO_slot_buffer_count(op->slots_in, "edges"), __func__);
sizeof(*edge_array) * (size_t)BMO_slot_buffer_len(op->slots_in, "edges"), __func__);
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {

View File

@@ -68,7 +68,7 @@ void bmo_bisect_plane_exec(BMesh *bm, BMOperator *op)
/* Use an array of vertices because 'geom' contains both verts and edges that may use them.
* Removing a vert may remove and edge which is later checked by #BMO_ITER.
* over-allocate the total possible vert count. */
const int vert_arr_max = min_ii(bm->totvert, BMO_slot_buffer_count(op->slots_in, "geom"));
const int vert_arr_max = min_ii(bm->totvert, BMO_slot_buffer_len(op->slots_in, "geom"));
BMVert **vert_arr = MEM_mallocN(sizeof(*vert_arr) * (size_t)vert_arr_max, __func__);
BMOIter siter;
BMVert *v;

View File

@@ -172,7 +172,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMO_op_exec(bm, &op_sub);
/* return if edge net create did something */
if (BMO_slot_buffer_count(op_sub.slots_out, "faces.out")) {
if (BMO_slot_buffer_len(op_sub.slots_out, "faces.out")) {
BMO_slot_copy(&op_sub, slots_out, "faces.out", op, slots_out, "faces.out");
BMO_op_finish(bm, &op_sub);
return;
@@ -191,7 +191,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMO_op_exec(bm, &op_sub);
/* if we dissolved anything, then return */
if (BMO_slot_buffer_count(op_sub.slots_out, "region.out")) {
if (BMO_slot_buffer_len(op_sub.slots_out, "region.out")) {
BMO_slot_copy(&op_sub, slots_out, "region.out", op, slots_out, "faces.out");
BMO_op_finish(bm, &op_sub);
return;
@@ -211,7 +211,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMO_op_exec(bm, &op_sub);
/* return if edge loop fill did something */
if (BMO_slot_buffer_count(op_sub.slots_out, "faces.out")) {
if (BMO_slot_buffer_len(op_sub.slots_out, "faces.out")) {
BMO_slot_copy(&op_sub, slots_out, "faces.out", op, slots_out, "faces.out");
BMO_op_finish(bm, &op_sub);
return;

View File

@@ -79,7 +79,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
BMO_op_exec(bm, &op_attr);
/* check if some faces couldn't be touched */
if (BMO_slot_buffer_count(op_attr.slots_out, "faces_fail.out")) {
if (BMO_slot_buffer_len(op_attr.slots_out, "faces_fail.out")) {
BMO_op_callf(bm, op->flag, "recalc_face_normals faces=%S", &op_attr, "faces_fail.out");
}
BMO_op_finish(bm, &op_attr);

View File

@@ -459,7 +459,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
}
/* Allocate array to store possible vertices that will be dissolved. */
int boundary_edges_len = BMO_slot_map_count(dupeop.slots_out, "boundary_map.out");
int boundary_edges_len = BMO_slot_map_len(dupeop.slots_out, "boundary_map.out");
/* We do not know the real number of boundary vertices. */
int boundary_verts_len_maybe = 2 * boundary_edges_len;
dissolve_verts = MEM_mallocN(boundary_verts_len_maybe * sizeof(*dissolve_verts), __func__);

View File

@@ -161,7 +161,7 @@ void bmo_face_attribute_fill_exec(BMesh *bm, BMOperator *op)
/* now we can copy adjacent data */
face_tot = bmesh_face_attribute_fill(bm, use_normals, use_data);
if (face_tot != BMO_slot_buffer_count(op->slots_in, "faces")) {
if (face_tot != BMO_slot_buffer_len(op->slots_in, "faces")) {
/* any remaining tags will be skipped */
BMO_slot_buffer_from_enabled_hflag(
bm, op, op->slots_out, "faces_fail.out", BM_FACE, BM_ELEM_TAG);

View File

@@ -35,7 +35,7 @@
void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op)
{
/* first collect an array of unique from the edges */
const int tote = BMO_slot_buffer_count(op->slots_in, "edges");
const int tote = BMO_slot_buffer_len(op->slots_in, "edges");
const int totv = tote; /* these should be the same */
BMVert **verts = MEM_mallocN(sizeof(*verts) * totv, __func__);

View File

@@ -66,7 +66,7 @@ void bmo_holes_fill_exec(BMesh *bm, BMOperator *op)
BMO_op_exec(bm, &op_attr);
/* check if some faces couldn't be touched */
if (BMO_slot_buffer_count(op_attr.slots_out, "faces_fail.out")) {
if (BMO_slot_buffer_len(op_attr.slots_out, "faces_fail.out")) {
BMOIter siter;
BMFace *f;

View File

@@ -74,7 +74,7 @@ static BMFace *bm_face_split_walk_back(BMesh *bm, BMLoop *l_src, BMLoop **r_l)
void bmo_offset_edgeloops_exec(BMesh *bm, BMOperator *op)
{
const int edges_num = BMO_slot_buffer_count(op->slots_in, "edges");
const int edges_num = BMO_slot_buffer_len(op->slots_in, "edges");
BMVert **verts;
STACK_DECLARE(verts);
int i;

View File

@@ -41,7 +41,7 @@ void bmo_planar_faces_exec(BMesh *bm, BMOperator *op)
{
const float fac = BMO_slot_float_get(op->slots_in, "factor");
const int iterations = BMO_slot_int_get(op->slots_in, "iterations");
const int faces_num = BMO_slot_buffer_count(op->slots_in, "faces");
const int faces_num = BMO_slot_buffer_len(op->slots_in, "faces");
const float eps = 0.00001f;
const float eps_sq = square_f(eps);

View File

@@ -234,7 +234,7 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
{
BMOIter siter;
BMEdge *e;
const int edges_len = BMO_slot_buffer_count(op->slots_in, "edges");
const int edges_len = BMO_slot_buffer_len(op->slots_in, "edges");
const bool use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
const bool is_single = (edges_len == 1);
short check_flag = is_single ? BM_EDGEROT_CHECK_EXISTS :

View File

@@ -74,7 +74,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
uint nors_tot;
bool calc_winding = false;
sf_vert_map = BLI_ghash_ptr_new_ex(__func__, BMO_slot_buffer_count(op->slots_in, "edges"));
sf_vert_map = BLI_ghash_ptr_new_ex(__func__, BMO_slot_buffer_len(op->slots_in, "edges"));
BMO_slot_vec_get(op->slots_in, "normal", normal);

View File

@@ -393,7 +393,7 @@ void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op)
BMIter iter;
BMVert *v;
BMEdge *e;
float(*cos)[3] = MEM_mallocN(sizeof(*cos) * BMO_slot_buffer_count(op->slots_in, "verts"),
float(*cos)[3] = MEM_mallocN(sizeof(*cos) * BMO_slot_buffer_len(op->slots_in, "verts"),
__func__);
float *co, *co2, clip_dist = BMO_slot_float_get(op->slots_in, "clip_dist");
const float fac = BMO_slot_float_get(op->slots_in, "factor");