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:
authorHoward Trickey <howard.trickey@gmail.com>2014-05-31 00:07:45 +0400
committerHoward Trickey <howard.trickey@gmail.com>2014-05-31 00:07:45 +0400
commitd504b325fbb287d004f2fbb6b29442be2ea460d0 (patch)
tree677a7bb0b5a3977204010958d69111954237719d /source/blender/bmesh/tools
parent6b538f42718c175ad5659d394094b512ac058756 (diff)
Fix T37618 Bevel mismatched offsets and bad profile plane.
Used a different technique to resolve "impossible" offset cases that makes more consistency. Also changed the plane in which the profile lies for the case with only one beveled edge and more than 3 other edges.
Diffstat (limited to 'source/blender/bmesh/tools')
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index f436c1fc919..78bbdd1b5d2 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -588,7 +588,9 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, float
if (ang < 100.0f * BEVEL_EPSILON) {
/* special case: e1 and e2 are parallel; put offset point perp to both, from v.
* need to find a suitable plane.
- * if offsets are different, we're out of luck: just use e1->offset_r */
+ * if offsets are different, we're out of luck:
+ * use the max of the two (so get consistent looking results if the same situation
+ * arises elsewhere in the object but with opposite roles for e1 and e2 */
if (f)
copy_v3_v3(norm_v, f->no);
else
@@ -596,18 +598,24 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, float
cross_v3_v3v3(norm_perp1, dir1, norm_v);
normalize_v3(norm_perp1);
copy_v3_v3(off1a, v->co);
- madd_v3_v3fl(off1a, norm_perp1, e1->offset_r);
- if (e2->offset_l != e1->offset_r)
- e2->offset_l = e1->offset_r;
+ d = max_ff(e1->offset_r, e2->offset_l);
+ madd_v3_v3fl(off1a, norm_perp1, d);
+ if (e1->offset_r != d)
+ e1->offset_r = d;
+ else if (e2->offset_l != d)
+ e2->offset_l = d;
copy_v3_v3(meetco, off1a);
}
else if (fabsf(ang - (float)M_PI) < 100.0f * BEVEL_EPSILON) {
/* special case e1 and e2 are antiparallel, so bevel is into
* a zero-area face. Just make the offset point on the
* common line, at offset distance from v. */
- slide_dist(e2, v, e1->offset_r, meetco);
- if (e2->offset_l != e1->offset_r)
- e2->offset_l = e1->offset_r;
+ d = max_ff(e1->offset_r, e2->offset_l);
+ slide_dist(e2, v, d, meetco);
+ if (e1->offset_r != d)
+ e1->offset_r = d;
+ else if (e2->offset_l != d)
+ e2->offset_l = d;
}
else {
/* Get normal to plane where meet point should be,
@@ -1549,8 +1557,8 @@ static void build_boundary(BevelParams *bp, BevVert *bv, bool construct)
calculate_profile(bp, v);
} while ((v = v->next) != vm->boundstart);
- if (bv->selcount == 1 && bv->edgecount == 3) {
- /* special case: snap profile to third face */
+ if (bv->selcount == 1 && bv->edgecount >= 3) {
+ /* special case: snap profile to plane of adjacent two edges */
v = vm->boundstart;
BLI_assert(v->ebev != NULL);
move_profile_plane(v, v->efirst, v->next->elast);