[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59123] trunk/blender/source/blender/bmesh /operators/bmo_edgenet.c: bmo_edgenet_fill_exec was building a vertex array when it didnt need to.
Campbell Barton
ideasman42 at gmail.com
Wed Aug 14 00:28:16 CEST 2013
Revision: 59123
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59123
Author: campbellbarton
Date: 2013-08-13 22:28:16 +0000 (Tue, 13 Aug 2013)
Log Message:
-----------
bmo_edgenet_fill_exec was building a vertex array when it didnt need to. also simplify for loops.
Modified Paths:
--------------
trunk/blender/source/blender/bmesh/operators/bmo_edgenet.c
Modified: trunk/blender/source/blender/bmesh/operators/bmo_edgenet.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_edgenet.c 2013-08-13 20:01:30 UTC (rev 59122)
+++ trunk/blender/source/blender/bmesh/operators/bmo_edgenet.c 2013-08-13 22:28:16 UTC (rev 59123)
@@ -891,8 +891,6 @@
BMOIter siter;
BMFace *f;
BMEdge *e;
- BMVert **verts = NULL;
- BLI_array_declare(verts);
EPath *path;
EPathNode *node;
EdgeData *edata;
@@ -904,7 +902,7 @@
const bool use_fill_check = BMO_slot_bool_get(op->slots_in, "use_fill_check");
const short mat_nr = BMO_slot_int_get(op->slots_in, "mat_nr");
const bool use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
- int i, j;
+ int i;
unsigned int winding[2]; /* accumulte winding directions for each edge which has a face */
BMOpSlot *slot_restrict = BMO_slot_get(op->slots_in, "restrict");
BMOpSlot *slot_face_groupmap_out = BMO_slot_get(op->slots_out, "face_groupmap.out");
@@ -984,17 +982,16 @@
winding[0] = winding[1] = 0;
BLI_array_empty(edges);
- BLI_array_empty(verts);
i = 0;
for (node = path->nodes.first; node; node = node->next) {
- if (!node->next)
- continue;
+ e = BM_edge_exists(node->v, node->next ?
+ node->next->v :
+ ((EPathNode *)path->nodes.first)->v);
- e = BM_edge_exists(node->v, node->next->v);
-
- /* this should never happe */
- if (!e)
+ if (count_edge_faces(bm, e) >= 2) {
+ edge_free_path(pathbase, path);
break;
+ }
/* check on the winding */
if (e->l) {
@@ -1004,45 +1001,26 @@
edata[BM_elem_index_get(e)].ftag++;
BLI_array_grow_one(edges);
edges[i++] = e;
-
- BLI_array_append(verts, node->v);
}
- if (edge->l) {
- vote_on_winding(edge, path->nodes.last, winding);
- }
-
- BLI_array_grow_one(edges);
- edges[i++] = edge;
- edata[BM_elem_index_get(edge)].ftag++;
-
- for (j = 0; j < i; j++) {
- if (count_edge_faces(bm, edges[j]) >= 2) {
- edge_free_path(pathbase, path);
- break;
- }
- }
-
- if (j != i) {
+ /* above loop quit early */
+ if (node) {
continue;
}
if (i) {
BMVert *v1, *v2;
- /* to define the winding order must select first edge,
- * otherwise we could leave this as-is */
- edge = edges[0];
-
/* if these are even it doesn't really matter what to do,
* with consistent geometry one will be zero, the choice is clear */
+ node = path->nodes.first;
if (winding[0] < winding[1]) {
- v1 = verts[0];
- v2 = verts[1];
+ v1 = node->v;
+ v2 = node->next->v;
}
else {
- v1 = verts[1];
- v2 = verts[0];
+ v1 = node->next->v;
+ v2 = node->v;
}
if ((use_fill_check == false) ||
@@ -1070,7 +1048,6 @@
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_NEW);
BLI_array_free(edges);
- BLI_array_free(verts);
edge_pathbase_free(pathbase);
MEM_freeN(edata);
MEM_freeN(vdata);
More information about the Bf-blender-cvs
mailing list