Page MenuHome

UV select overlapping
Needs RevisionPublic

Authored by Lukasz Czyz (glukoz) on Oct 2 2017, 11:47 PM.



Add functionality to select all UV faces which are overlapping each other. The algorithm is optimized: before doing any serious computations it checks overlapping of bounding boxes on two levels: first UV islands bounding boxes are checked and after that individual UV faces bounding boxes.

Diff Detail

Event Timeline

Campbell Barton (campbellbarton) requested changes to this revision.EditedOct 4 2017, 8:11 AM

This is a useful feature, however we already have code to check for overlapping geometry. See: source/blender/blenlib/BLI_kdopbvh.h and calls to BLI_bvhtree_overlap.

Instead of setting up regions this creates a tree structure which can be traversed to check for self-intersection, you can pass same tree twice to BLI_bvhtree_overlap, this is what BM_mesh_intersect does when use_self is set.

Steps to get this working:

  • Create a new BVHTree by triangulating each faces UV's with BLI_polyfill_calc and adding it to the tree, passing the original faces index instead of the triangulated faces index (the Z value can be left at zero)
  • Calling BLI_bvhtree_overlap, selecting the faces that intersect.

There are some details to resolve - such as when to ignore triangles that overlap within the same face, however this shouldn't be too much hassle.

This revision now requires changes to proceed.Oct 4 2017, 8:11 AM