[Bf-blender-cvs] [a53feb0aff5] master: Fix T89691: Solidify modifier simple/complex inconsistency

Miguel G noreply at git.blender.org
Tue Aug 3 08:00:50 CEST 2021


Commit: a53feb0aff5227fe0728275285ad35b6eba57508
Author: Miguel G
Date:   Tue Aug 3 15:55:35 2021 +1000
Branches: master
https://developer.blender.org/rBa53feb0aff5227fe0728275285ad35b6eba57508

Fix T89691: Solidify modifier simple/complex inconsistency

Maintain the sign when clamping non zero offset.

Reviewed By: campbellbarton, weasel

Ref D11832

===================================================================

M	source/blender/modifiers/intern/MOD_solidify_nonmanifold.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list