diff options
author | Miguel G <ghaspias> | 2021-08-03 08:55:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-08-03 09:00:32 +0300 |
commit | a53feb0aff5227fe0728275285ad35b6eba57508 (patch) | |
tree | 8c819f8524c05588f8fabf58c484a0112208290e /source/blender/modifiers/intern | |
parent | c1a477b497c8d57ff9b402fdd285ea0f8d91d221 (diff) |
Fix T89691: Solidify modifier simple/complex inconsistency
Maintain the sign when clamping non zero offset.
Reviewed By: campbellbarton, weasel
Ref D11832
Diffstat (limited to 'source/blender/modifiers/intern')
-rw-r--r-- | source/blender/modifiers/intern/MOD_solidify_nonmanifold.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c index b872f04b60f..18d308e5f02 100644 --- a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c +++ b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c @@ -71,6 +71,15 @@ static float angle_signed_on_axis_normalized_v3v3_v3(const float n[3], return angle; } +static float clamp_nonzero(const float value, const float epsilon) +{ + BLI_assert(!(epsilon < 0.0f)); + if (value < 0.0f) { + return min_ff(value, -epsilon); + } + return max_ff(value, epsilon); +} + /** \} */ /* -------------------------------------------------------------------- */ @@ -164,8 +173,8 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md, const float ofs_front = (smd->offset_fac + 1.0f) * 0.5f * smd->offset; const float ofs_back = ofs_front - smd->offset * smd->offset_fac; - const float ofs_front_clamped = max_ff(1e-5f, fabsf(smd->offset > 0 ? ofs_front : ofs_back)); - const float ofs_back_clamped = max_ff(1e-5f, fabsf(smd->offset > 0 ? ofs_back : ofs_front)); + const float ofs_front_clamped = clamp_nonzero(smd->offset > 0 ? ofs_front : ofs_back, 1e-5f); + const float ofs_back_clamped = clamp_nonzero(smd->offset > 0 ? ofs_back : ofs_front, 1e-5f); const float offset_fac_vg = smd->offset_fac_vg; const float offset_fac_vg_inv = 1.0f - smd->offset_fac_vg; const float offset = fabsf(smd->offset) * smd->offset_clamp; |