本文整理汇总了Python中maya.cmds.scriptJob方法的典型用法代码示例。如果您正苦于以下问题:Python cmds.scriptJob方法的具体用法?Python cmds.scriptJob怎么用?Python cmds.scriptJob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maya.cmds
的用法示例。
在下文中一共展示了cmds.scriptJob方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cleanup
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def cleanup(self):
'''
Clean up the mess we made.
'''
try:
mc.lockNode(self.pivotHandle, lock=False)
mc.delete(self.pivotHandle)
except: pass
try:
if mc.scriptJob(exists=self.scriptJob):
mc.scriptJob(kill=self.scriptJob, force=True)
except: pass
pivotHandles = mc.ls('*.ml_pivot_handle', o=True)
if pivotHandles:
for each in pivotHandles:
mc.lockNode(each, lock=False)
mc.delete(each)
示例2: jobReloadUI
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [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)
示例3: add_script_job
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def add_script_job(self):
""" add a tool changed script job """
self.logger.debug('Add tool changed script job')
self.jobs.append(cmds.scriptJob(event=["ToolChanged", self.tool_changed]))
示例4: match_transform
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def match_transform(mode='', child_comp=False):
from . import sisidebar_sub
pre_sel = cmds.ls(sl=True, l=True)
selection = cmds.ls(sl=True, l=True, type='transform')
if not selection:
return
cmds.undoInfo(openChunk=True)
set_maching(nodes=selection, mode=mode ,pre_sel=pre_sel, child_comp=child_comp)
msg = lang.Lang(en=u"<hl>Select Matching Object</hl>",
ja=u"<hl>一致対象オブジェクトを選択してください</hl>")
cmds.inViewMessage( amg=msg.output(), pos='midCenterTop', fade=True )
#cmds.select(cl=True)
maching_tool = cmds.scriptCtx( title='Much Transform',
totalSelectionSets=3,
cumulativeLists=True,
expandSelectionList=True,
toolCursorType="edit",
setNoSelectionPrompt='Select the object you want to matching transform.'
)
#カスタムカーソルを設定
image_path = os.path.join(os.path.dirname(__file__), 'icon/')
my_cursor = QCursor(QPixmap(image_path+'picker.png'))
QApplication.setOverrideCursor(my_cursor)
#cmds.hudButton('HUDHelloButton', e=True, s=7, b=5, vis=1, l='Button', bw=80, bsh='roundRectangle', rc=match_cancel )
global hud_but
if maya_ver != 2017:
try:
hud_but = cmds.hudButton('HUD_match_cancel', s=7, b=5, vis=1, l='Cancel', bw=80, bsh='roundRectangle', rc=finish_matching)
#print 'create'
except:
#print 'change'
hud_but = cmds.hudButton('HUD_match_cancel',e=True, s=7, b=5, vis=1, l='Cancel', bw=80, bsh='roundRectangle', rc=finish_matching)
jobNum = cmds.scriptJob(ro=True, e=('SelectionChanged', qt.Callback(trs_matching)), protected=True)
sisidebar_sub.get_matrix()
示例5: create_undo_job
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def create_undo_job(self):
self.undo_job = cmds.scriptJob(cu=True, e=("Undo", self.undo_control))
示例6: remove_undo_job
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def remove_undo_job(self):
if self.undo_job:
cmds.scriptJob(k=self.undo_job)
self.undo_job = None
示例7: create_job
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def create_job(self):
cmds.selectMode(co=True)
#cmds.select(cl=True)
self.reset_var()
self.script_job = cmds.scriptJob(cu=True, e=("SelectionChanged", qt.Callback(self.append_polygon)))
self.undo_flag = False
print 'create append job :', self.script_job
示例8: remove_job
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def remove_job(self):
if self.script_job:
print 'remove append job :', self.script_job
cmds.scriptJob(k=self.script_job)
self.script_job = None
示例9: create_scriptjob
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def create_scriptjob(parent = None, event = None, script = None):
if event and script:
return cmds.scriptJob(e=[event,script], ro=False, p = parent)
示例10: kill_scriptjob
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def kill_scriptjob(job = None):
if job:
return cmds.scriptJob(kill = job, f = True)
示例11: __init__
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def __init__(self, scriptJobFlag, eventType, **kwargs):
self.script_flag = scriptJobFlag
self.event_type = eventType
super(ScriptJobEvent, self).__init__(**kwargs)
self.data['scriptJob'] = -1
示例12: start
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def start(self, **sjFlags):
kwargs = {self.script_flag: (self.event_type, self)}
kwargs.update(sjFlags)
self.data['scriptJob'] = cmds.scriptJob(**kwargs)
Logger.info('start scriptJob %s' % self.__class__)
示例13: kill
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def kill(self):
if self.data.get('scriptJob') > 0:
cmds.scriptJob(k=self.data['scriptJob'])
self.data['scriptJob'] = -1
Logger.info('kill scriptJob %s' % self.__class__)
示例14: running
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def running(self):
sid = self.data['scriptJob']
return sid != -1 and cmds.scriptJob(exists=sid)
# ======================================================================================================================
# Attribute based script jobs
#
# See maya docs for more on the distinction between scriptJob -e, scriptJob -ct , etc
# ======================================================================================================================
示例15: hideEvent
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import scriptJob [as 别名]
def hideEvent(self, event):
if self.edit_lock is False:
if lib.maya_version() < 2017:
lib.floating_save(self)
#if self._floating_save is False:
# lib.floating_save(self)
#self._floating_save = True
if self.select_parts_script_job is None:
return
if not cmds.scriptJob(ex=self.select_parts_script_job):
return
cmds.scriptJob(kill=self.select_parts_script_job, force=True)
self.select_parts_script_job = None