Created
December 16, 2015 15:23
-
-
Save tb-animator/13eccdae9a9e902498cf 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
| ######################################################## | |
| # modification of the regular timeline drag for maya # | |
| # by Tom Bailey - brimblashman@gmail.com # | |
| # only works for 'film' 24 fps # | |
| # just run this in python, then click+drag on your # | |
| # timeline, alt+drag will smoothly scrub with no snap # | |
| # ctrl+drag will retime the timeline to snap to every # | |
| # 4 frames (6fps @ 24 fps) # | |
| ######################################################## | |
| 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: # 'Ctrl | |
| cmds.currentUnit(time='6fps', updateAnimation=True) | |
| if (mods & 8) > 0: # 'alt' | |
| pm.timeControl( aPlayBackSliderPython, edit=True, snap=False) | |
| def endDrag(*args): | |
| cmds.currentUnit(time='film', updateAnimation=True) | |
| 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