I need to delete all UV's I have but the last one and change the name of the UV for every object selected to match. I can do it for the first but when it comes to repeating the process for all the objects selected I don't know.
2 Answers
$\begingroup$
$\endgroup$
1
Use a python for that:
import bpy
for obj in bpy.context.selected_objects:
layers = obj.data.uv_layers
lastLayer = obj.data.uv_layers[len(obj.data.uv_layers) - 1]
for uv in layers:
if uv != lastLayer:
layers.remove(uv)
else:
uv.name = 'My UV name'
-
2$\begingroup$ Hey did you test this ? This throws an error because you're removing elements from a list you're iterating over $\endgroup$– GorgiousCommented Jun 28, 2022 at 16:41
$\begingroup$
$\endgroup$
Another method which worked for me because the other method didn't.
import bpy
for obj in bpy.context.selected_objects:
layers = obj.data.uv_layers
for i in range(len(layers) - 1):
layers.remove(layers[0])
layers[0].name = 'My UV name'