Maya python trying to template / untemplate channel

listening with echo all command, you see it prompt : doTemplateChannel graphEditor1FromOutliner 1;

doing whatIs doTemplateChannel; , you can see it prompt the mel procedure : // Result: Mel procedure found in: somePath/autodesk/maya2015-x64/scripts/others/loadAnimMenuLibrary.mel //

finding the proc, you can read another obscur proc called : expandSelectionConnectionAsArray

doing a whatIS, you find :

cmds.selectionConnection('graphEditor1FromOutliner' , q=1, object=1)
# Result: [u'pSphere1.translateX'] # 

returning to the doTemplateChannel.mel, the command to find the animCurve node is :

cmds.listConnections('pSphere1.translateX', type="animCurve") # Result: [u'pSphere1_translateX'] # 

And at the end, the command to template/untemplate :

cmds.setAttr( 'pSphere1_translateX.ktv', l = 1) # use 1 to lock and 0 to unlock

I hope it will help you ton find all next command that are not prompted ^^

Read more here: Source link