Page MenuHome

uv_layers names aren't updated if renamed via uv_textures[#].name = "newname"
Closed, ArchivedPublic

Description

Since there is no way to go from a uv_texture to a uv_layer (e.g. by .index or theoretically .layer_name), it's impossible to reference the uv layers in script after a uv texture rename.


import bpy

bpy.ops.mesh.primitive_cube_add()
me = bpy.context.object.data

uvtex = me.uv_textures.new(name="initial_name")
print()
print(me.uv_textures[0].name)
print(me.uv_layers[0].name)

uvtex.name = "new_name"
print()
print(me.uv_textures[0].name)
print(me.uv_layers[0].name)
# can't reference uv_layers[uvtex.name] here!

Event Timeline

codemanx edited a custom field.Apr 29 2013, 2:15 PM

Not sure names are intended to be syncronized actually -- there were plans to separate this two guys.

Campbell, can you please check on this?

As long as they are magically linked, they should also share names. Not sure what it would be good for to have them separated (other than better understandability for new scripters), but sure, if they get separated, no need to update the other name as well.

Currently only the indices's are shared (it is confusing that names are shared on creation but not renaming).

Eventually we'll decouple these layers and expose to users.
Closing.

Campbell Barton (campbellbarton) changed the task status from Unknown Status to Archived.May 1 2013, 1:09 AM