diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2020-02-28 00:36:17 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2020-02-28 00:36:17 +0300 |
commit | 30158b6ed0648a875fd7d2c98b3377d4bbe1e5fb (patch) | |
tree | b32ee1e52df0e8423e5679252fad6225b57124e1 /source/blender/bmesh/tools/bmesh_bevel.c | |
parent | 91abb70006866e651233ff44f0f275856a6bf65d (diff) |
Fix T74256, crash in bmesh.ops.bevel if segments not set.
Also changed signature of bevel function to take integer
for segments instead of float, which is just wrong.
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_bevel.c')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index d8c2057bb56..0ff89aa3127 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -7145,7 +7145,7 @@ static void bevel_limit_offset(BevelParams *bp, BMesh *bm) void BM_mesh_bevel(BMesh *bm, const float offset, const int offset_type, - const float segments, + const int segments, const float profile, const bool vertex_only, const bool use_weights, @@ -7176,7 +7176,7 @@ void BM_mesh_bevel(BMesh *bm, bp.offset = offset; bp.offset_type = offset_type; - bp.seg = (int)segments; + bp.seg = segments; bp.profile = profile; bp.pro_super_r = -logf(2.0) / logf(sqrtf(profile)); /* Convert to superellipse exponent. */ bp.vertex_only = vertex_only; @@ -7207,6 +7207,10 @@ void BM_mesh_bevel(BMesh *bm, bp.miter_inner = BEVEL_MITER_SHARP; } + if (bp.seg <= 1) { + bp.seg = 1; + } + if (profile >= 0.950f) { /* r ~ 692, so PRO_SQUARE_R is 1e4 */ bp.pro_super_r = PRO_SQUARE_R; } |