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


Python cmds.evalDeferred函数代码示例

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


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

示例1: aToolsOfflineInstall

def aToolsOfflineInstall(offlineFilePath):

    mayaAppDir      = mel.eval('getenv MAYA_APP_DIR')    
    aToolsPath      = mayaAppDir + os.sep + 'scripts'
    aToolsFolder    = aToolsPath + os.sep + 'aTools' + os.sep
    tmpZipFile      = '%s%stmp.zip'%(aToolsPath, os.sep)
    offlineFileUrl  = r'file:///%s'%offlineFilePath
        
    if os.path.isfile(tmpZipFile):     os.remove(tmpZipFile)   
    if os.path.isdir(aToolsFolder): shutil.rmtree(aToolsFolder)      
    
    output = download(offlineFileUrl, tmpZipFile)    
    
    zfobj = zipfile.ZipFile(tmpZipFile)
    for name in zfobj.namelist():
        uncompressed = zfobj.read(name)
    
        filename  = formatPath('%s%s%s'%(aToolsPath, os.sep, name))        
        d         = os.path.dirname(filename)
        
        if not os.path.exists(d): os.makedirs(d)
        if filename.endswith(os.sep): continue
        
        output = open(filename,'wb')
        output.write(uncompressed)
        output.close()
        
    zfobj.close()
    if os.path.isfile(tmpZipFile):     os.remove(tmpZipFile)
    from aTools import setup; reload(setup); setup.install([offlineFilePath, False]) 
    cmds.evalDeferred(\"from aTools.animTools.animBar import animBarUI; reload(animBarUI); animBarUI.show(\'refresh\')\")     
开发者ID:Italic-,项目名称:maya-prefs,代码行数:31,代码来源:offlineInstall.py

示例2: process

def process( call, *args):
	# Selection
	intialSelection = cmds.ls(selection=True, flatten=True)
	selections = intialSelection[:]
	# Input Values from UI
	inputName = ['placeholder'] # needs to be a list fed into it to work
	inputName[0] = cmds.textField("inputField", q=True, text = True)
	old = cmds.textField("replaceField", q=True, text = True)
	new = cmds.textField("withField", q=True, text = True)
	# Assign the Rename Class 
	D = Rename(selections, inputName )
	if old: # if there is data in the replaceField txt box, then run the replacement code
		for i in range( len (selections) ):
			findTxt = D.reFunction(D.getAfterNamespace(i), old)
			replacementName = D.getAfterNamespace(i)[ : findTxt [0][0] ] + new + D.getAfterNamespace(i)[ findTxt [0][1] : ]
			cmds.rename(selections[i], D.getNamespace(i) + replacementName)
	else:
		for i in range( len (selections) ):
			X = D.processNamespace(i)
			if X == ':': X = '::' # This prevents the root namespace from getting lost in the cutoff [:-1] use X[:-1] instead of D.processNamespace(i) [:-1]
			if cmds.namespace(exists = X [:-1] ) != True: # creates new namespace if doesn't already exist
				print ' creating new namespace'
				cmds.namespace(addNamespace = X [:-1] ) # create namespace if doesn't already exist
			cmds.rename( D.selection[i] , ':' + D.processNamespace(i) + D.processRename(i) )
			cmds.namespace(set = ':') # set namespace back to root so any new object created is under the root
	if call == 'NA':
		cmds.warning('no exit call, window stays open')
	elif call == 'exit':
		cmds.warning('exit called, closing rename window')
		cmds.evalDeferred('cmds.deleteUI("renameUI")')
		#cmds.deleteUI(window)
开发者ID:jricker,项目名称:JR_Maya,代码行数:31,代码来源:JR_rename_tool_backup.py

示例3: start

def start(Menu=True):
    import maya.cmds as cmds
    #Run the main setups. If you DON'T want the Red9Menu set 'Menu=False'
    cmds.evalDeferred("Red9.setup.start(Menu=%s)" % Menu)
    #Import the core, not this is on LowPriority to make sure it 
    #happens after the main setups have finished above
    cmds.evalDeferred("import Red9.core",lp=True)
开发者ID:miketon,项目名称:SymLink,代码行数:7,代码来源:__init__.py

示例4: open

    def open():
        '''
        just a shortcut method to construct and display main window
        '''

        window = MainWindow.getInstance()
        
        if cmds.control(MainWindow.DOCK_NAME,q=True,exists=True):
            cmds.control(MainWindow.DOCK_NAME,e=True,visible=True)
        else:
            cmds.dockControl(MainWindow.DOCK_NAME,l=window.createWindowTitle(),content=MainWindow.WINDOW_NAME,
                             area='right',allowedArea=['right', 'left'],
                             width=window.preferedWidth.get(),
                             floating=window.preferedFloating.get(),
                             visibleChangeCommand=window.visibilityChanged)
            
            if window.preferedFloating.get():
                cmds.window(MainWindow.DOCK_NAME,e=True,
                            topEdge=window.preferedTop.get(),leftEdge=window.preferedLeft.get(),
                            w=window.preferedWidth.get(),h=window.preferedHeight.get())
        
            Utils.silentCheckForUpdates()
        
        # bring tab to front; evaluate lazily as sometimes UI can show other errors and this command somehow fails
        cmds.evalDeferred(lambda *args: cmds.dockControl(MainWindow.DOCK_NAME,e=True,r=True));
        
        # a bit of a fake, but can't find a better place for an infrequent save
        LayerEvents.layerAvailabilityChanged.addHandler(window.savePrefs, MainWindow.DOCK_NAME)
        
        return window
开发者ID:leandropim,项目名称:Tapp,代码行数:30,代码来源:mainwindow.py

示例5: deferredLoadVrayRig

def deferredLoadVrayRig():
  # Make sure the rigs don't exist yet
  if (findVrayLatLongRig() == 0):
    cmds.evalDeferred("addNewVrayLatLongRig()")

  if (findVrayDomeRig() == 0):
    cmds.evalDeferred("addNewVrayDomeRig()")
开发者ID:zicher3d-org,项目名称:domemaster-stereo-shader,代码行数:7,代码来源:userSetup.py

示例6: boot_client_projects

def boot_client_projects():
    '''
    Boot Client modules found in the Red9_ClientCore dir. This now propts
    if multiple client projects were found.
    '''
    global CLIENTS_BOOTED
    CLIENTS_BOOTED=[]
    clients=get_client_modules()
    clientsToBoot=[]
    if clients and len(clients)>1 and not mayaIsBatch():
        options=['All']
        options.extend(clients)
        result=cmds.confirmDialog(title='ProjectPicker',
                            message=("Multiple Projects Found!\r\r"+
                                     "Which Project would you like to boot?"),
                            button=options, messageAlign='center')
        if result == 'All':
            clientsToBoot=clients
        else:
            clientsToBoot.append(result)
    else:
        clientsToBoot=clients
        
    # boot the project / projects
    for client in clientsToBoot:
        log.info('Booting Client Module : %s' % client)
        cmds.evalDeferred("import Red9_ClientCore.%s" % client, lp=True)  # Unresolved Import
        CLIENTS_BOOTED.append(client)
        
    # remove unused menuItems - added previously so that the menu grouping is clean
    for client in clients:
        if not client in clientsToBoot:
            cmds.deleteUI('redNineClient%sItem' % client)
            log.debug('Unused Client Menu Removed: %s' % client)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:34,代码来源:setup.py

示例7: boot_client_projects

def boot_client_projects():
    '''
    Boot all Client modules found in the Red9_ClientCore dir
    '''
    for client in get_client_modules():
        log.info('Booting Client Module : %s' % client)
        cmds.evalDeferred("import Red9_ClientCore.%s" % client, lp=True)  # Unresolved Import
开发者ID:xavMikeHoward,项目名称:Red9_StudioPack,代码行数:7,代码来源:setup.py

示例8: _setUpIBL

def _setUpIBL():
	
		if not c.objExists('myIbl') and not c.objExists('myIblShape'):
			mel.eval('miCreateDefaultNodes()');
			
			c.select(cl=True);
			mel.eval('setCurrentRenderer mentalRay;');
			ibl = c.createNode( 'mentalrayIblShape', n='myIbl' );
			c.rename('mentalrayIbl1', 'myIblShape');
			if(c.isConnected( 'myIbl.message', 'mentalrayGlobals.imageBasedLighting' ) != '0'):
				c.evalDeferred( "c.connectAttr(  'myIbl.message', 'mentalrayGlobals.imageBasedLighting', f=True)", lp=True);
			mel.eval('$path = `optionVar -q WeatherViz_HDR_Path`');
			#mel.eval('$path = optionVar -q "WeatherViz_HDR_Path"');
			mel.eval('AEassignFilenameCB  myIbl.texture $path "image"');
			c.setAttr('myIbl.colorGain', 14, 14, 14, type='double3');
			#sets render stats
			c.setAttr('myIbl.visibleInEnvironment', 1);
			c.setAttr('myIbl.visibleInReflections', 1);
			c.setAttr('myIbl.visibleInRefractions', 1);
			c.setAttr('myIbl.visibleInFinalGather', 1);

			c.setAttr('myIblShape.scaleX', 80);
			c.setAttr('myIblShape.scaleY', 80);
			c.setAttr('myIblShape.scaleZ', 80);
			c.select(cl=True);
		else:
			mel.eval('$path = `optionVar -q WeatherViz_HDR_Path`');
			mel.eval('AEassignFilenameCB  myIbl.texture $path "image"');
开发者ID:sebra729,项目名称:WeatherViz,代码行数:28,代码来源:WeatherViz.py

示例9: TappInstall_browse

def TappInstall_browse(*args):
    repoPath=cmds.fileDialog2(dialogStyle=1,fileMode=3)
    
    if repoPath:
        repoPath=repoPath[0].replace('\\','/')
        
        check=False
        #checking all subdirectories
        for name in os.listdir(repoPath):
            
            #confirm that this is the Tapp directory
            if name=='Tapp':
                check=True
        
        if check:
            #create the text file that contains the Tapp directory path
            path=cmds.internalVar(upd=True)+'Tapp.yml'
            
            f=open(path,'w')
            data='{launchWindowAtStartup: False, repositoryPath: \''+repoPath+'\'}'
            f.write(data)
            f.close()
    
            #run setup
            sys.path.append(repoPath)
            
            cmds.evalDeferred('import Tapp')
            
            #delete ui
            cmds.deleteUI('TappInstall_UI')
            
        else:
            cmds.warning('Selected directory is not the \'Tapp\' directory. Please try again')
开发者ID:baitstudio,项目名称:CodeRepo,代码行数:33,代码来源:tapp_maya.py

示例10: deferredLoadArnoldRig

def deferredLoadArnoldRig():
  # Make sure the rigs don't exist yet
  if (findArnoldLatLongRig() == 0):
    cmds.evalDeferred("addNewArnoldLatLongRig()")
  
  if (findArnoldDomeRig() == 0):
    cmds.evalDeferred("addNewArnoldDomeRig()")
开发者ID:zicher3d-org,项目名称:domemaster-stereo-shader,代码行数:7,代码来源:userSetup.py

示例11: Tapp

def Tapp():
    path=cmds.internalVar(upd=True)+'Tapp.yml'

    if os.path.exists(path):
        f=open(path,'r')
        
        settings=f.read()
        
        #brute force from yaml to ast
        settings=settings.replace('{','{\'').replace(':','\':').replace(', ',', \'')
        settings=settings.replace('\n','')
        settings=settings.replace('true','True')
        settings=settings.replace('false','False')
        
        #compensate for drive letter
        settings=settings.replace('\':/',':/')
        
        settings=ast.literal_eval(settings)
             
        path=settings['repositoryPath']
        
        if os.path.exists(path):
            if not path in sys.path:
                sys.path.append(path)
            
            #run setup
            cmds.evalDeferred('import Tapp')
        else:
            TappInstall_UI()
    else:
        TappInstall_UI()
开发者ID:baitstudio,项目名称:CodeRepo,代码行数:31,代码来源:tapp_maya.py

示例12: setupScene

def setupScene():
	'''
	Setup some scene attributes we want to be common to all Spinifex car scenes
	TODO:
	make width over height as float
	'''
		
	# Check if we haven't done this before
	if cmds.objExists('vraySettings.setupSceneHasBeenRun'):
		# Check that everything is setup correctly before continuing.
		dialogMessage = 'setupScene has already been run. Do you wish to continue? Some of your render settings will be reset.'
		result = cmds.confirmDialog( title='spckSetupScene', message=dialogMessage, button=['YES','NO'], defaultButton='NO', cancelButton='NO', dismissString='NO' )
		if result == 'NO' :
			print("Aborted. We\'ve done this before...\n")
			return
	else:
		# Check that everything is setup correctly before continuing.
		dialogMessage = 'Have you set up your workspace.mel?'
		result = cmds.confirmDialog( title='spckSetupScene', message=dialogMessage, button=['YES','NO'], defaultButton='YES', cancelButton='NO', dismissString='NO' )
		if result == 'NO' :
			print('Go setup your workspace and run again.\n')
			return
		
	# Units for working in metric and 30fps
	cmds.currentUnit (linear='cm')
	cmds.currentUnit (angle='deg')
	cmds.currentUnit (time='ntsc')

	# Load VRAY if not active
	cmds.loadPlugin ('vrayformaya', quiet=True)
	cmds.pluginInfo ('vrayformaya', edit=True, autoload=True)
	cmds.setAttr  ('defaultRenderGlobals.ren', 'vray', type='string')

	cmds.evalDeferred ( 'createBaseRenderSettings()' , lowestPriority=True )	
	print('Success.\n')
开发者ID:mybikeislost,项目名称:studio_pipeline,代码行数:35,代码来源:setupScene.py

示例13: move_selection_set_down

	def move_selection_set_down(self, idx, *args):
		self._util.disable_undo()
		try:
			moved = self._selectionSets.move_down(idx)
			if moved:
				cmds.evalDeferred(self._update_selection_sets_ui)
		finally:
			self._util.enable_undo()
开发者ID:ChyrosNX,项目名称:NephX7,代码行数:8,代码来源:cnx_rigathon_selection_sets_ui.py

示例14: start

def start(Menu=True, MayaUIHooks=True, MayaOverloads=True, parentMenu='MayaWindow'):
  
    #Run the main setups. If you DON'T want the Red9Menu set 'Menu=False'
    #cmds.evalDeferred("Red9.setup.start(Menu=%s)" % Menu)
    cmds.evalDeferred("import Red9;Red9.setup.start(Menu=%s,MayaUIHooks=%s,MayaOverloads=%s,parentMenu='%s')" % (Menu,MayaUIHooks,MayaOverloads,parentMenu))
    #Import the core, not this is on LowPriority to make sure it
    #happens after the main setups have finished above
    cmds.evalDeferred("import Red9.core", lp=True)
开发者ID:Bumpybox,项目名称:Tapp,代码行数:8,代码来源:__init__.py

示例15: move_character_down

	def move_character_down(self, idx, *args):
		self._util.disable_undo()
		try:
			moved = self._characters.move_down(idx)
			if moved:
				cmds.evalDeferred(self._update_characters_ui)
		finally:
			self._util.enable_undo()
开发者ID:ChyrosNX,项目名称:NephX7,代码行数:8,代码来源:cnx_rigathon_characters_ui.py


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