本文整理汇总了Python中maya.utils.executeDeferred函数的典型用法代码示例。如果您正苦于以下问题:Python executeDeferred函数的具体用法?Python executeDeferred怎么用?Python executeDeferred使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了executeDeferred函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: closeNextDialogWithResult
def closeNextDialogWithResult(result):
'''
close next modal dialog with given result
'''
if Utils.getMayaVersion()>=Utils.MAYA2011:
mUtils.executeDeferred(lambda:BaseDialog.currentDialog.closeDialogWithResult(result))
else:
Utils.displayError("hurray for maya 2009, close dialog manually with result "+result)
示例2: pumpQt
def pumpQt():
global app
def processor():
app.processEvents()
while 1:
time.sleep(0.01)
utils.executeDeferred( processor )
示例3: _close_parent_window
def _close_parent_window(self):
"""helper routine closing the parent window if there is one"""
p = self.parent()
if isinstance(p, ui.Window):
# If its not deferred, it will crash maya for some reason, maybe
# something related to garbage collection.
mutil.executeDeferred(self.parent().delete)
elif isinstance(p, ui.FormLayout) and p.startswith("layoutDialog"):
cmds.layoutDialog(dismiss="close")
示例4: execute
def execute(self):
from maya import utils as mu
from ngSkinTools.ui.mainwindow import MainWindow
BaseToolWindow.closeAllWindows()
deleteCustomOptions()
mu.executeDeferred(MainWindow.open)
示例5: refreshWindow
def refreshWindow(*args):
layout_name = pm.rowColumnLayout(lights_layout, q=True, fpn=True)
utils.executeDeferred("import pymel.core as pm;pm.deleteUI('{0}')".format(layout_name))
lights_area()
ibl_list = pm.ls(type='mentalrayIblShape')
if ibl_list != []:
ibl_btn.setImage1(get_icon_path('deleteIBL_icon.png'))
else:
ibl_btn.setImage1(get_icon_path('IBL_icon.png'))
示例6: _confirm_button_pressed
def _confirm_button_pressed(self, *args):
if not self.stack.base_items:
raise ValueError("Please add at least one item to the stack and retry")
# END handle empty refs
# create refs
self._create_references(self.stack.base_items)
# finally let base take care of the rest
# NOTE: Needs to be deferred, crashes otherwis
mutil.executeDeferred(super(FileReferenceFinder, self)._confirm_button_pressed)
示例7: _removeTrackingPoints
def _removeTrackingPoints(self):
self._track = False
for index, value in enumerate(self._tracking_points):
if value > 0:
self._tracking_points[index] -= 1
self._track = True
if self._track is False:
self._anim_follow_timer.stop()
utils.executeDeferred(self.update)
示例8: _animateText
def _animateText(self):
stop_animating = True
for key, value in self._text_glow.items():
if value > 0:
stop_animating = False
self._text_glow[key] = value - 1
if stop_animating:
self._anim_timer.stop()
utils.executeDeferred(self.update)
示例9: execute
def execute(self):
from maya import utils as mu
from ngSkinTools.ui.mainwindow import MainWindow
BaseToolWindow.closeAllWindows()
variablePrefix = "ngSkinTools"
for varName in cmds.optionVar(list=True):
if varName.startswith(variablePrefix):
cmds.optionVar(remove=varName)
mu.executeDeferred(MainWindow.open)
示例10: _animateGlow
def _animateGlow(self):
if self._hover:
if self._glow_index >= 10:
self._glow_index = 10
self._anim_timer.stop()
else:
self._glow_index += 1
else:
if self._glow_index <= 0:
self._glow_index = 0
self._anim_timer.stop()
else:
self._glow_index -= 1
utils.executeDeferred(self.update)
示例11: createTx
def createTx(self):
if not self.txManager.selectedFiles:
return
ctrlPath = '|'.join([self.txManager.window, 'groupBox_2', 'pushButton_7']);
utils.executeDeferred(cmds.button,ctrlPath, edit=True, enable=True);
for texture in self.txManager.selectedFiles:
if not texture:
continue;
# stopCreation has been called
if not self.txManager.process:
break;
# Process all the files that match the <udim> tag
if 'udim' in os.path.basename(texture):
udims = getUdims(texture)
for udim in udims:
# stopCreation has been called
if not self.txManager.process:
break;
if self.makeTx(udim) is 0:
self.filesCreated += 1
else:
self.createdErrors += 1
utils.executeDeferred(updateProgressMessage, self.txManager.window, self.filesCreated, self.txManager.filesToCreate, self.createdErrors)
else:
if self.makeTx(texture) is 0:
self.filesCreated += 1
else:
self.createdErrors += 1
utils.executeDeferred(updateProgressMessage, self.txManager.window, self.filesCreated, self.txManager.filesToCreate, self.createdErrors)
ctrlPath = '|'.join([self.txManager.window, 'groupBox_2', 'pushButton_7']);
utils.executeDeferred(cmds.button, ctrlPath, edit=True, enable=False);
self.txManager.process = True
utils.executeDeferred(self.txManager.updateList)
示例12: deleteSnapShot
def deleteSnapShot( self, *args ):
print "Deleting snapshot"
import threading
import maya.utils as utils
cmds.undoInfo(openChunk = True)
try:
RenderLayerManagerFile.RenderLayerManagerClass.ShowModel(Visibility = False)
SnapShotClass.UpdateImagePlane("CMForegroundPlane", "persp")
#Call the destroy function from the snapshot class to remove the class objects
SnapShotClass.SnapShots.pop( self.CurrentIndex ).destroy()
#Update all names
for i in range( self.CurrentIndex, len( SnapShotClass.SnapShots )):
SnapShotClass.SnapShots[i].UpdateIndex( i )
#Check to see if there is a signature image in the current list
SignatureFound = False
for i in SnapShotClass.SnapShots:
if cmds.getAttr(i.Camera +'.CMSignature'):
SignatureFound = True
SnapShotClass.UpdateImagePlane("CMForegroundPlane", i.Camera)
#If not make the first image the signature
if not SignatureFound and cmds.objExists("shot_0"):
cmds.setAttr('shot_0.CMSignature', True)
SnapShotClass.UpdateImagePlane("CMForegroundPlane", "shot_0")
#Adjust render layer adjustments
RenderLayerManagerFile.RenderLayerManagerClass.assignSnapShots("shot_0")
#Wait for the function to complete otherwise a memory error will crash maya
threading.Thread(target=utils.executeDeferred(SnapShotClass.RecreateUI)).start()
RenderLayerManagerFile.RenderLayerManagerClass.ShowModel(Visibility = True)
except:
raise
finally:
cmds.undoInfo(closeChunk = True)
print "Snapshot deleted"
示例13: deleteTurntable
def deleteTurntable( self, *args ):
import threading
import maya.utils as utils
cmds.undoInfo(openChunk = True)
#Call the destroy function from the turntable class to remove the class objects
TurntableClass.Turntables.pop( self.CurrentIndex ).destroy()
#Update all names
for i in range( self.CurrentIndex, len( TurntableClass.Turntables )):
TurntableClass.Turntables[i].Update( i )
#Wait for the function to complete otherwise a memory error will crash maya
threading.Thread(utils.executeDeferred(TurntableClass.RecreateUI)).start()
cmds.undoInfo(closeChunk = True)
示例14: onClose
pm.optionVar (fv=("gridSpacing",100))
mc.displayColor('gridAxis', 2, dormant=True)
mc.displayColor('gridHighlight', 1, dormant=True)
mc.displayColor('grid', 3, dormant=True)
#setting the units
pm.optionVar (sv=("workingUnitLinear", "cm"))
pm.optionVar (sv=("workingUnitLinearDefault", "cm"))
def onClose():
if 'FTRACK_TASKID' in os.environ.keys():
session = ftrack_api.Session(
server_url=os.environ['FTRACK_SERVER'],
api_user=os.environ['FTRACK_API_USER'],
api_key=os.environ['FTRACK_API_KEY']
)
task = session.query('Task where id is %s' % os.environ['FTRACK_TASKID'])
user = session.query('User where username is %s' % os.environ['FTRACK_API_USER']).one()
user.stop_timer()
def addQuitAppCallback():
mc.scriptJob(e=["quitApplication", "onClose()"])
if maya.OpenMaya.MGlobal.mayaState() == 0:
mc.evalDeferred("loadAndInit()")
executeDeferred("addQuitAppCallback()")
示例15: end
def end( self ):
"""Close the progress window"""
# damn, has to be deferred to actually work
super( ProgressWindow, self ).end( )
mutils.executeDeferred( cmds.progressWindow, ep=1 )