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>2012-04-23 06:17:57 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-23 06:17:57 +0400
commit792f536b368067fd27d0eefbe1bf6c91123220f4 (patch)
tree125ac2b55c19bc3ea0ec49b684810cb983ffff4d /source/blender/bmesh/operators/bmo_triangulate.c
parent16ff7e40e66f93484695445b89090547de78d086 (diff)
code cleanup: better use of BLI_array_* (grow in larger steps where possible), include BMO_iter_new in for loops.
Diffstat (limited to 'source/blender/bmesh/operators/bmo_triangulate.c')
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 916b10d707e..7fd6cf6769c 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -51,21 +51,16 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(newfaces);
float (*projectverts)[3] = NULL;
BLI_array_declare(projectverts);
- int i, lastlen = 0 /* , count = 0 */;
+ int i;
const int use_beauty = BMO_slot_bool_get(op, "use_beauty");
- face = BMO_iter_new(&siter, bm, op, "faces", BM_FACE);
- for ( ; face; face = BMO_iter_step(&siter)) {
- if (lastlen < face->len) {
- BLI_array_empty(projectverts);
- BLI_array_empty(newfaces);
- for (lastlen = 0; lastlen < face->len; lastlen++) {
- BLI_array_growone(projectverts);
- BLI_array_growone(projectverts);
- BLI_array_growone(projectverts);
- BLI_array_growone(newfaces);
- }
- }
+ for (face = BMO_iter_new(&siter, bm, op, "faces", BM_FACE); face; face = BMO_iter_step(&siter)) {
+
+ BLI_array_empty(projectverts);
+ BLI_array_empty(newfaces);
+
+ BLI_array_growitems(projectverts, face->len * 3);
+ BLI_array_growitems(newfaces, face->len);
BM_face_triangulate(bm, face, projectverts, EDGE_NEW, FACE_NEW, newfaces, use_beauty);