Last active
May 11, 2016 20:24
-
-
Save tb-animator/79df1fae7695d6a4bd48 to your computer and use it in GitHub Desktop.
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
| 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