diff options
author | Campbell Barton <campbell@blender.org> | 2022-03-28 04:29:47 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-03-28 06:41:31 +0300 |
commit | 6f305577b346030249bdb762f887136ff02624e3 (patch) | |
tree | 207b1cbba07e8a0f864ff854d6d1a74c26c6beaf /source/blender/modifiers/intern/MOD_array.c | |
parent | 24839fdefa89339e77465c27d89c86cd5ac0cdd9 (diff) |
Cleanup: use "num" as a suffix in: source/blender/modifiers
Also rename DNA struct members.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_array.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_array.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index b237f952287..758858c8b1d 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -139,17 +139,17 @@ static void svert_from_mvert(SortVertsElem *sv, /** * Take as inputs two sets of verts, to be processed for detection of doubles and mapping. - * Each set of verts is defined by its start within mverts array and its num_verts; + * Each set of verts is defined by its start within mverts array and its verts_num; * It builds a mapping for all vertices within source, * to vertices within target, or -1 if no double found. - * The int doubles_map[num_verts_source] array must have been allocated by caller. + * The `int doubles_map[verts_source_num]` array must have been allocated by caller. */ static void dm_mvert_map_doubles(int *doubles_map, const MVert *mverts, const int target_start, - const int target_num_verts, + const int target_verts_num, const int source_start, - const int source_num_verts, + const int source_verts_num, const float dist) { const float dist3 = ((float)M_SQRT3 + 0.00005f) * dist; /* Just above sqrt(3) */ @@ -158,12 +158,12 @@ static void dm_mvert_map_doubles(int *doubles_map, SortVertsElem *sve_source, *sve_target, *sve_target_low_bound; bool target_scan_completed; - target_end = target_start + target_num_verts; - source_end = source_start + source_num_verts; + target_end = target_start + target_verts_num; + source_end = source_start + source_verts_num; /* build array of MVerts to be tested for merging */ - sorted_verts_target = MEM_malloc_arrayN(target_num_verts, sizeof(SortVertsElem), __func__); - sorted_verts_source = MEM_malloc_arrayN(source_num_verts, sizeof(SortVertsElem), __func__); + sorted_verts_target = MEM_malloc_arrayN(target_verts_num, sizeof(SortVertsElem), __func__); + sorted_verts_source = MEM_malloc_arrayN(source_verts_num, sizeof(SortVertsElem), __func__); /* Copy target vertices index and cos into SortVertsElem array */ svert_from_mvert(sorted_verts_target, mverts + target_start, target_start, target_end); @@ -172,8 +172,8 @@ static void dm_mvert_map_doubles(int *doubles_map, svert_from_mvert(sorted_verts_source, mverts + source_start, source_start, source_end); /* sort arrays according to sum of vertex coordinates (sumco) */ - qsort(sorted_verts_target, target_num_verts, sizeof(SortVertsElem), svert_sum_cmp); - qsort(sorted_verts_source, source_num_verts, sizeof(SortVertsElem), svert_sum_cmp); + qsort(sorted_verts_target, target_verts_num, sizeof(SortVertsElem), svert_sum_cmp); + qsort(sorted_verts_source, source_verts_num, sizeof(SortVertsElem), svert_sum_cmp); sve_target_low_bound = sorted_verts_target; i_target_low_bound = 0; @@ -181,7 +181,7 @@ static void dm_mvert_map_doubles(int *doubles_map, /* Scan source vertices, in #SortVertsElem sorted array, * all the while maintaining the lower bound of possible doubles in target vertices. */ - for (i_source = 0, sve_source = sorted_verts_source; i_source < source_num_verts; + for (i_source = 0, sve_source = sorted_verts_source; i_source < source_verts_num; i_source++, sve_source++) { int best_target_vertex = -1; float best_dist_sq = dist * dist; @@ -202,13 +202,13 @@ static void dm_mvert_map_doubles(int *doubles_map, /* Skip all target vertices that are more than dist3 lower in terms of sumco */ /* and advance the overall lower bound, applicable to all remaining vertices as well. */ - while ((i_target_low_bound < target_num_verts) && + while ((i_target_low_bound < target_verts_num) && (sve_target_low_bound->sum_co < sve_source_sumco - dist3)) { i_target_low_bound++; sve_target_low_bound++; } /* If end of target list reached, then no more possible doubles */ - if (i_target_low_bound >= target_num_verts) { + if (i_target_low_bound >= target_verts_num) { doubles_map[sve_source->vertex_num] = -1; target_scan_completed = true; continue; @@ -221,7 +221,7 @@ static void dm_mvert_map_doubles(int *doubles_map, /* i_target will scan vertices in the * [v_source_sumco - dist3; v_source_sumco + dist3] range */ - while ((i_target < target_num_verts) && (sve_target->sum_co <= sve_source_sumco + dist3)) { + while ((i_target < target_verts_num) && (sve_target->sum_co <= sve_source_sumco + dist3)) { /* Testing distance for candidate double in target */ /* v_target is within dist3 of v_source in terms of sumco; check real distance */ float dist_sq; @@ -478,7 +478,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd, } /* About 67 million vertices max seems a decent limit for now. */ - const size_t max_num_vertices = 1 << 26; + const size_t max_vertices_num = 1 << 26; /* calculate the maximum number of copies which will fit within the * prescribed length */ @@ -496,7 +496,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd, * vertices. */ if (((size_t)count * (size_t)chunk_nverts + (size_t)start_cap_nverts + - (size_t)end_cap_nverts) > max_num_vertices) { + (size_t)end_cap_nverts) > max_vertices_num) { count = 1; offset_is_too_small = true; } @@ -518,7 +518,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd, * vertices. */ else if (((size_t)count * (size_t)chunk_nverts + (size_t)start_cap_nverts + - (size_t)end_cap_nverts) > max_num_vertices) { + (size_t)end_cap_nverts) > max_vertices_num) { count = 1; BKE_modifier_set_error(ctx->object, &amd->modifier, |