Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
Forked from lapaev/timeDragger.py
Created May 11, 2016 20:15
Show Gist options
  • Select an option

  • Save SEVEZ/395aed8948083597c8ab26a01a6b1a47 to your computer and use it in GitHub Desktop.

Select an option

Save SEVEZ/395aed8948083597c8ab26a01a6b1a47 to your computer and use it in GitHub Desktop.
Smooth Time Scrubber
'''
timeDragger 1.0
29/03/2015
Tom Bailey
'''
import maya.cmds as cmds
import maya.mel as mel
'''
#hotkey pressed
import timeDragger as td
td.drag(True)
#hotkey released
import timeDragger as td
td.drag(False)
'''
def drag(state):
aPlayBackSliderPython = mel.eval('$tmpVar=$gPlayBackSlider')
if state:
mel.eval('storeLastAction("restoreLastContext " + `currentCtx`)')
cmds.timeControl(aPlayBackSliderPython, edit=True, snap=False )
cmds.displayPref(displayGradient=False)
cmds.setToolTo('TimeDragger')
else:
#theTime = int(cmds.currentTime(query=True))
cmds.timeControl(aPlayBackSliderPython, edit=True, snap=True)
cmds.currentTime(int(cmds.currentTime(query=True)), edit=True)
cmds.displayPref(displayGradient=True)
mel.eval('invokeLastAction')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment