diff options
author | Rohan Rathi <rohanrathi08@gmail.com> | 2018-06-01 18:48:26 +0300 |
---|---|---|
committer | Rohan Rathi <rohanrathi08@gmail.com> | 2018-06-01 18:48:26 +0300 |
commit | 2f5704486d50f94619f02497475b344250d03213 (patch) | |
tree | 14a1586209190e282038a023ae72cd7447879f6b /source/blender/bmesh/tools/bmesh_bevel.c | |
parent | 9084c57a65854b5ac50583527ecd58ebf6f4f7c6 (diff) |
Added ability to apply seams to all middle edges
between the 2 marked edges. currently does not make changes to material
or sharpness of edges
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_bevel.c')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index ad0e3b9c36e..999639877a7 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -1555,6 +1555,51 @@ static void set_bound_vert_extend_seam_sharp_edges(BevVert *bv) } while (e != efirst); } +static void bevel_add_seams(BevVert *bv) +{ + VMesh *vm = bv->vmesh; + + BoundVert *bcur = bv->vmesh->boundstart, *start = bcur; + + do { + if (bcur->add_seam) { + if (!bv->vmesh->boundstart->add_seam && start == bv->vmesh->boundstart) + start = bcur; + + int idxlen = bcur->index + bcur->add_seam; + for (int i = bcur->index; i < idxlen; i++) { + BMVert *v1 = mesh_vert(vm, i % vm->count, 0, 0)->v, *v2; + BMEdge *e; + for (int k = 1; k < vm->seg; k++) { + v2 = mesh_vert(vm, i % vm->count, 0, k)->v; + + e = v1->e; + while (e->v1 != v2 && e->v2 != v2) { + if (e->v1 == v1) + e = e->v1_disk_link.next; + else + e = e->v2_disk_link.next; + } + BM_elem_flag_set(e, BM_ELEM_SEAM, true); + v1 = v2; + } + BMVert *v3 = mesh_vert(vm, (i + 1) % vm->count, 0, 0)->v; + e = v1->e; + while (e->v1 != v3 && e->v2 != v3) { + if (e->v1 == v1) + e = e->v1_disk_link.next; + else + e = e->v2_disk_link.next; + } + BM_elem_flag_set(e, BM_ELEM_SEAM, true); + bcur = bcur->next; + } + } + else + bcur = bcur->next; + } while (bcur != start); +} + /* Set the any_seam property for a BevVert and all its BoundVerts */ static void set_bound_vert_seams(BevVert *bv) { @@ -5471,7 +5516,9 @@ void BM_mesh_bevel( BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v, BM_ELEM_TAG)) { - BLI_assert(find_bevvert(&bp, v) != NULL); + BevVert *bv = find_bevvert(&bp, v); + BLI_assert(bv != NULL); + bevel_add_seams(bv); BM_vert_kill(bm, v); } } |