possible maya bug with MPlug.setKeyable

22 views
Skip to first unread message

Rudi Hammad

unread,
Oct 21, 2021, 10:00:26 AM10/21/21
to Python Programming for Autodesk Maya
Hello. When I use MPlug.setKeyable() the attribute is hiden as expected. You can try this to check it:

jnt = cmds.joint()
cmds.addAttr(jnt, ln="foo", at="float", k=True)
mslist = OpenMaya.MSelectionList()
mslist.add(jnt)
mobj = OpenMaya.MObject()
mslist.getDependNode(0, mobj)
mfnDepNode = OpenMaya.MFnDependencyNode(mobj)
mplug = mfnDepNode.findPlug("foo")
mplug.setKeyable(False)


the problem that I am having is that if you save the scene, and open it again, the attribute is visible again. His happens if you do that throught mplug. With cmds it is fine.
Is that a bug or is there something else that needs to be done?

Cheers,

R

Rudi Hammad

unread,
Oct 25, 2021, 6:58:23 PM10/25/21
to Python Programming for Autodesk Maya
mkkkay, I'll take that as a bug then XD

Marcus Ottosson

unread,
Oct 26, 2021, 1:41:52 AM10/26/21
to python_in...@googlegroups.com
I was looking at this, but found it consistent across all versions of Maya, so I'm not sure it qualifies as a bug. xD I even use it, to dynamically alter the Channel Box based on the value of another attribute, like if a node is disabled I can go ahead and hide other attributes that depend on this value. But I wouldn't want this to be saved with the scene, since it's temporary and cosmetic.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/3d3ac7be-5232-46e7-9ef2-eb8e94264f86n%40googlegroups.com.

Rudi Hammad

unread,
Oct 26, 2021, 6:07:39 AM10/26/21
to Python Programming for Autodesk Maya
hmmm...okey. but then how come that if you this exact same thing with translateX, it does remain hidden after saving and opening the since

jnt = cmds.joint()

mslist = OpenMaya.MSelectionList()
mslist.add(jnt)
mobj = OpenMaya.MObject()
mslist.getDependNode(0, mobj)
mfnDepNode = OpenMaya.MFnDependencyNode(mobj)
mplug = mfnDepNode.findPlug("tx")
mplug.setKeyable(False)

Marcus Ottosson

unread,
Oct 26, 2021, 6:32:52 AM10/26/21
to python_in...@googlegroups.com
Because translateX is a static attribute, and the keyable state isn't stored with the scene, but with Maya itself. Have a look at any other translateX and you'll find those hidden too. Until you restart Maya.

Rudi Hammad

unread,
Oct 26, 2021, 6:48:21 AM10/26/21
to Python Programming for Autodesk Maya
ok, got it. No bug then!
Thx Marcus
Reply all
Reply to author
Forward
0 new messages