Last active
September 7, 2017 17:48
-
-
Save SEVEZ/bd3aaea46a9edaf8aa939b3d1151a61e to your computer and use it in GitHub Desktop.
Access internal maya objects from any thread via executeInMainThreadWithResult function #Util
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.cmds as mc | |
| import maya.utils as mu | |
| import threading | |
| def check1(): | |
| return mc.window('MayaWindow', ex=True ) | |
| def check2(): | |
| return 'TimeSliderMenu' in mc.lsUI('MayaWindow', typ="menu") | |
| def loadSelectRange(): | |
| while not mu.executeInMainThreadWithResult( check1 ): | |
| time.sleep( 1 ) | |
| else: | |
| while not mu.executeInMainThreadWithResult( check2 ): | |
| time.sleep( 1 ) | |
| else: | |
| print "LOADED RANGE" | |
| t = threading.Thread( target = loadSelectRange ) | |
| t.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment