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:
@@ -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
|
||||
|
@@ -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) ? \
|
||||
|
Reference in New Issue
Block a user