I'm trying to write something similar to the array modifier and am trying to modify the uvs of duplicated vertices, just like the modifier does, and add 1 on the X axis for every iteration. This code fails:
for i in range(8):
bpy.ops.mesh.duplicate()
bpy.ops.transform.shrink_fatten(value=-0.1, use_even_offset=False)
for loop in ac_ob.data.loops:
if actv_ob.data.vertices[loop.vertex_index].select is True:
actv_ob.data.uv_layers.active.data[loop.index].uv += Vector([1, 0])
with the error:
ac_ob.data.uv_layers.active.data[loop.index].uv += Vector([1, 0])
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0
location: <unknown location>:-1
The object does have a uv map. What am I doing wrong here?