Skip to content

Instantly share code, notes, and snippets.

@tb-animator
Last active May 11, 2016 20:24
Show Gist options
  • Select an option

  • Save tb-animator/79df1fae7695d6a4bd48 to your computer and use it in GitHub Desktop.

Select an option

Save tb-animator/79df1fae7695d6a4bd48 to your computer and use it in GitHub Desktop.
import maya.mel
import pymel.core as pm
def beginDrag(*args):
mods = pm.getModifiers()
update = pm.timeControl( aPlayBackSliderPython, query=True, globalTime=True)
print update
if (mods & 1) > 0: print ' Shift'
if (mods & 2) > 0: print ' CapsLock'
if (mods & 4) > 0: print ' Ctrl'
if (mods & 8) > 0: # 'alt'
pm.timeControl( aPlayBackSliderPython, edit=True, snap=False)
def endDrag(*args):
snapState = pm.timeControl( aPlayBackSliderPython, query=True, snap=True)
if not snapState:
pm.timeControl( aPlayBackSliderPython, edit=True, snap=True)
pm.setCurrentTime(int(pm.getCurrentTime()))
aPlayBackSliderPython = maya.mel.eval('$tmpVar=$gPlayBackSlider')
pm.timeControl( aPlayBackSliderPython, edit=True, pressCommand=beginDrag )
pm.timeControl( aPlayBackSliderPython, edit=True, releaseCommand=endDrag )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment