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.
This commit is contained in:
Howard Trickey
2020-02-27 16:36:17 -05:00
parent 91abb70006
commit 30158b6ed0
2 changed files with 7 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -27,7 +27,7 @@ struct MDeformVert;
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,