PythonApi hidden a attribute from Attribute Editor

PythonApi hidden a attribute from Attribute Editor

Anonymous
Not applicable
1,391 Views
2 Replies
Message 1 of 3

PythonApi hidden a attribute from Attribute Editor

Anonymous
Not applicable

Hey Guys:
a noob question,

I want a attribute be hidden from the UI(attribute editor); but It did not work!


import maya.OpenMaya as om
msel = om.MSelectionList()
om.MGlobal.getActiveSelectionList(msel)
mobj = om.MObject()
mDagPth = om.MDagPath()
msel.getDependNode(0,mobj)
mFnDep = om.MFnDependencyNode(mobj)
mAttrObj = mFnDep.attribute('visibility')
mFnAttr = om.MFnAttribute(mAttrObj)
mFnAttr.isHidden()
mFnAttr.setHidden(1)

but  the attribute still displayed in the Attribute Editor?  somebody help me!

0 Likes
Accepted solutions (1)
1,392 Views
2 Replies
Replies (2)
Message 2 of 3

cheng_xi_li
Autodesk Support
Autodesk Support
Accepted solution

Hi Ben,

 

You can't modify attribute after it is created in that way. If you want to change how it is displayed in attribute editor, you'll need to create an AEtemplate.

 

editorTemplate with -suppress flag should be the one you are looking for.

 

Yours,

Li

0 Likes
Message 3 of 3

Anonymous
Not applicable

 

Thanks so much!!

 

 

0 Likes