Skip to content

Instantly share code, notes, and snippets.

@whoiscarlo
Created November 17, 2017 02:06
Show Gist options
  • Save whoiscarlo/1affe9cd24b9d7b922cd90cf3208d99f to your computer and use it in GitHub Desktop.
Save whoiscarlo/1affe9cd24b9d7b922cd90cf3208d99f to your computer and use it in GitHub Desktop.
Maya Time Editor
## Grab selected
sel_obj = cmds.ls(sl=1)[0]
## Get namespace
namespace = sel_obj.split(':')[0].split('_def')[0]
## Check if main comp exists
if 'main_comp' not in cmds.timeEditorComposition(q=True, allCompositions=True):
## Create composition
cmds.timeEditorComposition('main_comp')
## Mute composition so you can add and create new anim clips
cmds.timeEditor(mute=True)
## Create track using character namespace
cmds.timeEditorTracks('main_comp', e=1, addTrack=1, tn=namespace)
## Create clip with animation name
clip_name = anim_name
cmds.timeEditorClip(clip_name, track='%s|%s'%(comp_name, namespace), addSelectedObjects=True)
## UnMute composition to use clips
cmds.timeEditor(mute=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment