Hi guys. I’m trying to make an addon to simplify a process of removing UVs from a list, except the last one. Then renaming the remaining UV with the same name for all the objects. I don’t really know how to do this part since I’m really new to the scripting and python part of blender. Can anybody help me?
Here is how it works.
import bpy object = bpy.context.active_object print(dir(object.data)) # show data print(object.data.uv_layers[:]) # show list of uv layers for uv in object.data.uv_layers[:-1]: # iterate all except the last print('removing', uv.name) # to prevent any indexing errors from occuring # just remove from the first index (same as stack pop) object.data.uv_layers.remove(object.data.uv_layers)
If you throw this inside the
execute of an operator, you have the addon ready.