Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
Last active September 7, 2017 17:48
Show Gist options
  • Select an option

  • Save SEVEZ/bd3aaea46a9edaf8aa939b3d1151a61e to your computer and use it in GitHub Desktop.

Select an option

Save SEVEZ/bd3aaea46a9edaf8aa939b3d1151a61e to your computer and use it in GitHub Desktop.
Access internal maya objects from any thread via executeInMainThreadWithResult function #Util
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