diff options
Diffstat (limited to 'source/blender/modifiers/intern/MOD_meshcache.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_meshcache.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c index 3e022a5951d..e5a62ba96b6 100644 --- a/source/blender/modifiers/intern/MOD_meshcache.c +++ b/source/blender/modifiers/intern/MOD_meshcache.c @@ -77,7 +77,7 @@ static void meshcache_do(MeshCacheModifierData *mcmd, Object *ob, Mesh *mesh, float (*vertexCos_Real)[3], - int numVerts) + int verts_num) { const bool use_factor = mcmd->factor < 1.0f; int influence_group_index; @@ -87,7 +87,7 @@ static void meshcache_do(MeshCacheModifierData *mcmd, float(*vertexCos_Store)[3] = (use_factor || influence_group_index != -1 || (mcmd->deform_mode == MOD_MESHCACHE_DEFORM_INTEGRATE)) ? MEM_malloc_arrayN( - numVerts, sizeof(*vertexCos_Store), __func__) : + verts_num, sizeof(*vertexCos_Store), __func__) : NULL; float(*vertexCos)[3] = vertexCos_Store ? vertexCos_Store : vertexCos_Real; @@ -151,11 +151,11 @@ static void meshcache_do(MeshCacheModifierData *mcmd, switch (mcmd->type) { case MOD_MESHCACHE_TYPE_MDD: ok = MOD_meshcache_read_mdd_times( - filepath, vertexCos, numVerts, mcmd->interp, time, fps, mcmd->time_mode, &err_str); + filepath, vertexCos, verts_num, mcmd->interp, time, fps, mcmd->time_mode, &err_str); break; case MOD_MESHCACHE_TYPE_PC2: ok = MOD_meshcache_read_pc2_times( - filepath, vertexCos, numVerts, mcmd->interp, time, fps, mcmd->time_mode, &err_str); + filepath, vertexCos, verts_num, mcmd->interp, time, fps, mcmd->time_mode, &err_str); break; default: ok = false; @@ -171,7 +171,7 @@ static void meshcache_do(MeshCacheModifierData *mcmd, if (UNLIKELY(ob->type != OB_MESH)) { BKE_modifier_set_error(ob, &mcmd->modifier, "'Integrate' only valid for Mesh objects"); } - else if (UNLIKELY(me->totvert != numVerts)) { + else if (UNLIKELY(me->totvert != verts_num)) { BKE_modifier_set_error(ob, &mcmd->modifier, "'Integrate' original mesh vertex mismatch"); } else if (UNLIKELY(me->totpoly == 0)) { @@ -182,11 +182,11 @@ static void meshcache_do(MeshCacheModifierData *mcmd, int i; float(*vertexCos_Source)[3] = MEM_malloc_arrayN( - numVerts, sizeof(*vertexCos_Source), __func__); - float(*vertexCos_New)[3] = MEM_malloc_arrayN(numVerts, sizeof(*vertexCos_New), __func__); + verts_num, sizeof(*vertexCos_Source), __func__); + float(*vertexCos_New)[3] = MEM_malloc_arrayN(verts_num, sizeof(*vertexCos_New), __func__); MVert *mv = me->mvert; - for (i = 0; i < numVerts; i++, mv++) { + for (i = 0; i < verts_num; i++, mv++) { copy_v3_v3(vertexCos_Source[i], mv->co); } @@ -204,7 +204,7 @@ static void meshcache_do(MeshCacheModifierData *mcmd, ); /* write the corrected locations back into the result */ - memcpy(vertexCos, vertexCos_New, sizeof(*vertexCos) * numVerts); + memcpy(vertexCos, vertexCos_New, sizeof(*vertexCos) * verts_num); MEM_freeN(vertexCos_Source); MEM_freeN(vertexCos_New); @@ -244,7 +244,7 @@ static void meshcache_do(MeshCacheModifierData *mcmd, if (use_matrix) { int i; - for (i = 0; i < numVerts; i++) { + for (i = 0; i < verts_num; i++) { mul_m3_v3(mat, vertexCos[i]); } } @@ -260,7 +260,7 @@ static void meshcache_do(MeshCacheModifierData *mcmd, mcmd->factor : 0.0f; if (mesh->dvert != NULL) { - for (int i = 0; i < numVerts; i++) { + for (int i = 0; i < verts_num; i++) { /* For each vertex, compute its blending factor between the mesh cache (for `fac = 0`) * and the former position of the vertex (for `fac = 1`). */ const MDeformVert *currentIndexDVert = dvert + i; @@ -275,10 +275,10 @@ static void meshcache_do(MeshCacheModifierData *mcmd, } else if (use_factor) { /* Influence_group_index is -1. */ - interp_vn_vn(*vertexCos_Real, *vertexCos_Store, mcmd->factor, numVerts * 3); + interp_vn_vn(*vertexCos_Real, *vertexCos_Store, mcmd->factor, verts_num * 3); } else { - memcpy(vertexCos_Real, vertexCos_Store, sizeof(*vertexCos_Store) * numVerts); + memcpy(vertexCos_Real, vertexCos_Store, sizeof(*vertexCos_Store) * verts_num); } } @@ -290,7 +290,7 @@ static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh, float (*vertexCos)[3], - int numVerts) + int verts_num) { MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md; Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph); @@ -299,9 +299,9 @@ static void deformVerts(ModifierData *md, if (ctx->object->type == OB_MESH && mcmd->defgrp_name[0] != '\0') { /* `mesh_src` is only needed for vertex groups. */ - mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); + mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, verts_num, false, false); } - meshcache_do(mcmd, scene, ctx->object, mesh_src, vertexCos, numVerts); + meshcache_do(mcmd, scene, ctx->object, mesh_src, vertexCos, verts_num); if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); @@ -313,7 +313,7 @@ static void deformVertsEM(ModifierData *md, struct BMEditMesh *editData, Mesh *mesh, float (*vertexCos)[3], - int numVerts) + int verts_num) { MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md; Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph); @@ -322,13 +322,14 @@ static void deformVertsEM(ModifierData *md, if (ctx->object->type == OB_MESH && mcmd->defgrp_name[0] != '\0') { /* `mesh_src` is only needed for vertex groups. */ - mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, false, false); + mesh_src = MOD_deform_mesh_eval_get( + ctx->object, editData, mesh, NULL, verts_num, false, false); } if (mesh_src != NULL) { BKE_mesh_wrapper_ensure_mdata(mesh_src); } - meshcache_do(mcmd, scene, ctx->object, mesh_src, vertexCos, numVerts); + meshcache_do(mcmd, scene, ctx->object, mesh_src, vertexCos, verts_num); if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); |