Home Website Youtube GitHub

Using attribute.addEnumAttribute error

When I run this code:

bodyUi = pm.PyNode('bodyUI_C0_ctl')
attribute.addEnumAttribute(bodyUi, 'twistSep', 'Twist', enum=['Twist'], niceName='--------')

It creates the attribute correctly but I get this error:
// Error: line 1: Flags must come before objects: --------

Any idea what needs to change so the error doesn’t appear?
Code keeps running, thankfully, so it’s not a big deal.

Did you run that in a MEL tab instead of a Python tab? Because that double slash looks like a MEL error.

No. And I haven’t managed to recreate the error.
So I guess I should delete this thread?

Hmm, strange. My guess then is that some other script maybe overwrote a variable that interfered with the code you ran.

Glad it’s working now.