Maya - Time Editor. Adding new track and animation using Python

I am trying to create a track with the animation I have in my outline.
I select object and try to add it on my time editor but haven’t been able to create the track, nonetheless add the animation.

This is my code:

cmds.select (“NameofObject”)
cmds.timeEditorAnimSource(“container_A”, aso=True, track=“New_Track:1”, startTime=0, type=[“animCurveTL”, “animCurveTA”, “animCurveTT”, “animCurveTU”], addRelatedKG=True)

So far this has been the first error that shows up:

Error: line 1: TypeError: file line 2: Invalid flag ‘track’

Any thoughts?

“track=” is not a flag for cmds.timeEditorAnimSource

https://help.autodesk.com/cloudhelp/2023/ENU/Maya-Tech-Docs/CommandsPython/timeEditorAnimSource.html

I think you may be looking for:
cmds.timeEditorTracks

https://help.autodesk.com/cloudhelp/2023/ENU/Maya-Tech-Docs/CommandsPython/timeEditorTracks.html

This may help:

#create a sphere and animate it in scene then run this code
cmds.select ("pSphere1")
cmds.timeEditorTracks( 'container_A', trackName="Track1", path='Composition1', e=1, addTrack=-1 )
cmds.timeEditorClip("container_A", aso=True, track="Composition1|Track1")

the 2nd line creates the track within Composition1
the 3rd line pushes the scene anim into a clip on “Composition1|Track1” for whatever is selected

Side Note: saw your name was MocapLED, wasn’t sure if you were attempting to use HIK in Time Editor but there is a few quirky bugs with it. Figured I’d mention them here in case they help.
To key HIK on layers in TimeEditor(TE) you must have the Channel box open.
To key HIK on Additive Layers in TE you must select entire body part (all components to get desired result)
To see HIK TimeEditor Layer keys in the Time Line as tick marks, you must click the control in scene (the viewport or outliner most likely), then click the Layer Clip in TimeEditor

Wow that is incredible! It is exactly what I was looking and it helped me understand how to separate the tasks instead of doing everything in one line of code as I was trying earlier. Thank you so much.

1 Like

Right now, I am not looking to use HIK but in upcoming scenarios might be useful and I appreciate the heads up.