diff options
author | Chris Blackbourn <chrisbblend@gmail.com> | 2022-08-27 07:01:56 +0300 |
---|---|---|
committer | Chris Blackbourn <chrisbblend@gmail.com> | 2022-08-27 07:09:17 +0300 |
commit | 3cba80039d5db1d2d23ff754ab427f8ed66a71f8 (patch) | |
tree | 7c61e59678640030204e66d534f7f48878df4ad2 /release | |
parent | f7027f22534f75995a46f9d69a564ec0c6522d4c (diff) |
UV: bpy_extras.mesh_utils.mesh_linked_uv_islands raises error in edit mode
Maniphest Tasks: T86484
Differential Revision: https://developer.blender.org/D15778
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/bpy_extras/mesh_utils.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index f6dc33e4f02..d593ce6a1e4 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -13,14 +13,22 @@ __all__ = ( def mesh_linked_uv_islands(mesh): """ - Splits the mesh into connected polygons, use this for separating cubes from - other mesh elements within 1 mesh datablock. + Returns lists of polygon indices connected by UV islands. :arg mesh: the mesh used to group with. :type mesh: :class:`bpy.types.Mesh` - :return: lists of lists containing polygon indices + :return: list of lists containing polygon indices :rtype: list """ + + if mesh.polygons and not mesh.uv_layers.active.data: + # Currently, when in edit mode, UV Layer data will always be empty + # when accessed though RNA. This may change in the future. + raise ValueError( + "UV Layers are not currently available from python in Edit Mode. " + "Use bmesh and bpy_extras.bmesh_utils.bmesh_linked_uv_islands instead." + ) + uv_loops = [luv.uv[:] for luv in mesh.uv_layers.active.data] poly_loops = [poly.loop_indices for poly in mesh.polygons] luv_hash = {} |