Page MenuHome

Cleanup: Complex Solidify
Needs RevisionPublic

Authored by Henrik Dick (weasel) on Jul 3 2020, 11:38 PM.

Details

Summary

This patch refactors a whole lot in the file for complex solidify to make it more readable and maybe even extendible. There are no (intentional) functional changes apart from now using angle_normalized_v3v3 in the local utility at the top.

Diff Detail

Repository
rB Blender
Branch
solidifycleanup2 (branched from master)
Build Status
Buildable 13522
Build 13522: arc lint + arc unit

Event Timeline

Henrik Dick (weasel) requested review of this revision.Jul 3 2020, 11:38 PM
Henrik Dick (weasel) created this revision.
This comment was removed by Henrik Dick (weasel).

In the meantime I found 3 (unreported) crashes and 2 bugs in complex solidify. I have fixes for the 3 crashes in a local branch based on this cleanup. After they are in I plan to fix the vertex group factor when flat faces are enabled (unreported) and T80269.

The new plan is to make the bug fixes on the version before this cleanup (current) to also be applied on 2.90 and to get this cleanup after all currently known bugs are fixed.

After the cleanup I will move the merging feature from solidify to the weld modifier as a simple/fast weld mode (rewriting it along the way).
This should make complex solidify faster and the weld modifier more versatile. It will also reduce the amount of complexity in complex solidify for maintenance and further extentions.

  • rebase

@Campbell Barton (campbellbarton) I would like to get a review on this patch now.
I used find and replace commands for most of the names cleanup, so there should not be any errors.
I used copy and paste to get the code into the functions and again replace to change it to using the new context struct.
I also tested it on my (animated) test file with all previously known difficult cases and it didn't show any changes nor did it crash.

Miguel G. (ghaspias) requested changes to this revision.Jul 6 2021, 5:03 PM

In relation to bug T89691, I tested a potential fix, which seems to work correctly in all scenarios. It's a small diff to the file MOD_solidify_nonmanifold.c @ lines 167-168:

diff -U 3 C:/Users/ARRE/Documents/MOD_solidify_nonmanifold.c C:/blender-git/blender/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
--- C:/Users/ARRE/Documents/MOD_solidify_nonmanifold.c	Tue Jul  6 15:55:58 2021
+++ C:/blender-git/blender/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c	Tue Jul  6 15:55:07 2021
@@ -164,8 +164,8 @@
 
   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 = max_ff(1e-5f, fabsf(smd->offset > 0 ? ofs_front : ofs_back)) * ((smd->offset > 0 ? ofs_front : ofs_back) > 0 ? 1.0f : -1.0f);
+  const float ofs_back_clamped = max_ff(1e-5f, fabsf(smd->offset > 0 ? ofs_back : ofs_front)) * ((smd->offset > 0 ? ofs_back : ofs_front) > 0 ? 1.0f : -1.0f);
   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;

Tested against master branch, built ok, and have performed a number of tests with different geometries and offset/thickness.

This revision now requires changes to proceed.Jul 6 2021, 5:03 PM