Skip to content

Instantly share code, notes, and snippets.

@zeffii
Created January 13, 2016 19:30
Show Gist options
  • Save zeffii/cd72406d06888361fdf4 to your computer and use it in GitHub Desktop.
Save zeffii/cd72406d06888361fdf4 to your computer and use it in GitHub Desktop.
import bpy
obj = bpy.context.active_object
# Store all UV vertex locations
uv_coords = []
for loop in obj.data.loops:
uv_loc = obj.data.uv_layers.active.data[loop.index].uv
uv_coords.append(tuple(map(lambda x: round(x,3), uv_loc[:])))
# Keep only the unique ones and count them
print("object {0} has {1} UV vertices".format(obj.name, len(set(uv_coords))))
dupes = len(set(uv_coords)) - len(obj.data.vertices)
print("the number of duplicate verts is {0}:".format(dupes))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment