Page MenuHome

Multi-Object EditMode: LATTICE_OT_flip
Needs ReviewPublic

Authored by Habib Gahbiche (zazizizou) on Dec 14 2018, 7:09 PM.

Details

Summary

LATTICE_OT_flip now uses global symmetry axis. This is done in 3 steps.

  1. Compute global center
  2. Mirror along desired global axis
  3. Swap lattice indices along local axis corresponding to global axis to correct for unwanted effects, such as flipped normals etc..

Diff Detail

Repository
rB Blender
Branch
LATTICE_flip (branched from blender2.8)
Build Status
Buildable 2631
Build 2631: arc lint + arc unit

Event Timeline

Habib Gahbiche (zazizizou) edited the summary of this revision. (Show Details)

Covered two more rotation cases.

Dalai Felinto (dfelinto) requested changes to this revision.Dec 15 2018, 12:13 AM

Crashed in simple test:

  • Tab twice {*}.
  • Flip (Alt + F) > U (X)

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/dfelinto/src/blender/blender/source/blender/blenlib/intern/math_vector_inline.c:260 in swap_v3_v3
Full backtrace: P873

{*} - (otherwise the second object won't be selected - unrelated bug, a bug nonetheless if you want to investigate it separately go ahead)

This revision now requires changes to proceed.Dec 15 2018, 12:13 AM

Also I skimmed over it, but I'm a bit skeptical at the length of the new code. It seems surprisingly more lengthy than the original one.

  • Tab twice {*}.

Can't reproduce. But maybe because I'm not building with everything enabled. I'll investigate more...

  • Flip (Alt + F) > U (X)

For me it behaves as expected (?), i.e. If you scale in x-direction by -1 you would get the same result. Or maybe you're getting something related to (*)?

Also I skimmed over it, but I'm a bit skeptical at the length of the new code. It seems surprisingly more lengthy than the original one.

The function lattice_swap_indices() is what makes the code much larger. The original code does the mirroring and index swapping at once in one step. Here, I need to do the mirroring globally (because axis is now global), and the index swapping locally. Hence the extra code.

Can't reproduce. But maybe because I'm not building with everything enabled. I'll investigate more...

Are you Linux? If so you can build with WITH_COMPILER_ASAN to catch those.

Fixed crash detected by an address sanitizer. Gizmos still not updating properly.

{*} - (otherwise the second object won't be selected - unrelated bug, a bug nonetheless if you want to investigate it separately go ahead)

I submitted a fix for this bug: D4091

Habib Gahbiche (zazizizou) edited the summary of this revision. (Show Details)

Fixed gizmos not updating.

Updated patch such that it can be applied to current master.
Updated style using clang-format.

Please keep the patch to a minimum. There are way too many cosmetic changes that do not belong here.

source/blender/editors/lattice/editlattice_tools.c
313

without testing or anything it seems strange this is not else if.

368

Why are you changing the code like this? Keep the patch to a minimum. Please do not mix cleanups with coding otherwise the patch gets unnecessarily big.

Can we first agree that this patch produces the expected behavior before continuing with the review of the code itself? For instance the check for rotation was introduced and the check for odd/even numbers of points was eliminated.

The attached blend file shows what this patch produces vs. what I would have expected for 3 cases. I cannot produce a case where the normals are flipped (sphere would look much smaller or squashed) when both lattices are rotated.