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>2014-03-03 18:48:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-03-03 18:53:19 +0400
commit6f80980847b9f6172608d8067acf560d6d193c39 (patch)
treebbaf6f62f15f382ed6efd2a474867b7cbe824114
parentef2815eb5a78da58c2acaeb396694dbc165b2733 (diff)
Debug function to check valid bmesh now detects duplicate edges
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_validate.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.c b/source/blender/bmesh/intern/bmesh_mesh_validate.c
index e6eee16e49c..3a7a4f85e99 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_validate.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_validate.c
@@ -33,6 +33,7 @@
#ifdef DEBUG
#include "BLI_utildefines.h"
+#include "BLI_edgehash.h"
#include "bmesh.h"
@@ -53,6 +54,7 @@
*/
bool BM_mesh_validate(BMesh *bm)
{
+ EdgeHash *edge_hash = BLI_edgehash_new_ex(__func__, bm->totedge);
int errtot;
BMIter iter;
@@ -84,8 +86,21 @@ bool BM_mesh_validate(BMesh *bm)
/* check edges */
BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) {
- if (e->v1 == e->v2)
- ERRMSG("edge %d: duplicate index: %d", i, BM_elem_index_get(e->v1));
+ BMEdge *e_other;
+
+ if (e->v1 == e->v2) {
+ ERRMSG("edge %d: duplicate index: %d", i, BM_elem_index_get(e->v1));
+ }
+
+
+ /* build edgehash at the same time */
+ e_other = BLI_edgehash_lookup(edge_hash, BM_elem_index_get(e->v1), BM_elem_index_get(e->v2));
+ if (e_other) {
+ ERRMSG("edge %d, %d: are duplicates", i, BM_elem_index_get(e_other));
+ }
+ else {
+ BLI_edgehash_insert(edge_hash, BM_elem_index_get(e->v1), BM_elem_index_get(e->v2), e);
+ }
}
/* edge radial structure */
@@ -177,7 +192,7 @@ bool BM_mesh_validate(BMesh *bm)
}
}
-
+ BLI_edgehash_free(edge_hash, NULL);
ERRMSG("Finished - errors %d", errtot);