Created
April 10, 2015 23:54
-
-
Save lapaev/a4da850eec04a85a3f35 to your computer and use it in GitHub Desktop.
Smooth Time Scrubber
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| 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