rename uv layers

i’m sure i’m just overlooking something obvious, but what is the proper method for renaming a uv_layer in python?[i].name <— is read only

i have imported in a bunch of objects that have these convoluted UV layers names that are a royal pain to work with (especially using cycles Attribute node), so i wanted to quickly rename them to a consistent convention.

Thanks so much!

The name visible in the UI is found via data.uv_textures[i].name and not in uv_layers. You can change the name from there.

However uv coords seem to be available via uv_layers. Im having trouble finding documentation that explains the difference and why there are two collections in the api that seem to point to the same data.

Maybe someone else can clear that up.

haha yup i knew i was doing something dumb! thanks, Muffy! works perfect now!

@Muffy: uv_layers and uv_textures don’t point to the same data, uv_layers store the per-loop UV coordinate info, uv_textures the per-face assigned textures. If you unwrap the default cube, data len of an uv layer will be 24, while uv texture lengths will be 6.

although it looks like uv_layers and uv_textures would be independent, they aren’t. Adding a new uv tex also adds a uv layer, renaming the uv tex will change the name of the uv layer as well (you need to re-enter edit mode to make it update the name).

@CodemanX :
Thanks for the explanation!