2

I'm a newbie on Maya programming.

I'm trying to make a script to check and template/untemplate a channel. I have a transform node opened in graph editor called 'SKEL01_002:main_C_001_CTRL'. Then I select 'TranslateX', and still in graph editor I go to CURVES --> TEMPLATE CHANNEL

I can list the Curves with:

cmds.listConnections('SKEL01_002:main_C_001_CTRL', t='animCurve')

But I can't figure out how to template/untemplate in python.

So thanks in advance for your help.

asch75
  • 43
  • 3

1 Answers1

4

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 ^^

DrWeeny
  • 2,487
  • 1
  • 14
  • 17
  • I didn't understand where did you find the ".ktv" or the "l" lock parameter. But it works. Thanks! – asch75 Jun 15 '16 at 08:33
  • Told you all I've done. Using maya command whatIs to find the .mel proc, open it in text editor and then translate mel into python – DrWeeny Jun 15 '16 at 09:05