diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2020-01-30 15:56:00 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2020-01-30 15:56:00 +0300 |
commit | 30963eecfb3be0dd50624d54f2111e7f1ed49d6b (patch) | |
tree | 8a85e425f88fffd59201c75b1f224f3e87bb1762 /source/blender/bmesh | |
parent | e207cba8cca58c0e5a7de41fe86233e0f28ccb0c (diff) |
Fix T73450, crash when adding segments on bevel.
Needed to protect against a case where clamp overlap limited
the offset to approximately zero, and the snap-to-pipe code
would therefore encounter an almost degenerate profile and
fail in matrix inversion.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index bc84c6872c4..d3b3541a539 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -4272,6 +4272,10 @@ static void snap_to_pipe_profile(BoundVert *vpipe, bool midline, float co[3]) copy_v3_v3(va, pro->start); copy_v3_v3(vb, pro->end); + if (compare_v3v3(va, vb, BEVEL_EPSILON_D)) { + copy_v3_v3(co, va); + return; + } /* Get a plane with the normal pointing along the beveled edge */ sub_v3_v3v3(edir, e->e->v1->co, e->e->v2->co); @@ -4280,13 +4284,8 @@ static void snap_to_pipe_profile(BoundVert *vpipe, bool midline, float co[3]) closest_to_plane_v3(va0, plane, va); closest_to_plane_v3(vb0, plane, vb); closest_to_plane_v3(vmid0, plane, pro->middle); - if (make_unit_square_map(va0, vmid0, vb0, m)) { + if (make_unit_square_map(va0, vmid0, vb0, m) && invert_m4_m4(minv, m)) { /* Transform co and project it onto superellipse */ - if (!invert_m4_m4(minv, m)) { - /* shouldn't happen */ - BLI_assert(!"failed inverse during pipe profile snap"); - return; - } mul_v3_m4v3(p, minv, co); snap_to_superellipsoid(p, pro->super_r, midline); |