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:
authorRohan Rathi <rohanrathi08@gmail.com>2018-05-31 12:12:50 +0300
committerRohan Rathi <rohanrathi08@gmail.com>2018-05-31 12:12:50 +0300
commit9084c57a65854b5ac50583527ecd58ebf6f4f7c6 (patch)
tree724362256d63aeefb25802d2aaec184dd1ab33d2 /source/blender/bmesh/tools/bmesh_bevel.c
parent842245ac55ceca67863cdad252d8959cefb789c5 (diff)
Mark edges that can have seams in Bevel.
Works by going clockwise from first edgehalf in BevVert and marking seam length each time it encounters a pair of edges with seams
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_bevel.c')
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index ca96e5b4b78..ad0e3b9c36e 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -150,6 +150,7 @@ typedef struct BoundVert {
Profile profile; /* edge profile between this and next BoundVert */
bool any_seam; /* are any of the edges attached here seams? */
bool visited; /* used during delta adjust pass */
+ int add_seam;
// int _pad;
} BoundVert;
@@ -1522,6 +1523,38 @@ static void snap_to_superellipsoid(float co[3], const float super_r, bool midlin
co[2] = z;
}
+#define BEV_SEAM(eh) (BM_elem_flag_test(eh->e, BM_ELEM_SEAM))
+
+static void set_bound_vert_extend_seam_sharp_edges(BevVert *bv)
+{
+ EdgeHalf *e = &bv->edges[0], *efirst = &bv->edges[0];
+
+ while (!BEV_SEAM(e)) {
+ e = e->next;
+ if (e == efirst)
+ break;
+ }
+ if (!BEV_SEAM(e))
+ return;
+
+ efirst = e;
+ do {
+ int seam_length = 0;
+ EdgeHalf *ne = e->next;
+
+ while (!BEV_SEAM(ne) && ne != efirst) {
+ if(ne->is_bev)
+ seam_length++;
+ ne = ne->next;
+ }
+ if (ne == e || (ne == efirst && !BEV_SEAM(efirst))) {
+ break;
+ }
+ e->rightv->add_seam = seam_length ? seam_length : 0;
+ e = ne;
+ } while (e != efirst);
+}
+
/* Set the any_seam property for a BevVert and all its BoundVerts */
static void set_bound_vert_seams(BevVert *bv)
{
@@ -1539,6 +1572,8 @@ static void set_bound_vert_seams(BevVert *bv)
}
bv->any_seam |= v->any_seam;
} while ((v = v->next) != bv->vmesh->boundstart);
+
+ set_bound_vert_extend_seam_sharp_edges(bv);
}
static int count_bound_vert_seams(BevVert *bv)