In Maya, how do you change the nicename of an attribute that you added using Python? The renameAttr command seems to only change the longname and Attribute Editor continues to show the old attribute name even though it’s really named something else now.
cmds.addAttr(attr, e=True, nn=newNiceName)
I already know how to added attributes with a nice name. I want to know how to rename it. Unless you’re trying to tell me there’s no other way but to delete the existing attribute and add a new one with the new nicename.
[QUOTE=capper;18772]cmds.addAttr(attr, e=True, nn=newNiceName)[/QUOTE]
Sorry should have been a little more descriptive. That is how you rename an existing attribute’s nice name. The e is edit, it’s not creating anything new.
obj = cmds.createNode('transform', n='attr_test')
cmds.addAttr(obj, ln='myTestAttr', nn='A Nice Name', k=True)
cmds.addAttr('%s.myTestAttr' % obj, e=True, nn='A New Nicer Name')
Ah! Thanks! I totally didn’t see the edit flag. Works now.
[QUOTE=capper;18775]Sorry should have been a little more descriptive. That is how you rename an existing attribute’s nice name. The e is edit, it’s not creating anything new.
obj = cmds.createNode('transform', n='attr_test')
cmds.addAttr(obj, ln='myTestAttr', nn='A Nice Name', k=True)
cmds.addAttr('%s.myTestAttr' % obj, e=True, nn='A New Nicer Name')
[/QUOTE]