本文整理汇总了Python中pymel.core.scriptJob函数的典型用法代码示例。如果您正苦于以下问题:Python scriptJob函数的具体用法?Python scriptJob怎么用?Python scriptJob使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scriptJob函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: killJob
def killJob(self):
try:
pm.scriptJob(kill=self.jid)
io.warn("Killed {0} job: {1}".format(self.event, self.jid))
self.jid = None
except Exception:
raise
示例2: _dock_closed
def _dock_closed(s, *loop):
visible = s._dock_query(vis=True)
if not visible and loop:
pmc.scriptJob(ie=s._dock_closed, p=s._dock, ro=True)
elif not visible:
pmw.deleteUI(s._dock, control=True)
print "Window closed."
示例3: __init__
def __init__(s, **kwargs):
s.callback = None
s.ids = ids = []
kwargs["e"] = ("PostSceneRead", s._changed)
ids.append(pmc.scriptJob(**kwargs))
kwargs["e"] = ("NewSceneOpened", s._changed)
ids.append(pmc.scriptJob(**kwargs))
示例4: addUIElement
def addUIElement(uiType, attribute, uiLabel, callback, renderGlobalsNodeName):
ui = None
if uiType == 'bool':
ui = pm.checkBoxGrp(label=uiLabel)
if callback is not None:
pm.checkBoxGrp(ui, edit=True, cc=callback)
if uiType == 'int':
ui = pm.intFieldGrp(label=uiLabel, numberOfFields = 1)
if callback is not None:
pm.intFieldGrp(ui, edit=True, cc = callback)
if uiType == 'float':
ui = pm.floatFieldGrp(label=uiLabel, numberOfFields = 1)
if callback is not None:
pm.floatFieldGrp(ui, edit=True, cc= callback)
if uiType == 'enum':
ui = pm.attrEnumOptionMenuGrp(label = uiLabel, at=attribute, ei = getEnumList(attribute))
# attrEnumOptionGrp has no cc callback, so I create a script job
if callback is not None:
attribute = pm.Attribute(renderGlobalsNodeName + "." + attribute)
pm.scriptJob(attributeChange=[attribute, callback], parent=ui)
if uiType == 'color':
ui = pm.attrColorSliderGrp(label=uiLabel, at=attribute)
if uiType == 'string':
ui = pm.textFieldGrp(label=uiLabel)
if callback is not None:
pm.textFieldGrp(ui, edit=True, cc=callback)
if uiType == 'vector':
ui = pm.floatFieldGrp(label=uiLabel, nf=3)
if callback is not None:
pm.floatFieldGrp(ui, edit=True, cc=callback)
return ui
示例5: __init__
def __init__(self):
title = 'pbRenderableCurve'
version = 1.02
if pm.window('pbRCurve', exists=True):
pm.deleteUI('pbRCurve')
with pm.window('pbRCurve', title='{0} | {1}'.format(title, version), s=False) as window:
with pm.columnLayout():
with pm.frameLayout(l='Selection:', cll=True, bs='out'):
with pm.columnLayout():
self.selField = pm.textFieldGrp(text='No Curves Selected', ed=False, l='Curve:', cw2=[72, 192])
with pm.rowLayout(nc=2):
self.bRenderable = pm.checkBox(l='Renderable', cc=self.bcRenderable)
with pm.frameLayout(l='Mesh Settings:', cll=True, bs='out') as self.meshUI:
with pm.columnLayout():
with pm.rowLayout(nc=4):
self.useNormal = pm.checkBox(l='Use Normal', cc=self.bcUseNormal)
self.normalVector = [pm.intField(width=62, en=False, value=0, cc=self.setNormal),
pm.intField(width=62, en=False, value=1, cc=self.setNormal),
pm.intField(width=62, en=False, value=0, cc=self.setNormal)]
self.meshAttrs = [AttrSlider(maxValue=128, name='Thickness', obj=getCurves, type_='float', fmn=0.0001),
AttrSlider(value=3, minValue=3, maxValue=64, name='Sides', obj=getCurves, fmn=3, fmx=100),
AttrSlider(minValue=1, maxValue=32, name='Samples', obj=getCurves, fmn=1, fmx=128)]
with pm.frameLayout('Shell Settings:', cll=True, bs='out') as self.shellUI:
with pm.columnLayout():
self.bShell = pm.checkBox(l='Enable Shell', cc=self.bcShell)
self.shellAttrs = [AttrSlider(value=1, minValue=-64, maxValue=64, name='ShellThickness', obj=getCurves, type_='float'),
AttrSlider(value=1, minValue=1, maxValue=64, name='ShellDivisions', obj=getCurves, fmn=1, fmx=32)]
window.show()
pm.scriptJob(event=['SelectionChanged', self.refresh], protected=True, p=window)
self.refresh()
示例6: register
def register(self):
""" Register the dock in maya """
self.deleteViews()
# Dock
if pm.dockControl(self.dockName, ex=True):
pm.deleteUI(self.dockName)
# Window
if pm.window(self.winName, ex=True):
pm.deleteUI(self.winName)
self._win = None
self.applyMetrics()
# For a dockControl, we've got to go create the ui this way
# otherwise when we create the dockControl it doesn't see the main layout
self._win = pm.window(self.winName, title=self.title)
with pm.frameLayout('mainForm', lv=False, bv=False, p=self._win) as self._mainLayout:
self.mainControl = self._mainLayout
# Create the dockControl
self._dockControl = pm.dockControl(self.winName+"Dock",
con=self._win, aa=['left', 'right'], a=self.area, fl=int(self.floating), l=self.title,
vcc=Callback(self.dockVisibleChanged), vis=False,
)
self._win = self._mainLayout
self.showDefaultView()
pm.scriptJob(uid=(self._win, Callback(self.winClosed)))
示例7: __init__
def __init__(self, *args, **kwargs ):
# Make sure that the bakeLayer plugin is loaded
if not ( pmc.pluginInfo( 'bake_layer_init.py', q = True, loaded = True ) ):
raise Exception( 'Bake Layer Plugin is not currently loaded' )
# Create the MEL Global var for the currently selected bake layer
pmc.MelGlobals.initVar('string[]', 'selected_bake_layers')
self.__window = pmc.window( self,
title = "Bake Layer Editor" )
pmc.scriptJob( permanent = True,
parent = self.__window,
event = [ 'NewSceneOpened', self.new_scene ] )
pmc.scriptJob( permanent = True,
parent = self.__window,
event = [ 'SceneOpened', self.open_scene ] )
self.menu_dict = { }
self.build( )
self.refresh( )
self.__window.show( )
示例8: __init__
def __init__(self, rigObject, callback):
self._rig = rigObject
self._callback = callback
self._row = FluidRowLayout(numberOfChildren = 3, separation = Format.SEPARATION)
with self._row:
NameField(node = self._rig.node, type = pm.nt.Transform, width = Format.Text.WIDTH)
pm.button(label = 'Edit', width = Format.Button.WIDTH / 2 - Format.SEPARATION / 2, command = lambda *args: self.editRig())
pm.button(label = 'Delete', width = Format.Button.WIDTH / 2 - Format.SEPARATION / 2, command = lambda *args: self.deleteRig())
self._deleteDialog = ConfirmationDialog(
title = 'Rig Editor | Delete',
message = 'Do you want to delete {0}?'.format(self._rig.node),
confirm = 'Delete',
deny = 'Cancel',
icon = Window.Icon.WARNING
)
pm.scriptJob(
nodeDeleted = [self._rig._node, self._callback],
parent = self._row,
replacePrevious = True
)
示例9: __init__
def __init__(s, meshes=missing, start=missing, stop=missing, click=missing, drag=missing):
s.name = "OutOfControlPicker"
s.active = False # tool state
s.meshes = meshes # Return an MSelectonList of objs
s.start = start # Callback
s.stop = stop # Callback
s.click = click # Callback
s.drag = drag # Callback
s.watch_tools() # Initialize tool watching
s.kill() # Clear out last tool if there
pmc.context.draggerContext(
s.name,
name=s.name,
prePressCommand=s.initialize_click,
releaseCommand=s.tool_click,
dragCommand=s.tool_drag,
initialize=s.tool_start,
finalize=s.tool_end,
cursor="hand",
image1="hands.png",
undoMode="sequence",
)
# Track tool changes, allowing us to track previous tool
pmc.scriptJob(e=("PostToolChanged", s.watch_tools),p=s.name)
示例10: setAttribute
def setAttribute(self, attribute):
self.attribute = attribute
if self.type not in self.UI_TYPES:
return
self.UI_TYPES[self.type](self.control, edit=True, attribute=self.attribute)
if self.callback:
pm.scriptJob(attributeChange=[self.attribute, self.callback],
replacePrevious=True, parent=self.control)
示例11: closeEvent
def closeEvent(self, event):
pm.scriptJob(kill=self.scriptJobID)
self.settings.beginGroup("MainWindow")
self.settings.setValue("libSeq", QVariant(self.animLibComboBox.currentText()))
self.settings.setValue("pubSeq", QVariant(self.seqComboBox.currentText()))
self.settings.setValue("pubShot", QVariant(self.shotComboBox.currentText()))
self.settings.setValue("pos", QVariant(self.pos()))
self.settings.endGroup()
示例12: closeEvent
def closeEvent(self, *args, **kwargs):
"""
Try to kill the script job when the window is closed
"""
try:
pymel.scriptJob(kill=self.iJobNum, force=True)
except:
pass
示例13: flushScript
def flushScript( *args ):
if( script_job_id != -1 ):
pm.scriptJob( kill=script_job_id, force=True )
pm.lockNode( 'light_probe', lock=False )
pm.delete('light_probe')
pm.makeLive(none=True)
示例14: refresh
def refresh(self):
if self._refreshEvent and pm.scriptJob(exists = self._refreshEvent):
return
self._refreshEvent = pm.scriptJob(
idleEvent = self.refreshActions,
runOnce = True
)
示例15: __init__
def __init__(self, value, min, max, name, ceObj):
self.name = name
self.ceObj = ceObj
self.undoState = False
self.attr = pm.floatSliderGrp(field=True, l=self.name, value=value, pre=3, enable=False,
minValue=min, maxValue=max, dc=lambda *args: self.set(cc=False),
cc=lambda *args: self.set(cc=True), cw3=[96, 64, 128])
pm.scriptJob(event=['Undo', self.get], protected=True, p=self.attr)