LumaPictures / pymel

Python in Maya Done Right
Other
479 stars 130 forks source link

Adding listDefault method to Attribute class #401

Closed bob-white closed 6 years ago

bob-white commented 6 years ago

Provides a solution to #400

cmds.addAttr didn't seem like a clean way to implement this, as it only works on attribute created with cmds.addAttr and you have to query compound attributes individually.

So I used cmds.attributeQuery instead.

It needs a bit more work to wrap compound objects properly, but wanted to see if this was the right direction to go before putting any major time into it.

pmolodo commented 6 years ago

Merged this - made a few addtions, though. listDefault always returns a list, which is odd for non-compound attrs, so I did automatic unpacking if appropriate... since the result is now slightly different then listDefault, changed the name to getDefault (which is also more intuitive). Also added tests.

Thanks for the PR!