本文整理匯總了Python中maya.cmds.evalDeferred方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.evalDeferred方法的具體用法?Python cmds.evalDeferred怎麽用?Python cmds.evalDeferred使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類maya.cmds
的用法示例。
在下文中一共展示了cmds.evalDeferred方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: eventFilter
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import evalDeferred [as 別名]
def eventFilter(self, obj, event):
if event.type() == QEvent.FocusIn:
self.sel_all_input()
self.focused.emit()
if event.type() == QEvent.Wheel:
delta = event.delta()
delta /= abs(delta)
shift_mod = self.check_shift_modifiers()
ctrl_mod = self.check_ctrl_modifiers()
if shift_mod:
self.setValue(self.value()+delta/10.0)
elif ctrl_mod:
self.setValue(self.value()+delta*10.0)
else:
self.setValue(self.value()+delta)
cmds.evalDeferred(self.emit_wheel_event)
if event.type() == QEvent.KeyPress:
self.keypressed.emit()
if event.type() == QEvent.MouseButtonPress:
self.mousepressed.emit()
return False
示例2: add_to_filemenu
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import evalDeferred [as 別名]
def add_to_filemenu():
"""Add Pyblish to file-menu
.. note:: We're going a bit hacky here, probably due to my lack
of understanding for `evalDeferred` or `executeDeferred`,
so if you can think of a better solution, feel free to edit.
"""
if hasattr(cmds, 'about') and not cmds.about(batch=True):
# As Maya builds its menus dynamically upon being accessed,
# we force its build here prior to adding our entry using it's
# native mel function call.
mel.eval("evalDeferred buildFileMenu")
# Serialise function into string
script = inspect.getsource(_add_to_filemenu)
script += "\n_add_to_filemenu()"
# If cmds doesn't have any members, we're most likely in an
# uninitialized batch-mode. It it does exists, ensure we
# really aren't in batch mode.
cmds.evalDeferred(script)
示例3: jobReloadUI
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import evalDeferred [as 別名]
def jobReloadUI(self, *args):
""" This scriptJob active when we got one new scene in order to reload the UI.
"""
import maya.cmds as cmds
cmds.select(clear=True)
cmds.evalDeferred("import sys; sys.modules['dpAutoRigSystem.dpAutoRig'].DP_AutoRig_UI()", lowestPriority=True)
示例4: sel_all_input
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import evalDeferred [as 別名]
def sel_all_input(self):
cmds.evalDeferred(self.select_box_all)
#スピンボックスの數値を全選択する
示例5: __register_sisidebar_startup
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import evalDeferred [as 別名]
def __register_sisidebar_startup():
from textwrap import dedent
cmds.evalDeferred(dedent(
"""
import sisidebar.startup as s
s.execute()
"""
))
示例6: _add_to_filemenu
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import evalDeferred [as 別名]
def _add_to_filemenu():
"""Helper function for the above :func:add_to_filemenu()
This function is serialised into a string and passed on
to evalDeferred above.
"""
import os
import pyblish
from maya import cmds
# This must be duplicated here, due to this function
# not being available through the above `evalDeferred`
for item in ("pyblishOpeningDivider",
"pyblishScene",
"pyblishCloseDivider"):
if cmds.menuItem(item, exists=True):
cmds.deleteUI(item, menuItem=True)
icon = os.path.dirname(pyblish.__file__)
icon = os.path.join(icon, "icons", "logo-32x32.svg")
cmds.menuItem("pyblishOpeningDivider",
divider=True,
insertAfter="saveAsOptions",
parent="mainFileMenu")
cmds.menuItem("pyblishScene",
insertAfter="pyblishOpeningDivider",
label="Publish",
parent="mainFileMenu",
image=icon,
command="import pyblish_maya;pyblish_maya.show()")
cmds.menuItem("pyblishCloseDivider",
insertAfter="pyblishScene",
parent="mainFileMenu",
divider=True)
示例7: __register_sishelf_startup
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import evalDeferred [as 別名]
def __register_sishelf_startup():
from textwrap import dedent
cmds.evalDeferred(dedent(
"""
import sishelf.startup as s
s.execute()
"""
))
示例8: deselectChannels
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import evalDeferred [as 別名]
def deselectChannels():
'''
Deselect selected channels in the channelBox
by clearing selection and then re-selecting
'''
if not getSelectedChannels():
return
sel = mc.ls(sl=True)
mc.select(clear=True)
mc.evalDeferred(partial(mc.select,sel))
示例9: sel_all_input
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import evalDeferred [as 別名]
def sel_all_input(self):
cmds.evalDeferred(self.select_box_all)
#スピンボックスの數値を全選択する
示例10: __register_siweighteditor_startup
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import evalDeferred [as 別名]
def __register_siweighteditor_startup():
from textwrap import dedent
cmds.evalDeferred(dedent(
"""
import siweighteditor.startup as s
s.execute()
"""
))