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>2013-09-09 06:16:22 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-09-09 06:16:22 +0400
commit40b6532ec813b696a88c485b3090c24bd1a0c9cc (patch)
treec68f74ce1d11f49f7a0efebdb06d6922ead33ac9 /source/blender/blenkernel/intern/mesh_evaluate.c
parent2646bbdccbea62d451391d3512b5a50457a95974 (diff)
remove use of BLI_array in BKE_mesh_mpoly_to_mface(). was over-allocating anyway so just allocate the array once.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_evaluate.c')
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index d35d91cc45a..37ec8a82b2c 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -42,7 +42,6 @@
#include "BLI_bitmap.h"
#include "BLI_scanfill.h"
#include "BLI_alloca.h"
-#include "BLI_array.h"
#include "BKE_customdata.h"
#include "BKE_mesh.h"
@@ -1288,14 +1287,16 @@ int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
int k;
MPoly *mp, *mpoly;
- MFace *mface = NULL, *mf;
- BLI_array_declare(mface);
+ MFace *mface, *mf;
const int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
const bool hasPCol = CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL);
const bool hasOrigSpace = CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP);
+ /* over-alloc, ngons will be skipped */
+ mface = MEM_mallocN(sizeof(*mface) * (size_t)totpoly, __func__);
+
mpoly = CustomData_get_layer(pdata, CD_MPOLY);
mloop = CustomData_get_layer(ldata, CD_MLOOP);
@@ -1303,7 +1304,6 @@ int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
k = 0;
for (i = 0; i < totpoly; i++, mp++) {
if (ELEM(mp->totloop, 3, 4)) {
- BLI_array_grow_one(mface);
mf = &mface[k];
mf->mat_nr = mp->mat_nr;