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_build.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_build.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_build.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index cd77abfca50..d7baea7887d 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -58,7 +58,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct Mesh *result; BuildModifierData *bmd = (BuildModifierData *)md; int i, j, k; - int numFaces_dst, numEdges_dst, numLoops_dst = 0; + int faces_dst_num, edges_dst_num, loops_dst_num = 0; int *vertMap, *edgeMap, *faceMap; float frac; MPoly *mpoly_dst; @@ -71,21 +71,21 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct /* maps edge indices in old mesh to indices in new mesh */ GHash *edgeHash2 = BLI_ghash_int_new("build ed apply gh"); - const int numVert_src = mesh->totvert; - const int numEdge_src = mesh->totedge; - const int numPoly_src = mesh->totpoly; + const int vert_src_num = mesh->totvert; + const int edge_src_num = mesh->totedge; + const int poly_src_num = mesh->totpoly; MPoly *mpoly_src = mesh->mpoly; MLoop *mloop_src = mesh->mloop; MEdge *medge_src = mesh->medge; MVert *mvert_src = mesh->mvert; - vertMap = MEM_malloc_arrayN(numVert_src, sizeof(*vertMap), "build modifier vertMap"); - edgeMap = MEM_malloc_arrayN(numEdge_src, sizeof(*edgeMap), "build modifier edgeMap"); - faceMap = MEM_malloc_arrayN(numPoly_src, sizeof(*faceMap), "build modifier faceMap"); + vertMap = MEM_malloc_arrayN(vert_src_num, sizeof(*vertMap), "build modifier vertMap"); + edgeMap = MEM_malloc_arrayN(edge_src_num, sizeof(*edgeMap), "build modifier edgeMap"); + faceMap = MEM_malloc_arrayN(poly_src_num, sizeof(*faceMap), "build modifier faceMap"); - range_vn_i(vertMap, numVert_src, 0); - range_vn_i(edgeMap, numEdge_src, 0); - range_vn_i(faceMap, numPoly_src, 0); + range_vn_i(vertMap, vert_src_num, 0); + range_vn_i(edgeMap, edge_src_num, 0); + range_vn_i(faceMap, poly_src_num, 0); struct Scene *scene = DEG_get_input_scene(ctx->depsgraph); frac = (BKE_scene_ctime_get(scene) - bmd->start) / bmd->length; @@ -94,17 +94,17 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct frac = 1.0f - frac; } - numFaces_dst = numPoly_src * frac; - numEdges_dst = numEdge_src * frac; + faces_dst_num = poly_src_num * frac; + edges_dst_num = edge_src_num * frac; /* if there's at least one face, build based on faces */ - if (numFaces_dst) { + if (faces_dst_num) { MPoly *mpoly, *mp; MLoop *ml, *mloop; uintptr_t hash_num, hash_num_alt; if (bmd->flag & MOD_BUILD_FLAG_RANDOMIZE) { - BLI_array_randomize(faceMap, sizeof(*faceMap), numPoly_src, bmd->seed); + BLI_array_randomize(faceMap, sizeof(*faceMap), poly_src_num, bmd->seed); } /* get the set of all vert indices that will be in the final mesh, @@ -113,7 +113,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct mpoly = mpoly_src; mloop = mloop_src; hash_num = 0; - for (i = 0; i < numFaces_dst; i++) { + for (i = 0; i < faces_dst_num; i++) { mp = mpoly + faceMap[i]; ml = mloop + mp->loopstart; @@ -125,7 +125,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct } } - numLoops_dst += mp->totloop; + loops_dst_num += mp->totloop; } BLI_assert(hash_num == BLI_ghash_len(vertHash)); @@ -134,7 +134,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct */ hash_num = 0; hash_num_alt = 0; - for (i = 0; i < numEdge_src; i++, hash_num_alt++) { + for (i = 0; i < edge_src_num; i++, hash_num_alt++) { MEdge *me = medge_src + i; if (BLI_ghash_haskey(vertHash, POINTER_FROM_INT(me->v1)) && @@ -146,12 +146,12 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct } BLI_assert(hash_num == BLI_ghash_len(edgeHash)); } - else if (numEdges_dst) { + else if (edges_dst_num) { MEdge *medge, *me; uintptr_t hash_num; if (bmd->flag & MOD_BUILD_FLAG_RANDOMIZE) { - BLI_array_randomize(edgeMap, sizeof(*edgeMap), numEdge_src, bmd->seed); + BLI_array_randomize(edgeMap, sizeof(*edgeMap), edge_src_num, bmd->seed); } /* get the set of all vert indices that will be in the final mesh, @@ -160,7 +160,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct medge = medge_src; hash_num = 0; BLI_assert(hash_num == BLI_ghash_len(vertHash)); - for (i = 0; i < numEdges_dst; i++) { + for (i = 0; i < edges_dst_num; i++) { void **val_p; me = medge + edgeMap[i]; @@ -176,7 +176,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct BLI_assert(hash_num == BLI_ghash_len(vertHash)); /* get the set of edges that will be in the new mesh */ - for (i = 0; i < numEdges_dst; i++) { + for (i = 0; i < edges_dst_num; i++) { j = BLI_ghash_len(edgeHash); BLI_ghash_insert(edgeHash, POINTER_FROM_INT(j), POINTER_FROM_INT(edgeMap[i])); @@ -184,23 +184,23 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct } } else { - int numVerts = numVert_src * frac; + int verts_num = vert_src_num * frac; if (bmd->flag & MOD_BUILD_FLAG_RANDOMIZE) { - BLI_array_randomize(vertMap, sizeof(*vertMap), numVert_src, bmd->seed); + BLI_array_randomize(vertMap, sizeof(*vertMap), vert_src_num, bmd->seed); } /* get the set of all vert indices that will be in the final mesh, * mapped to the new indices */ - for (i = 0; i < numVerts; i++) { + for (i = 0; i < verts_num; i++) { BLI_ghash_insert(vertHash, POINTER_FROM_INT(vertMap[i]), POINTER_FROM_INT(i)); } } /* now we know the number of verts, edges and faces, we can create the mesh. */ result = BKE_mesh_new_nomain_from_template( - mesh, BLI_ghash_len(vertHash), BLI_ghash_len(edgeHash), 0, numLoops_dst, numFaces_dst); + mesh, BLI_ghash_len(vertHash), BLI_ghash_len(edgeHash), 0, loops_dst_num, faces_dst_num); /* copy the vertices across */ GHASH_ITER (gh_iter, vertHash) { @@ -237,7 +237,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct /* copy the faces across, remapping indices */ k = 0; - for (i = 0; i < numFaces_dst; i++) { + for (i = 0; i < faces_dst_num; i++) { MPoly *source; MPoly *dest; |