diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-01-18 02:58:54 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-01-18 03:01:17 +0300 |
commit | 27dff3fbc1e74aa6613d68a0d9f9b0096fc86f6e (patch) | |
tree | 91c4fb3bbe944a4f9e0e6d72a25d12310872f849 /source/blender/modifiers/intern/MOD_laplaciandeform.c | |
parent | 8400b4b566350bd9d726a07627e74f5a995280da (diff) | |
parent | e6df02861e17f75d4dd243776f35208681b78465 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/modifiers/intern/MOD_laplaciandeform.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_laplaciandeform.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index d322b8631d2..72db3f1c132 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -108,12 +108,12 @@ static LaplacianSystem *initLaplacianSystem( sys->total_anchors = totalAnchors; sys->repeat = iterations; BLI_strncpy(sys->anchor_grp_name, defgrpName, sizeof(sys->anchor_grp_name)); - sys->co = MEM_mallocN(sizeof(float[3]) * totalVerts, "DeformCoordinates"); - sys->no = MEM_callocN(sizeof(float[3]) * totalVerts, "DeformNormals"); - sys->delta = MEM_callocN(sizeof(float[3]) * totalVerts, "DeformDeltas"); - sys->tris = MEM_mallocN(sizeof(int[3]) * totalTris, "DeformFaces"); - sys->index_anchors = MEM_mallocN(sizeof(int) * (totalAnchors), "DeformAnchors"); - sys->unit_verts = MEM_callocN(sizeof(int) * totalVerts, "DeformUnitVerts"); + sys->co = MEM_malloc_arrayN(totalVerts, sizeof(float[3]), "DeformCoordinates"); + sys->no = MEM_calloc_arrayN(totalVerts, sizeof(float[3]), "DeformNormals"); + sys->delta = MEM_calloc_arrayN(totalVerts, sizeof(float[3]), "DeformDeltas"); + sys->tris = MEM_malloc_arrayN(totalTris, sizeof(int[3]), "DeformFaces"); + sys->index_anchors = MEM_malloc_arrayN((totalAnchors), sizeof(int), "DeformAnchors"); + sys->unit_verts = MEM_calloc_arrayN(totalVerts, sizeof(int), "DeformUnitVerts"); return sys; } @@ -142,7 +142,7 @@ static void createFaceRingMap( { int i, j, totalr = 0; int *indices, *index_iter; - MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * mvert_tot, "DeformRingMap"); + MeshElemMap *map = MEM_calloc_arrayN(mvert_tot, sizeof(MeshElemMap), "DeformRingMap"); const MLoopTri *mlt; for (i = 0, mlt = mlooptri; i < mtri_tot; i++, mlt++) { @@ -153,7 +153,7 @@ static void createFaceRingMap( totalr++; } } - indices = MEM_callocN(sizeof(int) * totalr, "DeformRingIndex"); + indices = MEM_calloc_arrayN(totalr, sizeof(int), "DeformRingIndex"); index_iter = indices; for (i = 0; i < mvert_tot; i++) { map[i].indices = index_iter; @@ -175,7 +175,7 @@ static void createVertRingMap( const int mvert_tot, const MEdge *medge, const int medge_tot, MeshElemMap **r_map, int **r_indices) { - MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * mvert_tot, "DeformNeighborsMap"); + MeshElemMap *map = MEM_calloc_arrayN(mvert_tot, sizeof(MeshElemMap), "DeformNeighborsMap"); int i, vid[2], totalr = 0; int *indices, *index_iter; const MEdge *me; @@ -187,7 +187,7 @@ static void createVertRingMap( map[vid[1]].count++; totalr += 2; } - indices = MEM_callocN(sizeof(int) * totalr, "DeformNeighborsIndex"); + indices = MEM_calloc_arrayN(totalr, sizeof(int), "DeformNeighborsIndex"); index_iter = indices; for (i = 0; i < mvert_tot; i++) { map[i].indices = index_iter; @@ -521,7 +521,7 @@ static void initSystem(LaplacianDeformModifierData *lmd, Object *ob, DerivedMesh LaplacianSystem *sys; if (isValidVertexGroup(lmd, ob, dm)) { - int *index_anchors = MEM_mallocN(sizeof(int) * numVerts, __func__); /* over-alloc */ + int *index_anchors = MEM_malloc_arrayN(numVerts, sizeof(int), __func__); /* over-alloc */ const MLoopTri *mlooptri; const MLoop *mloop; @@ -547,7 +547,7 @@ static void initSystem(LaplacianDeformModifierData *lmd, Object *ob, DerivedMesh memcpy(sys->index_anchors, index_anchors, sizeof(int) * total_anchors); memcpy(sys->co, vertexCos, sizeof(float[3]) * numVerts); MEM_freeN(index_anchors); - lmd->vertexco = MEM_mallocN(sizeof(float[3]) * numVerts, "ModDeformCoordinates"); + lmd->vertexco = MEM_malloc_arrayN(numVerts, sizeof(float[3]), "ModDeformCoordinates"); memcpy(lmd->vertexco, vertexCos, sizeof(float[3]) * numVerts); lmd->total_verts = numVerts; @@ -631,7 +631,7 @@ static void LaplacianDeformModifier_do( sys = lmd->cache_system; if (sysdif) { if (sysdif == LAPDEFORM_SYSTEM_ONLY_CHANGE_ANCHORS || sysdif == LAPDEFORM_SYSTEM_ONLY_CHANGE_GROUP) { - filevertexCos = MEM_mallocN(sizeof(float[3]) * numVerts, "TempModDeformCoordinates"); + filevertexCos = MEM_malloc_arrayN(numVerts, sizeof(float[3]), "TempModDeformCoordinates"); memcpy(filevertexCos, lmd->vertexco, sizeof(float[3]) * numVerts); MEM_SAFE_FREE(lmd->vertexco); lmd->total_verts = 0; @@ -667,7 +667,7 @@ static void LaplacianDeformModifier_do( lmd->flag &= ~MOD_LAPLACIANDEFORM_BIND; } else if (lmd->total_verts > 0 && lmd->total_verts == numVerts) { - filevertexCos = MEM_mallocN(sizeof(float[3]) * numVerts, "TempDeformCoordinates"); + filevertexCos = MEM_malloc_arrayN(numVerts, sizeof(float[3]), "TempDeformCoordinates"); memcpy(filevertexCos, lmd->vertexco, sizeof(float[3]) * numVerts); MEM_SAFE_FREE(lmd->vertexco); lmd->total_verts = 0; |