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>2017-03-11 15:19:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-03-11 15:26:13 +0300
commitce155ad2f699c67bcbc9802c8481556aaa8240e0 (patch)
treeb0db92ff774cfb726fa56f92ad9633bf64973354 /source/blender/bmesh/tools/bmesh_separate.c
parent96868a39419f1c9a8962c56e02480fabbf1e5156 (diff)
Correct recent bmesh separate addition
- Was setting flag incorrectly to avoid re-use. - Check edge has loops before accessing.
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_separate.c')
-rw-r--r--source/blender/bmesh/tools/bmesh_separate.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/bmesh/tools/bmesh_separate.c b/source/blender/bmesh/tools/bmesh_separate.c
index 571da2ff94c..04e03664956 100644
--- a/source/blender/bmesh/tools/bmesh_separate.c
+++ b/source/blender/bmesh/tools/bmesh_separate.c
@@ -49,10 +49,10 @@ void BM_mesh_separate_faces(
* - Create an array of faces based on 'filter_fn'.
* First part of array for match, for non-match.
*
- * - Clear all vertex tags, then tag all vertices from 'faces_b'.
+ * - Enable all vertex tags, then clear all tagged vertices from 'faces_b'.
*
* - Loop over 'faces_a', checking each vertex,
- * splitting out any which are tagged (and therefor shared).
+ * splitting out any which aren't tagged (and therefor shared), disabling tags as we go.
*/
BMFace *f;
@@ -95,8 +95,8 @@ void BM_mesh_separate_faces(
do {
if (!BM_elem_flag_test(l_iter->v, BM_ELEM_TAG)) {
BMVert *v = l_iter->v;
- /* Disable, since we may visit this vertex again on other faces */
- BM_elem_flag_disable(v, BM_ELEM_TAG);
+ /* Enable, since we may visit this vertex again on other faces */
+ BM_elem_flag_enable(v, BM_ELEM_TAG);
/* We know the vertex is shared, collect all vertices and split them off. */
@@ -105,15 +105,17 @@ void BM_mesh_separate_faces(
BMEdge *e_first, *e_iter;
e_iter = e_first = l_iter->e;
do {
- BMLoop *l_radial_first, *l_radial_iter;
- l_radial_first = l_radial_iter = e_iter->l;
- do {
- if (l_radial_iter->v == v) {
- if (filter_fn(l_radial_iter->f, user_data)) {
- BLI_buffer_append(&loop_split, BMLoop *, l_radial_iter);
+ if (e_iter->l != NULL) {
+ BMLoop *l_radial_first, *l_radial_iter;
+ l_radial_first = l_radial_iter = e_iter->l;
+ do {
+ if (l_radial_iter->v == v) {
+ if (filter_fn(l_radial_iter->f, user_data)) {
+ BLI_buffer_append(&loop_split, BMLoop *, l_radial_iter);
+ }
}
- }
- } while ((l_radial_iter = l_radial_iter->radial_next) != l_radial_first);
+ } while ((l_radial_iter = l_radial_iter->radial_next) != l_radial_first);
+ }
} while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e_first);
}