Skip to content

Instantly share code, notes, and snippets.

@CGLion
Last active October 4, 2020 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CGLion/644dd26ad2d5cfac808c3a7834c07171 to your computer and use it in GitHub Desktop.
Save CGLion/644dd26ad2d5cfac808c3a7834c07171 to your computer and use it in GitHub Desktop.
Python for Blender - Read mesh UVs
import bpy
# access mesh data:
obj = bpy.context.active_object
mesh_data = obj.data
mesh_loops = mesh_data.loops
uv_index = 0
# iterate teh mesh loops:
for lp in mesh_loops:
# access uv loop:
uv_loop = mesh_data.uv_layers[uv_index].data[lp.index]
uv_coords = uv_loop.uv
print('vert: {}, U: {}, V: {}'.format(lp.vertex_index, uv_coords[0], uv_coords[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment