Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-07-06 05:05:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-07-06 05:09:52 +0300
commit3382b07ad6cfbb117cf8ec8fc95aa46cf585237e (patch)
treee202bacdebb7808b0dfa73469fdc00570a2abd3f
parent432bfbf7a3b74943b1c251c12bd76616da23991f (diff)
Cleanup: rename 'count' to 'len'
Reserve the term count for values that require calculation (typically linked lists).
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.c12
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c4
-rw-r--r--source/blender/bmesh/operators/bmo_beautify.c2
-rw-r--r--source/blender/bmesh/operators/bmo_bisect_plane.c2
-rw-r--r--source/blender/bmesh/operators/bmo_create.c6
-rw-r--r--source/blender/bmesh/operators/bmo_edgenet.c2
-rw-r--r--source/blender/bmesh/operators/bmo_extrude.c2
-rw-r--r--source/blender/bmesh/operators/bmo_fill_attribute.c2
-rw-r--r--source/blender/bmesh/operators/bmo_fill_edgeloop.c2
-rw-r--r--source/blender/bmesh/operators/bmo_fill_holes.c2
-rw-r--r--source/blender/bmesh/operators/bmo_offset_edgeloops.c2
-rw-r--r--source/blender/bmesh/operators/bmo_planar_faces.c2
-rw-r--r--source/blender/bmesh/operators/bmo_rotate_edges.c2
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c2
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c2
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c4
17 files changed, 27 insertions, 27 deletions
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
index ff6274cff12..bd28022de4b 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.c
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -221,21 +221,21 @@ void *BMO_iter_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
{
BMOIter iter;
BMElem *ele;
- int count = BMO_slot_buffer_count(slot_args, slot_name);
+ const int slot_len = BMO_slot_buffer_len(slot_args, slot_name);
BLI_assert(stack_array_size == 0 || (stack_array_size && stack_array));
- if ((ele = BMO_iter_new(&iter, slot_args, slot_name, restrictmask)) && count > 0) {
- BMElem **array = count > stack_array_size ? MEM_mallocN(sizeof(ele) * count, __func__) :
- stack_array;
+ if ((ele = BMO_iter_new(&iter, slot_args, slot_name, restrictmask)) && slot_len > 0) {
+ BMElem **array = slot_len > stack_array_size ? MEM_mallocN(sizeof(ele) * slot_len, __func__) :
+ stack_array;
int i = 0;
do {
array[i++] = ele;
} while ((ele = BMO_iter_step(&iter)));
- BLI_assert(i <= count);
+ BLI_assert(i <= slot_len);
- if (i != count) {
+ if (i != slot_len) {
if ((void **)array != stack_array) {
array = MEM_reallocN(array, sizeof(ele) * i);
}
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index 767c455e5e9..0f9488bd091 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -565,8 +565,8 @@ void BMO_slot_buffer_from_single(BMOperator *op, BMOpSlot *slot, BMHeader *ele);
void *BMO_slot_buffer_get_single(BMOpSlot *slot);
/* counts number of elements inside a slot array. */
-int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
-int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+int BMO_slot_buffer_len(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+int BMO_slot_map_len(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
void BMO_slot_map_insert(BMOperator *op, BMOpSlot *slot, const void *element, const void *data);
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 4a611d78d58..cf7697ad35f 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -678,7 +678,7 @@ void BMO_mesh_selected_remap(BMesh *bm,
}
}
-int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
+int BMO_slot_buffer_len(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
@@ -691,7 +691,7 @@ int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot
return slot->len;
}
-int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
+int BMO_slot_map_len(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
diff --git a/source/blender/bmesh/operators/bmo_beautify.c b/source/blender/bmesh/operators/bmo_beautify.c
index de26ca5ebd2..a72ff6363ed 100644
--- a/source/blender/bmesh/operators/bmo_beautify.c
+++ b/source/blender/bmesh/operators/bmo_beautify.c
@@ -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) {
diff --git a/source/blender/bmesh/operators/bmo_bisect_plane.c b/source/blender/bmesh/operators/bmo_bisect_plane.c
index 55b6337bea4..6296694f121 100644
--- a/source/blender/bmesh/operators/bmo_bisect_plane.c
+++ b/source/blender/bmesh/operators/bmo_bisect_plane.c
@@ -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;
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index 2e2a7e0964e..a740e4d66e8 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -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;
diff --git a/source/blender/bmesh/operators/bmo_edgenet.c b/source/blender/bmesh/operators/bmo_edgenet.c
index 5449762b83c..8e4b0732feb 100644
--- a/source/blender/bmesh/operators/bmo_edgenet.c
+++ b/source/blender/bmesh/operators/bmo_edgenet.c
@@ -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);
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index ffdce943d9f..0cedc2324f2 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -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__);
diff --git a/source/blender/bmesh/operators/bmo_fill_attribute.c b/source/blender/bmesh/operators/bmo_fill_attribute.c
index e377fa6079b..5e8924c4a3b 100644
--- a/source/blender/bmesh/operators/bmo_fill_attribute.c
+++ b/source/blender/bmesh/operators/bmo_fill_attribute.c
@@ -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);
diff --git a/source/blender/bmesh/operators/bmo_fill_edgeloop.c b/source/blender/bmesh/operators/bmo_fill_edgeloop.c
index 2b481542463..da4567d947b 100644
--- a/source/blender/bmesh/operators/bmo_fill_edgeloop.c
+++ b/source/blender/bmesh/operators/bmo_fill_edgeloop.c
@@ -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__);
diff --git a/source/blender/bmesh/operators/bmo_fill_holes.c b/source/blender/bmesh/operators/bmo_fill_holes.c
index 64107fefe73..a24d81c5bdb 100644
--- a/source/blender/bmesh/operators/bmo_fill_holes.c
+++ b/source/blender/bmesh/operators/bmo_fill_holes.c
@@ -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;
diff --git a/source/blender/bmesh/operators/bmo_offset_edgeloops.c b/source/blender/bmesh/operators/bmo_offset_edgeloops.c
index 98a8432cfb1..28f2c9a47aa 100644
--- a/source/blender/bmesh/operators/bmo_offset_edgeloops.c
+++ b/source/blender/bmesh/operators/bmo_offset_edgeloops.c
@@ -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;
diff --git a/source/blender/bmesh/operators/bmo_planar_faces.c b/source/blender/bmesh/operators/bmo_planar_faces.c
index c8f9d9a38dd..53cfc379269 100644
--- a/source/blender/bmesh/operators/bmo_planar_faces.c
+++ b/source/blender/bmesh/operators/bmo_planar_faces.c
@@ -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);
diff --git a/source/blender/bmesh/operators/bmo_rotate_edges.c b/source/blender/bmesh/operators/bmo_rotate_edges.c
index f05f6489c99..10dd9dcc9b7 100644
--- a/source/blender/bmesh/operators/bmo_rotate_edges.c
+++ b/source/blender/bmesh/operators/bmo_rotate_edges.c
@@ -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 :
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index f6d612f31eb..9fa74bb64c3 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -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);
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index c056302ca0f..7d2b6b73455 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -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");
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 03f94e9f753..2d071954e58 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -973,7 +973,7 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
#ifdef USE_FACE_CREATE_SEL_EXTEND
/* normally we would want to leave the new geometry selected,
* but being able to press F many times to add geometry is too useful! */
- if (ele_desel && (BMO_slot_buffer_count(bmop.slots_out, "faces.out") == 1) &&
+ if (ele_desel && (BMO_slot_buffer_len(bmop.slots_out, "faces.out") == 1) &&
(ele_desel_face = BMO_slot_buffer_get_first(bmop.slots_out, "faces.out"))) {
edbm_add_edge_face_exec__tricky_finalize_sel(em->bm, ele_desel, ele_desel_face);
}
@@ -2344,7 +2344,7 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
BMO_slot_buffer_hflag_enable(
em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, true);
- const int tot_rotate = BMO_slot_buffer_count(bmop.slots_out, "edges.out");
+ const int tot_rotate = BMO_slot_buffer_len(bmop.slots_out, "edges.out");
const int tot_failed = tot - tot_rotate;
tot_rotate_all += tot_rotate;