fix [#31456] Extreme lag editing meshes

running BM_CHECK_ELEMENT was taking over 75% of the time to subdivide a mesh, since this only reports errors, and is so slow - only run this on non-release builds.
This commit is contained in:
Campbell Barton
2012-09-12 04:53:49 +00:00
parent 0ee9075e48
commit bd5fdf63cb
2 changed files with 14 additions and 4 deletions

View File

@@ -340,6 +340,8 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
return f;
}
#ifndef NDEBUG
/**
* Check the element is valid.
*
@@ -476,6 +478,8 @@ int bmesh_elem_check(void *element, const char htype)
return err;
}
#endif /* NDEBUG */
/**
* low level function, only frees the vert,
* doesn't change or adjust surrounding geometry

View File

@@ -37,15 +37,21 @@
*/
/* returns positive nonzero on error */
int bmesh_elem_check(void *element, const char htype);
#define BM_CHECK_ELEMENT(el) \
#ifdef NDEBUG
/* no error checking for release,
* it can take most of the CPU time when running some tools */
# define BM_CHECK_ELEMENT(el) (void)(el)
#else
int bmesh_elem_check(void *element, const char htype);
# define BM_CHECK_ELEMENT(el) \
if (bmesh_elem_check(el, ((BMHeader *)el)->htype)) { \
printf("check_element failure, with code %i on line %i in file\n" \
" \"%s\"\n\n", \
bmesh_elem_check(el, ((BMHeader *)el)->htype), \
bmesh_elem_check(el, ((BMHeader *)el)->htype), \
__LINE__, __FILE__); \
}
} (void)0
#endif
#define BM_DISK_EDGE_LINK_GET(e, v) ( \
((v) == ((BMEdge *)(e))->v1) ? \