Created
August 24, 2018 19:00
-
-
Save boredstiff/6c62c159b9e020d4bb64b82172f509ea to your computer and use it in GitHub Desktop.
Get the Time Slider Widget in Maya
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
from maya import mel | |
from PySide2 import QtWidgets | |
def get_widget(name): | |
"""Get the widget from the active QApplication that matches the given name. | |
Args: | |
name (str): The name of the widget to retrieve. | |
Returns: | |
dict: A dictionary containing | |
""" | |
return dict( | |
(w.objectName(), w) for w in QtWidgets.QApplication.allWidgets()).get(name) | |
def get_time_slider_widget(): | |
"""Get the Time Slider Widget based on whatever it's current name is.""" | |
time_slider_name = mel.eval('$tmpVar=$gPlayBackSlider').rsplit('|')[-1] | |
return get_widget(time_slider_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment