2

Can delete a UV Map / Texture, via

bpy.ops.mesh.uv_texture_remove()

But how can I delete a UV Map by it's Index?

batFINGER
  • 84,216
  • 10
  • 108
  • 233
BlackCube
  • 75
  • 4

1 Answers1

5

Set the active index,

Similarly to materials and other lists where the active and active index can be set.

Example in python console. The 3rd UV map is active

>>> C.object.data.uv_layers.active_index
2

Change instead to second (index 1)

>>> C.object.data.uv_layers.active_index = 1

Operator removes the active UV map

>>> bpy.ops.mesh.uv_texture_remove()
{'FINISHED'}

See also How to find and delete extra UV layers on many objects? : can remove directly using the remove API method.

>>> C.object.data.uv_layers.remove(C.object.data.uv_layers[1])
batFINGER
  • 84,216
  • 10
  • 108
  • 233