Skip to content

Instantly share code, notes, and snippets.

@Onefabis
Created July 27, 2016 19:25
Show Gist options
  • Save Onefabis/69526ebf0ad573f8554cd05713ccfa37 to your computer and use it in GitHub Desktop.
Save Onefabis/69526ebf0ad573f8554cd05713ccfa37 to your computer and use it in GitHub Desktop.
deletes the keys with decimal time
import maya.cmds as mc
import maya.mel as mel
selObj = mc.ls( sl=1 )
aPl = mel.eval('$tmpVar=$gPlayBackSlider')
trg = mc.timeControl( aPl, q=1, ra=1 )
if( trg[1]-trg[0]>1 ):
sttr = trg[0]
endtr = trg[1]
else:
sttr = mc.playbackOptions( q=1, min=1 )
endtr = mc.playbackOptions( q=1, max=1 )
timeK = mc.keyframe( selObj, q=1, tc=1, t=( sttr, endtr ) )
y = list( sorted( set( timeK ) ) )
floatsK = [ x for x in y if x-int(x)]
for f in floatsK:
mc.keyframe( t=(f,f), a=1, tc=max( timeK ) + 1, o='over' )
mc.cutKey( cl=1, t=(max( timeK ) + 1, ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment