Created
September 7, 2016 18:26
-
-
Save splinecraft/dc4eb744603eaece3602c5558f6840ea to your computer and use it in GitHub Desktop.
Query Maya timeline selection
This file contains 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
# Method 1 | |
from pymel.core import * | |
slider = mel.eval('$tmpVar=$gPlayBackSlider') | |
sliderFrames = ''.join([c for c in timeControl(slider, q=1, rng=1) if c in '1234567890:']) | |
sliderStart = int(sliderFrames.split(":")[0]) | |
sliderEnd = int(sliderFrames.split(":")[1]) | |
#-----------------------------------------------------------------------------------------# | |
# Method 2 | |
import pymel.core as pm | |
tc = pm.lsUI(type='timeControl')[0] | |
time_selected = pm.timeControl(tc, ra=True, q=True) | |
# Result: [6.0, 15.0] # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment