当前位置: 首页>>代码示例>>Python>>正文


Python cmds.scriptJob函数代码示例

本文整理汇总了Python中maya.cmds.scriptJob函数的典型用法代码示例。如果您正苦于以下问题:Python scriptJob函数的具体用法?Python scriptJob怎么用?Python scriptJob使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了scriptJob函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: flatten

def flatten(averaged=True):
    """
    Flattens selection by averaged normal.
    """
    def flatten(component, script_job=False):

        if script_job:
            cmds.select(selected.cmdslist())
        else:
            cmds.select(component.cmdslist())

        center = list(component.bbox.center)[:3]
        origin = get_average_vert_normal(component.normals, component.indices)

        # Perform scale
        cmds.manipScaleContext('Scale', e=True, mode=6, alignAlong=origin)
        radians = cmds.manipScaleContext('Scale', q=True, orientAxes=True)
        t = [math.degrees(r) for r in radians]
        cmds.scale(0, 1, 1, r=True, oa=t, p=center)

    def script_job():
        """
        Get normal from script job selection and pass it to flatten.
        """
        flatten(next(iter(mampy.complist())).to_vert(), True)

    selected = mampy.complist()
    if averaged:
        for comp in selected:
            flatten(comp.to_vert())
        cmds.select(selected.cmdslist(), r=True)
    else:
        # Scale selection to given selection.
        cmds.scriptJob(event=['SelectionChanged', script_job], runOnce=True)
开发者ID:arubertoson,项目名称:maya-mamtools,代码行数:34,代码来源:mesh.py

示例2: main

def main():
    def create_filter(fn):
        regex = re.compile(fn, re.I)
        test = lambda p: regex.search(p)
        items.update_filter(test)

    with gui.Window() as w:
        with forms.NavForm() as nav:
            with forms.VerticalForm() as navbar:
                one = gui.Button()
                two = gui.Button()
                three = gui.Button()
            with forms.HeaderForm() as main:
                filter_field = QTextField()
                main_list = lists.VerticalList()

        items > bind() > main_list.collection
        items.bind.viewCount > bind() > three.bind.label
        items.bind.count > bind() > two.bind.label
        w.update_bindings()

    w.buffer = InputBuffer(w, create_filter)
    filter_field.textChanged += w.buffer.handle
    cmds.scriptJob(lj=True)
    return w
开发者ID:bob-white,项目名称:mGui,代码行数:25,代码来源:filtered_collection.py

示例3: __cancelCallback

    def __cancelCallback(*pArgs):
        if cmds.window(axisParallelPlane.windowID, exists = True):
            cmds.deleteUI(axisParallelPlane.windowID)

        if (cmds.scriptJob(ex = axisParallelPlane.job)):
            cmds.scriptJob(kill = axisParallelPlane.job, force = 1)
        axisParallelPlane.job = -1
开发者ID:EnReich,项目名称:ProKlaue,代码行数:7,代码来源:axisParallelPlane.py

示例4: buildGUI

	def buildGUI(self):
	
		if cmds.window(self.name, q=True, exists=True):
			cmds.deleteUI(self.name)
		cmds.window(self.name, title=self.title, sizeable=False, mxb=False, mnb=False, toolbox=False, w=100, h=30)
		cmds.columnLayout("mainLayout", adj=True, parent=self.name, co=("left", 5))

		# Add onClose Event
		cmds.scriptJob(uiDeleted=(self.name, self.onClose))
		
		# Help Menu
		cmds.menuBarLayout("menuBar")
		cmds.menu(label="Show Help", helpMenu =True, pmc=self.showHelp)

		# Import paths
		cmds.textFieldButtonGrp("tfbDBPath", label="Links: ", bl="Set Link Path", cw=(1,50), parent="mainLayout", bc=self.setDBPath)
		cmds.textFieldButtonGrp("tfbShaderPath", label="Shaders: ", bl="Set Shader Path", cw=(1,50), parent="mainLayout", bc=self.setShaderPath)
		
		cmds.checkBox("cbSelection", label="Use Selection", parent="mainLayout")
		cmds.checkBox("cbSubstring", label="Substring prefix", parent="mainLayout", value=True)
		cmds.textField("tfSubstring", parent="mainLayout", text="s100_char")

		cmds.separator(h=10, style="none", parent="mainLayout")

		# Buttons
		cmds.rowColumnLayout("buttonsLayout", numberOfColumns=2, parent="mainLayout")
		cmds.button("bExportLinks", label = "Export Links", w=200, h=30, parent="buttonsLayout", c=self.exportLinks)
		cmds.button("bImportShader", label="Link Shaders", w=200, h=30, parent="buttonsLayout", c=self.linkShaders)

		cmds.showWindow(self.name)
开发者ID:Quazo,项目名称:breakingpoint,代码行数:30,代码来源:jf_shaderLinker.py

示例5: enableRitalin

def enableRitalin(enable = True): 
	global RitalinEnabled
	global resetTumbleToolToCOI
	
	if enable == True:
		if RitalinEnabled == False:
			if (cmds.tumbleCtx ("tumbleContext", query = True, localTumble = true)) == 1:
				cmds.tumbleCtx ("tumbleContext", edit = True, localTumble = 0)
				resetTumbleToolToCOI = True
			else: resetTumbleToolToCOI = False

		cleanRitalinScriptJobs()

		#The dragRelease event is king, it always gets fired when the user presses the mouse button or moves the mouse with the button pressed - exactly what we need
		Job1 = cmds.scriptJob(runOnce = False, killWithScene = False, event =('DragRelease',  "cmds.undoInfo (swf = False); setCamRotatePivots(); cmds.undoInfo (swf = True)"))
		RitalinScriptJobs.append(Job1)		

		#Due to a bug in Maya we need to run the following event at least once to ensure that the DragRelease event gets triggered above. Otherwise it never kicks in  :-(
		#Also, to prevent the undo/redo queue from getting overwritten we only do store selected components when there are no commands to redo, 
		#which is only the case if the selction change was due to user-action rather than undo/redo...
		Job2 = cmds.scriptJob(runOnce = False, killWithScene = False,  event =('SelectionChanged',  "cmds.undoInfo (swf = False); setCamRotatePivots(); cmds.undoInfo (swf = True)")) #if cmds.undoInfo(q = true, redoName = True) == '':
		RitalinScriptJobs.append(Job2)
		Job3 = cmds.scriptJob(runOnce = False, killWithScene = False,  event =('Undo',  "cmds.undoInfo (swf = False); setCamRotatePivots(); cmds.undoInfo (swf = True)")) #if cmds.undoInfo(q = true, redoName = True) == '':
		RitalinScriptJobs.append(Job3)
		Job4 = cmds.scriptJob(runOnce = False, killWithScene = False,  event =('Redo',  "cmds.undoInfo (swf = False); setCamRotatePivots(); cmds.undoInfo (swf = True)")) #if cmds.undoInfo(q = true, redoName = True) == '':
		RitalinScriptJobs.append(Job4)
	
		setCamRotatePivots()
			
	if enable == False:
		#print ("Attempting to disable Ritalin - Deleting script Jobs")
		if resetTumbleToolToCOI == True:
			cmds.tumbleCtx ("tumbleContext", edit = True, localTumble = 1)
		
		cleanRitalinScriptJobs()
开发者ID:blondimage,项目名称:keyvis-dev,代码行数:35,代码来源:Ritalin_Public.py

示例6: rigUpdate

 def rigUpdate(self):
     #disable refresh until the rig update is complete
     cmds.refresh(su=True)
     rigNodeFound = False
     try:
         rigGuiNode = self.scene.sceneNodes["Rig"]
         rigNodeFound = True
     except KeyError:
         rigNodeFound = False
     if rigNodeFound:
         #kill all script jobs created by controllers to avoid
         #an update loop which the rig is updated
         for jobNum in self.scriptJobNumbers:
             if jobNum != globals.currentScriptJobNum:
                 cmds.scriptJob(k=jobNum)
         self.scriptJobNumbers = []
         rigGuiNode.updateVersion += 0.1
         rootElem = self.recursiveGetXML(rigGuiNode)
         self.indent(rootElem)
         tree = xml.ElementTree(rootElem)
         file = open(self.updateXmlPath, 'w')
         tree.write(file)
         file.close()
         self.recursiveZeroOutControllers(rigGuiNode)
         if rigGuiNode.metaNodeName is not None and rigGuiNode.metaNodeName != "":
             self.rootNodeName = mel.eval("updateMetaDataManager -n \""+rigGuiNode.metaNodeName+"\";")
         else:
             self.rootNodeName = mel.eval("loadRig -p \""+self.updateXmlPath+"\";")
         cmds.select(cl=True)
         self.recursiveUpdateMetaNodes(rigGuiNode,self.rootNodeName)
         self.recursiveSetupScriptJobs(rigGuiNode)
     cmds.refresh(su=False)
开发者ID:LoganKelly,项目名称:Modular_Rigging_Thesis,代码行数:32,代码来源:RigNodeEditor.py

示例7: register_event

    def register_event(self, event):
        """
        Create the scriptJob for AttributeNotifier <event>
        """
        attrib = "{0}.{1}".format(self, event.attribute)

        event_data = dict((k, v) for k, v in event.items() if not k.startswith("_"))

        handler = partial(AttributeChangeHandler.handle,
                          uuid=self.uuid,
                          attribute=event.attribute,
                          handler=event.handler,
                          data=event_data)

        ac_job = cmds.scriptJob(kws=1, ac=(attrib, handler))

        delete_handler = partial(AttributeChangeHandler.reassign,
                                 attrib=event.attribute,
                                 uuid=self.uuid,
                                 job=ac_job)

        rn_job = cmds.scriptJob(kws=1, runOnce=True, nnc=(self, delete_handler))

        _logger.info('listening on %s' % attrib)
        return ac_job, rn_job
开发者ID:theodox,项目名称:attributeEvents,代码行数:25,代码来源:__init__.py

示例8: deregisterScriptJobs

 def deregisterScriptJobs(self):
     for i in self.scriptJobs:
         try:
             cmds.scriptJob(kill=i)
         except:
             pass
     self.scriptJobs = []
开发者ID:leandropim,项目名称:Tapp,代码行数:7,代码来源:events.py

示例9: setMode

    def setMode(self, onOff):
        
        utilMod.killScriptJobs("G.microTransformScriptJobs")
                
        if onOff:
            
            self.rotationOrientMode         = cmds.manipRotateContext('Rotate', query=True, mode=True)
            cmds.manipRotateContext('Rotate', edit=True, mode=2)#gimbal
            #update values on turning on
            self.addMicroTransform()
            
            G.microTransformScriptJobs = []
            # get the current selected object values
            G.microTransformScriptJobs.append(cmds.scriptJob(runOnce = False, killWithScene = False, event =('SelectionChanged', self.addMicroTransform ))) 
            G.microTransformScriptJobs.append(cmds.scriptJob(runOnce = False, killWithScene = False, event =('timeChanged', self.updateValues )))
            G.microTransformScriptJobs.append(cmds.scriptJob(runOnce = False, killWithScene = False, event =('Undo', self.updateValues ))) 
            G.microTransformScriptJobs.append(cmds.scriptJob(runOnce = False, killWithScene = False, event =('Redo', self.updateValues ))) 
            G.microTransformScriptJobs.append(cmds.scriptJob(runOnce = False, killWithScene = False, event =('DragRelease', self.release ))) 
            

            
            #print "microTransform is ON."
            
        else:
            cmds.manipRotateContext('Rotate', edit=True, mode=self.rotationOrientMode)
            self.removeMicroTransform()
开发者ID:Italic-,项目名称:maya-prefs,代码行数:26,代码来源:microTransform.py

示例10: createWindow

    def createWindow(self):
        self.log.debug("creating window "+self.windowName)
        
        if self.windowExists(self.windowName):
            raise Exception("window %s already opened" % self.windowName)
        if not self.useUserPrefSize:
            try:
                cmds.windowPref(self.windowName,remove=True)
                cmds.windowPref(self.windowName,width=self.defaultWidth,height=self.defaultHeight)
            except:
                pass

        cmds.window(self.windowName,
                                   title=self.windowTitle,
                                   maximizeButton=False,
                                   minimizeButton=False,
                                   width=self.defaultWidth,
                                   height=self.defaultHeight,
                                   sizeable=self.sizeable,
                                   menuBar=self.menuBar)
        
        
        cmds.scriptJob(uiDeleted=[self.windowName,self.onWindowDeleted])
        
        HeadlessDataHost.HANDLE.addReference(self)
开发者ID:BigMacchia,项目名称:ngSkinTools,代码行数:25,代码来源:basetoolwindow.py

示例11: _FILE_Save

    def _FILE_Save(s, todo, archive):
        path = s._FILE_Running()
        if path:
            if todo:
                def fileArchive(): # Begin the archive process
                    realpath = os.path.realpath(path)
                    if archive:
                        archive(realpath)

                process = cmds.scriptJob(e=['SceneSaved', fileArchive], ro=True)
                try:
                    message = """
<div>- This Scene was last saved on <em>%(time)s</em>.</div>
<div>- Completing the task: <code>%(todo)s</code></div>
<div>- The file <strong>has not been modified since.</strong></div><br>
""" % {"time": time.ctime(), "todo": todo.label}
                    with Popup(message):
                        cmds.file(save=True)  # Save the scene
                    return True
                except RuntimeError as e:  # If scene save was canceled or failed. Reset everything
                    print "Warning: %s" % e
                    if cmds.scriptJob(ex=process):
                        cmds.scriptJob(kill=process)
            else:
                try:
                    cmds.file(save=True)
                    return True
                except RuntimeError as e:
                    print "Warning: %s" % e
        else: # Nothing in the scene to save
            return True
开发者ID:internetimagery,项目名称:todo,代码行数:31,代码来源:file.py

示例12: newItemJob

	def newItemJob(self):
		# Reset the object creation handling job 
		if(cmds.scriptJob(exists=self.newObjectJob)):
			cmds.scriptJob(kill=self.newObjectJob)
		self.newObjectJob = cmds.scriptJob(event=('DagObjectCreated', self.onNewObject))
		# Store the current tool so we can change back to it when the user has finished painting
		self.currentContext = cmds.currentCtx()
开发者ID:TomMinor,项目名称:mesh-surface-spawner,代码行数:7,代码来源:PaintGUI.py

示例13: __init__

    def __init__(s):
        s.registerHooks()  # Load our hooks
        if cmds.dockControl("TODO_WINDOW", ex=True):
            cmds.deleteUI("TODO_WINDOW")
            s.fireHook("app.end")
            print "Window exists. Closing and opening a new window."
        s.page = ""  # Page we are on.
        s._refresh()  # Initialize saved data
        s.fireHook("app.start")
        s.regex = {}  # Compiled regexes
        title = "Todo"
        try:
            with open(os.path.join(os.path.dirname(__file__), "quotes.json"), "r") as f:  # Motivation!
                title = random.choice(json.load(f))
        except (IOError, ValueError):
            print "No inspirational quotes loaded."

        window = cmds.window(title=title, rtf=True)
        s.container = cmds.columnLayout(adj=True)
        s.wrapper = ""

        allowed_areas = ['right', 'left']
        s.dock = cmds.dockControl("TODO_WINDOW", a='left', content=window, aa=allowed_areas, fl=True, l=title, fcc=s.moveDock, vcc=s.closeDock)

        s._buildTodo()

        if s.location == 'float':
            cmds.dockControl(s.dock, e=True, fl=True)
        elif s.location in allowed_areas:
            cmds.dockControl(s.dock, e=True, a=s.location, fl=False)

        cmds.scriptJob(e=["PostSceneRead", s._refresh], p=s.dock)
        cmds.scriptJob(e=["NewSceneOpened", s._refresh], p=s.dock)
开发者ID:internetimagery,项目名称:todo,代码行数:33,代码来源:Original.__init__.py

示例14: __init__

	def __init__(self, parent  = uiH.getMayaWindow(), *args ):
		if uiH.USEPYQT:
			super(base, self).__init__(parent)
		else:
			super(LighterHelperUI, self).__init__(parent)
		self.setupUi(self)
		#load arnold if it is not loaded
		self.loadArnold()
		self.setObjectName( 'ligther_Helper_WIN' )
		self._makeConnections()
		#self._addAllAovs()
		#create an scriptjob thats update the UI on renderlayer change
		mc.scriptJob( e = ["renderLayerManagerChange", partial( self.updateLighterUI )], p = 'ligther_Helper_WIN' )
		self.updateLighterUI()
		#set icons for toolbar
		self.actionSpot.setIcon(QtGui.QIcon(":/spotlight.png"))
		self.actionDirectional.setIcon(QtGui.QIcon(":/directionallight.png"))
		self.actionPoint.setIcon(QtGui.QIcon(":/pointlight.png"))
		self.actionAmbient.setIcon(QtGui.QIcon(":/ambientlight.png"))
		self.actionArea.setIcon(QtGui.QIcon(":/arealight.png"))
		self.actionVolume.setIcon(QtGui.QIcon(":/volumelight.png"))
		self.actionRenderGlobals.setIcon(QtGui.QIcon(":/renderGlobals.png"))
		self.actionRenderView.setIcon(QtGui.QIcon(":/render.png"))
		self.actionLookThrough.setIcon(QtGui.QIcon(":/fileTextureView.png"))
		#internal variables
		self.isolatedLights = [] #lights that are beign turn off when we want to isolate others!
		self.isolatedObjects = [] #objects that are beign turn off when we one to isolate others!
		uiH.loadSkin( self, 'QTDarkGreen' )
开发者ID:skarone,项目名称:PipeL,代码行数:28,代码来源:lighterHelperUI.py

示例15: win

def win(*args):
    '''Window used to update the mesh
    '''
    #if any windows are open that deal with updating the mesh, close them
    winList=['atom_meshUpdateWin', 'keyMeshdirDialogWin']
    for win in winList:
        if cmds.window(win, ex=True):
            cmds.deleteUI(win)
    #create the window
    cmds.window('atom_meshUpdateWin', title = 'Atom Mesh Update')
    cmds.columnLayout(co=['both',5],adj=True, rs=5)
    path = os.path.join(cmds.workspace(query=True, o=True), 'scenes/anim/template_rig/CharactersWork/SantaPup/RIG/mesh_update_info')
    button_state = True
    #Test if the mesh_update_folder is the current path, this will usually be false
    if os.path.exists(path) != True:
        print path
        path = cmds.workspace(query=True, o=True)
        button_state=False
        print 'mesh_update_info folder not found. Browse to folder to continue.'
        
    cmds.textFieldButtonGrp('atom_meshUpdatePath_tfbg', label='Path:', tx=path, buttonLabel='Set Path', ct3=['left','both','left'],
                            co3=[0,0,5],cl3=['left', 'center', 'center'], ad3=2, cw3=[35,100,80], bc='from atom import atom_updateMesh_lib\natom_updateMesh_lib.dirDialog()')
    cmds.button('atom_meshUpdate_button',l='Update Mesh', c ='from atom import atom_updateMesh_lib\natom_updateMesh_lib.updateMeshCMD()', en=button_state )
    cmds.scriptJob(runOnce=True,uid=['atom_meshUpdateWin', 'from atom import atom_updateMesh_lib\natom_updateMesh_lib.deleteDirDialog()'])
    cmds.showWindow('atom_meshUpdateWin')
开发者ID:boochos,项目名称:work,代码行数:25,代码来源:atom_updateMesh_lib.py


注:本文中的maya.cmds.scriptJob函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。