PYTHON: Improve UV Shells Determination (mesh_linked_uv_islands)

This is the copy from this issue: https://developer.blender.org/T86715

I noticed if I will use bpy_extras.mesh_utils.mesh_linked_uv_islands(mesh) it will not take into account 3d islands
It would be nice to have an option to separate 3d islands and UV shells too. You could add a variable in the method.
Something like mesh_linked_uv_islands(mesh, separate_in_3d=False) .
I did 3d separation. Could you check it, please? May be you could add it into blender.
Here is my modification: https://pastebin.com/bpChLcSC

  • Open Blender
  • Create a plane with UVs
  • Go to EditMode and duplicate some faces.
  • Run my script and check Console
    You will see that my modification will have many UV Shells when the default one will have only one UV Shell.