Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/modules/bpy_extras/mesh_utils.py')
-rw-r--r--release/scripts/modules/bpy_extras/mesh_utils.py14
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 = {}