diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/bmesh/tools/bmesh_edgesplit.c | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_edgesplit.c')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_edgesplit.c | 195 |
1 files changed, 97 insertions, 98 deletions
diff --git a/source/blender/bmesh/tools/bmesh_edgesplit.c b/source/blender/bmesh/tools/bmesh_edgesplit.c index 198b3efa8cc..332672d7c3c 100644 --- a/source/blender/bmesh/tools/bmesh_edgesplit.c +++ b/source/blender/bmesh/tools/bmesh_edgesplit.c @@ -26,113 +26,112 @@ #include "bmesh.h" -#include "bmesh_edgesplit.h" /* own include */ +#include "bmesh_edgesplit.h" /* own include */ /** * \param use_verts: Use flagged verts instead of edges. * \param tag_only: Only split tagged edges. * \param copy_select: Copy selection history. */ -void BM_mesh_edgesplit( - BMesh *bm, - const bool use_verts, - const bool tag_only, const bool copy_select) +void BM_mesh_edgesplit(BMesh *bm, + const bool use_verts, + const bool tag_only, + const bool copy_select) { - BMIter iter; - BMEdge *e; - - bool use_ese = false; - GHash *ese_gh = NULL; - - if (copy_select && bm->selected.first) { - BMEditSelection *ese; - - ese_gh = BLI_ghash_ptr_new(__func__); - for (ese = bm->selected.first; ese; ese = ese->next) { - if (ese->htype != BM_FACE) { - BLI_ghash_insert(ese_gh, ese->ele, ese); - } - } - - use_ese = true; - } - - if (tag_only == false) { - BM_mesh_elem_hflag_enable_all(bm, BM_EDGE | (use_verts ? BM_VERT : 0), BM_ELEM_TAG, false); - } - - if (use_verts) { - /* prevent one edge having both verts unflagged - * we could alternately disable these edges, either way its a corner case. - * - * This is needed so we don't split off the edge but then none of its verts which - * would leave a duplicate edge. - */ - BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - if (BM_elem_flag_test(e, BM_ELEM_TAG)) { - if (UNLIKELY(((BM_elem_flag_test(e->v1, BM_ELEM_TAG) == false) && - (BM_elem_flag_test(e->v2, BM_ELEM_TAG) == false)))) - { - BM_elem_flag_enable(e->v1, BM_ELEM_TAG); - BM_elem_flag_enable(e->v2, BM_ELEM_TAG); - } - } - } - } - - BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - if (BM_elem_flag_test(e, BM_ELEM_TAG)) { - BM_elem_flag_enable(e->v1, BM_ELEM_TAG); - BM_elem_flag_enable(e->v2, BM_ELEM_TAG); - } - } - - BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - if (BM_elem_flag_test(e, BM_ELEM_TAG)) { - uint i; - for (i = 0; i < 2; i++) { - BMVert *v = ((&e->v1)[i]); - if (BM_elem_flag_test(v, BM_ELEM_TAG)) { - BM_elem_flag_disable(v, BM_ELEM_TAG); - - if (use_ese) { - BMVert **vtar; - int vtar_len; - - BM_vert_separate_hflag(bm, v, BM_ELEM_TAG, copy_select, &vtar, &vtar_len); - - /* first value is always in 'v' */ - if (vtar_len > 1) { - BMEditSelection *ese = BLI_ghash_lookup(ese_gh, v); - BLI_assert(v == vtar[0]); - if (UNLIKELY(ese)) { - int j; - for (j = 1; j < vtar_len; j++) { - BLI_assert(v != vtar[j]); - BM_select_history_store_after_notest(bm, ese, vtar[j]); - } - } - } - MEM_freeN(vtar); - } - else { - BM_vert_separate_hflag(bm, v, BM_ELEM_TAG, copy_select, NULL, NULL); - } - } - } - } - } + BMIter iter; + BMEdge *e; + + bool use_ese = false; + GHash *ese_gh = NULL; + + if (copy_select && bm->selected.first) { + BMEditSelection *ese; + + ese_gh = BLI_ghash_ptr_new(__func__); + for (ese = bm->selected.first; ese; ese = ese->next) { + if (ese->htype != BM_FACE) { + BLI_ghash_insert(ese_gh, ese->ele, ese); + } + } + + use_ese = true; + } + + if (tag_only == false) { + BM_mesh_elem_hflag_enable_all(bm, BM_EDGE | (use_verts ? BM_VERT : 0), BM_ELEM_TAG, false); + } + + if (use_verts) { + /* prevent one edge having both verts unflagged + * we could alternately disable these edges, either way its a corner case. + * + * This is needed so we don't split off the edge but then none of its verts which + * would leave a duplicate edge. + */ + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { + if (BM_elem_flag_test(e, BM_ELEM_TAG)) { + if (UNLIKELY(((BM_elem_flag_test(e->v1, BM_ELEM_TAG) == false) && + (BM_elem_flag_test(e->v2, BM_ELEM_TAG) == false)))) { + BM_elem_flag_enable(e->v1, BM_ELEM_TAG); + BM_elem_flag_enable(e->v2, BM_ELEM_TAG); + } + } + } + } + + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { + if (BM_elem_flag_test(e, BM_ELEM_TAG)) { + BM_elem_flag_enable(e->v1, BM_ELEM_TAG); + BM_elem_flag_enable(e->v2, BM_ELEM_TAG); + } + } + + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { + if (BM_elem_flag_test(e, BM_ELEM_TAG)) { + uint i; + for (i = 0; i < 2; i++) { + BMVert *v = ((&e->v1)[i]); + if (BM_elem_flag_test(v, BM_ELEM_TAG)) { + BM_elem_flag_disable(v, BM_ELEM_TAG); + + if (use_ese) { + BMVert **vtar; + int vtar_len; + + BM_vert_separate_hflag(bm, v, BM_ELEM_TAG, copy_select, &vtar, &vtar_len); + + /* first value is always in 'v' */ + if (vtar_len > 1) { + BMEditSelection *ese = BLI_ghash_lookup(ese_gh, v); + BLI_assert(v == vtar[0]); + if (UNLIKELY(ese)) { + int j; + for (j = 1; j < vtar_len; j++) { + BLI_assert(v != vtar[j]); + BM_select_history_store_after_notest(bm, ese, vtar[j]); + } + } + } + MEM_freeN(vtar); + } + else { + BM_vert_separate_hflag(bm, v, BM_ELEM_TAG, copy_select, NULL, NULL); + } + } + } + } + } #ifndef NDEBUG - /* ensure we don't have any double edges! */ - BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - if (BM_elem_flag_test(e, BM_ELEM_TAG)) { - BLI_assert(BM_edge_find_double(e) == NULL); - } - } + /* ensure we don't have any double edges! */ + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { + if (BM_elem_flag_test(e, BM_ELEM_TAG)) { + BLI_assert(BM_edge_find_double(e) == NULL); + } + } #endif - if (use_ese) { - BLI_ghash_free(ese_gh, NULL, NULL); - } + if (use_ese) { + BLI_ghash_free(ese_gh, NULL, NULL); + } } |