The UV-map is directly linked to the mesh through meshloops. We can use that to transfer the selection from the UV-map to the mesh.
To transfer the selection from the UV-map to the mesh, we need to cycle through the mesh polygons, check which meshloops are selected and select the corresponding vertices on the mesh itself.
The following script transfers the selection from the UV-map to the mesh:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import bpy bpy.ops.object.mode_set(mode = 'OBJECT') meshdata = bpy.context.active_object.data for i, polygon in enumerate(meshdata.polygons): for i1, loopindex in enumerate(polygon.loop_indices): meshuvloop = meshdata.uv_layers.active.data[loopindex] if meshuvloop.select: meshdata.vertices[meshdata.polygons[i].vertices[i1]].select = True |