Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

cmds.addAttr should return the created attribute.

cmds.addAttr should return the created attribute.

Currently the addAttr-command does not return the attribute that it creates.

 

In this example the variable "plug" will be empty.

 

>>> plug = cmds.addAttr("pCube1", longName="myNewAttr")
>>> print plug

 

 

What should happen is that addAttr returns the new plug:

 

>>> plug = cmds.addAttr("pCube1", longName="myNewAttr")
>>> print plug
"pCube1.myNewAttr"

 

 

This way there would be no need to do awkward things like this:

 

>>> some_node = "pCube1"
>>> attr = "myNewAttr"
>>> cmds.addAttr(some_node, longName=attr)
>>> plug = "{}.{}".format(some_node, attr)

 

 

I imagine this must be a quick and easy fix and it would be very appreciated by many TDs.

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea