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


Python mel.eval函数代码示例

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


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

示例1: pupMaya2mental

def pupMaya2mental(mentalVersion):
        destPath = os.getenv('DEST_PATH_WIN')
        rootPath, shadersPath = {	
                3.8:('c:/Program Files/Autodesk/mrstand3.8.1-adsk2011/bin', destPath + '/mental3.8.1'),
                3.11:('c:/Program Files/Autodesk/mrstand3.11.1-adsk2014/bin', destPath + '/mental3.11.1')
                }[mentalVersion]

        os.putenv('RAY_COMMAND', '"' + rootPath + '/ray.exe"')

        os.putenv('MR_VERSION', str( mentalVersion ) )

        miModulesPaths, binModulesPaths = modulesPath.getMiBinString()
        #os.putenv('MI_RAY_INCPATH', shadersPath + '/mi;' +  miModulesPaths)
        #os.putenv('MI_LIBRARY_PATH', shadersPath + '/bin;' +  binModulesPaths)
        #os.putenv('MI_ROOT', rootPath)
        mel.eval('pup_maya_2_mental(3);')

        mc.checkBoxGrp('pup_m2mrOverrideEnv', e=True, v1=1)
        mc.textFieldGrp('pup_m2mrMiRoot', e=True, tx= rootPath )
        mc.textFieldGrp('pup_m2mrMiInclude', e=True, tx= shadersPath + '/mi;' +  miModulesPaths )
        mc.textFieldGrp('pup_m2mrMiLib', e=True, tx= shadersPath + '/bin;' +  binModulesPaths )
        mc.textFieldGrp('pup_m2mrMiDir', e=True, tx= "C:/Temp/" )
        mc.optionMenuGrp('pup_m2mrVerboseM', e=True, sl=5)
        #mc.textFieldGrp('pup_m2mrCommandLine', e=True, tx= '-finalgather_passes 0 -memory 1000000' )
        mc.textFieldGrp('pup_m2mrCommandLine', e=True, tx= '-memory 1000000' )
        mc.checkBoxGrp('pup_m2mrUniqueMI', e=True, v1=1)
        mc.optionMenuGrp('pup_m2mrPriority', e=True, sl=3)
开发者ID:zclongpop123,项目名称:sag_utils,代码行数:27,代码来源:pupMaya2mental.py

示例2: _publish_gpu_for_item

    def _publish_gpu_for_item(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb):
        """
        Export a gpu cache for the specified item and publish it  to Shotgun.
        """
        group_name = item["name"].strip("|")
        debug(app = None, method = '_publish_gpu_for_item', message = 'group_name: %s' % group_name, verbose = False)
        tank_type = output["tank_type"]
        publish_template = output["publish_template"]        
                
        # get the current scene path and extract fields from it using the work template:
        scene_path = os.path.abspath(cmds.file(query=True, sn= True))
        fields = work_template.get_fields(scene_path)
        publish_version = fields["version"]

        # update fields with the group name:
        fields["grp_name"] = group_name

        ## create the publish path by applying the fields with the publish template:
        publish_path = publish_template.apply_fields(fields)
        #'@asset_root/publish/gpu/{name}[_{grp_name}].v{version}.abc'
        gpuFileName = os.path.splitext(publish_path)[0].split('\\')[-1] 
        fileDir = '/'.join(publish_path.split('\\')[0:-1])
        debug(app = None, method = '_publish_gpu_for_item', message = 'gpuFileName: %s' % gpuFileName, verbose = False)
        
        ## Now fix the shaders
        shd.fixDGForGPU()
        
        if cmds.objExists('CORE_ARCHIVES_hrc'):
            cmds.setAttr('CORE_ARCHIVES_hrc.visiblity', 0)
        
        if cmds.objExists('ROOT_ARCHIVES_DNT_hrc'):
            cmds.setAttr('ROOT_ARCHIVES_DNT_hrc.visiblity', 0)
                                       
        ## build and execute the gpu cache export command for this item:
        try:
            print '====================='
            print 'Exporting gpu now to %s\%s' % (fileDir, gpuFileName)
            #PUT THE FILE EXPORT COMMAND HERE
            cmds.select(clear = True)
            for geo in cmds.listRelatives(group_name, children = True):
                if 'geo_hrc' in geo:
                    geoGroup = str(group_name)
                    debug(app = None, method = '_publish_gpu_for_item', message = 'geoGroup: %s' % geoGroup, verbose = False)
                
            cmds.select(geoGroup)
            
            debug(app = None, method = '_publish_gpu_for_item', message = 'geoGroup: %s' % geoGroup, verbose = False)
            debug(app = None, method = '_publish_gpu_for_item', message = "gpuCache -startTime 1 -endTime 1 -optimize -optimizationThreshold 40000 -directory \"%s\" -fileName %s %s;" % (fileDir, gpuFileName, geoGroup), verbose = False)
            
            mel.eval("gpuCache -startTime 1 -endTime 1 -optimize -optimizationThreshold 40000 -directory \"%s\" -fileName %s %s;" % (fileDir, gpuFileName, geoGroup))

            print 'Finished gpu export...'
            print '====================='
            
            if cmds.objExists('dgSHD'):            
                ## Now reconnect the FileIn nodes
                for key, var in filesDict.items():
                    cmds.connectAttr('%s.outColor' % key, '%s.color' % var)
        except Exception, e:
            raise TankError("Failed to export gpu cache file")
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:60,代码来源:maya_asset_secondary_publish.py

示例3: makeShaderWithCreateNode

 def makeShaderWithCreateNode(self, shaderType ):
     # pm.createNode( shaderType )   ## For some reason, the python version of this command does not work with mip shaders... i dunno why...
     ## Use mel to make MIP shaders
     try:
         mel.eval( 'createNode "' + str(shaderType) + '";' )
     except:
         print( 'cannot create shader type:' + str(shaderType)  )        
开发者ID:joetainment,项目名称:mmmmtools,代码行数:7,代码来源:RendererProductionShadersMaker.py

示例4: enableUI

def enableUI(*args):
    # Enable viewports
    MELCommand = 'paneLayout -edit -manage true $gMainPane;'

    # Enanble only what really matters...
    UIElementNames = [
        #'Attribute Editor',
        #'Channel Box / Layer Editor',
        #'Tool Settings',
        #'Shelf',     
        'Tool Box',  
        'Time Slider',
        'Range Slider',  
        'Command Line',   
        'Help Line',
        'Status Line'                
    ]    
    
    for name in UIElementNames:
        print name
        # If not visible, toggle it's visibility
        MELCommand += """
            if (!`isUIComponentVisible("{0}")`){{
                toggleUIComponentVisibility("{0}");}}
        """.format(name)
    
    MM.eval(MELCommand)
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:27,代码来源:MuScene.py

示例5: setTool_hardSkinWeightBrush

def setTool_hardSkinWeightBrush( evt=0 ):

    appendPluginPath()
    _cmdStr =  """global string $tf_skinSmoothPatin_selection[];
    
    global proc tf_smoothBrush( string $context )     
    {       
     artUserPaintCtx -e -ic "tf_init_smoothBrush"
     -svc "tf_set_smoothBrushValue"
     -fc "" -gvc "" -gsc "" -gac "" -tcc "" $context;
    }
    
    global proc tf_init_smoothBrush( string $name )
    {
        string $sel[] = `ls -sl -fl`;
        string $obj[] = `ls -sl -o`;
        
        sgSmoothWeightCommand $obj;
    }
    
    global proc tf_set_smoothBrushValue( int $slot, int $index, float $val )             
    {         
        sgSmoothWeightCommand -h 1 -i $index -w $val;
    }
    
    ScriptPaintTool;     
    artUserPaintCtx -e -tsc "tf_smoothBrush" `currentCtx`;"""
    
    if not cmds.pluginInfo( 'sgSmoothWeightCommand', q=1, l=1 ):
        cmds.loadPlugin( 'sgSmoothWeightCommand' )
    mel.eval( _cmdStr )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:31,代码来源:__init__.py

示例6: importPose

def importPose(filePath):
    poseTip = u'通用pose文件夹找不到制定pose文件\n'
    try:
        """Import the pose data stored in filePath"""
        # try to open the file
        newRootControl = cmds.ls(sl=True, type='transform')[0]
        newNodeAttr = newRootControl.rpartition('_root_')[0]
        try: f = open(filePath, 'r')
        except:
            cmds.confirmDialog(
                t='Error', b=['OK'],
                m='Unable to open file: %s'%filePath
            )
            raise
        # uncPickle the data
        pose = cPickle.load(f)
        # close the file
        f.close()
        # set the attributes to the stored pose
        errAttrs = []
        for attrValue in pose:
            try: 
                cmds.setAttr('%s%s'%(newNodeAttr, attrValue[0]), attrValue[1])
            except:
                try: errAttrs.append(attrValue[0])
                except: errAttrs.append(attrValue)
        # display error message if needed
        if len(errAttrs) > 0:
            importErrorWindow(errAttrs)
            sys.stderr.write('Not all attributes could be loaded.')
    except:
        mel.eval('print "%s";'%poseTip)
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:32,代码来源:PoseMangers_06.py

示例7: export_static_ogre

def export_static_ogre(*args):
	export_dir = get_export_dir()
	objects = get_objects()
	ogre_mesh_files = []
	if (cmds.file(q=True, sceneName=True)==''):
		print 'Not a valid scene. Try saving it.'
		return False

	if not export_dir:
		print ("Empty Scene? unable to export.")

	else:
		print ('Export Directory:\n  %s\nOgre files\n' % export_dir)
		for ob in objects:
			name = ob
			if cmds.nodeType(ob) == 'transform':
				name = cmds.listRelatives(ob)[0]
			cmds.select(ob, r=True)
			_path = os.path.abspath( export_dir + ('/%s.mesh' % name) )
			ogre_path = _path.replace(os.sep, '/')
			# print ('select %s' % ob)
			print ('     %s' % ogre_path)

			ogre_mesh_files.append(ogre_path)
					  # 'ogreExport -sel -obj -lu mm -scale 1 -mesh \"aaa.mesh\" -shared -v -n -c -t -tangents TANGENT -tangentsplitmirrored;''
			command = 'ogreExport -sel -obj -lu mm -scale 0.1 -mesh \"%s\" -shared -n -c -t -tangents TANGENT -tangentsplitmirrored;' % ogre_path
			mm.eval(command)
		
		cmds.select(objects)
		print 'fixing materials'
		fix_xml_material_names(ogre_mesh_files)
开发者ID:adityavs,项目名称:worldforge_pipeline,代码行数:31,代码来源:wf_pipeline.py

示例8: enableaPlugin

def enableaPlugin(filename):
    extDict = {'win64':'mll','mac':'bundle','linux':'so','linux64':'so'}
    os = cmds.about(os=True)
    ext = extDict[os]
    version = cmds.about(v=True)[:4]
    pluginName = 'deltaMushToSkinCluster_%s' % version
    fileFullName = '%s.%s' % (pluginName,ext)
    rootPath = getParentPath(currentFileDirectory())
    pluginsPath = rootPath+'/plug-ins/'
    pluginFilePath = pluginsPath+fileFullName
    pluginStr = mel.eval('getenv "MAYA_PLUG_IN_PATH";')+';'+pluginsPath
    mel.eval('putenv "MAYA_PLUG_IN_PATH" "%s";' % pluginStr)
    with open(filename,'a+') as f:
        state = True
        for line in f.readlines():
            if re.findall(fileFullName,line):
                state = False
        if state:
            f.write(r'evalDeferred("autoLoadPlugin(\"\", \"%s\", \"%s\")");' % (fileFullName,pluginName))

    if not cmds.pluginInfo( pluginFilePath, query=True, autoload=True):
        cmds.pluginInfo( pluginFilePath, edit=True, autoload=True)

    if not cmds.pluginInfo(pluginFilePath,query=True,loaded=True):
        cmds.loadPlugin(pluginFilePath)
开发者ID:jeanim,项目名称:deltaMushToSkinCluster,代码行数:25,代码来源:dm2scSetup.py

示例9: mkIngestionDir

def mkIngestionDir(source,type):
	mkFile = source
	filename =source.split("/")
	filename = filename[-1]
	mkSource =source.split("/")
	mkSource = mkSource[-1]
	mkSource = mkSource.replace( type, "" )
	mkFolder =source.split("/")
	mkFolder.pop(-1)
	mkFolder = "/".join(mkFolder)
	mkFolder=mkFolder+"/"+mkSource
	if os.path.exists( mkFolder ) == False:
		os.makedirs( mkFolder )
	copycmd = 'sysFile -copy'+' '+'"'+mkFolder+'/'+ filename +'"'+' ' + '"'+ mkFile+'"'+';'
	mel.eval (copycmd)
	dst = "Q:/Tools/Nearline/ingestion/3dModels"
	delcmd = 'sysFile -delete'+' "'+mkFile+'";'
	mel.eval (delcmd)
	createdirCmd = 'sysFile -makeDir'+' '+'"'+dst+'/' +mkSource+'/"'
	mel.eval(createdirCmd)
	cpyDepotCmd = 'sysFile -mov'+' '+'"'+dst+'/' +mkSource+'/'+filename +'"'+' ' + '"'+mkFolder+'/'+ filename +'"'+';'
	mel.eval (cpyDepotCmd)
	print "copied "+filename+" to depot"
	removeEmptydir = 'sysFile -removeEmptyDir'+' '+'"'+mkFolder+'/";'
	mel.eval (removeEmptydir)
	cmds.confirmDialog(m=filename+" ready for upload", cb = "cancel")
	return mkFolder
开发者ID:ghost3d,项目名称:MayaTools,代码行数:27,代码来源:mkSaveToDepotVray.py

示例10: sourceMelFolderContents

def sourceMelFolderContents(path):
    '''
    source all mel files in a given folder
    '''
    for script in [f for f in os.listdir(path) if f.lower().endswith('.mel')]:
        log.info('Sourcing mel script : %s' % script)
        mel.eval('source %s' % script)
开发者ID:xavMikeHoward,项目名称:Red9_StudioPack,代码行数:7,代码来源:setup.py

示例11: test_nameTooShort

 def test_nameTooShort(self):
     class ShortFuncCls(object):
         def go(self):
             return 'Manitoba'
     self.wrapClass(ShortFuncCls, 'myShort')
     self.assertEqual(mel.eval('''myShort -goxx'''), 'Manitoba')
     self.assertEqual(mel.eval('''myShort -g'''), 'Manitoba')
开发者ID:LumaPictures,项目名称:pymel,代码行数:7,代码来源:test_py2mel.py

示例12: setup_scene

def setup_scene(name=sys.argv[1]):
    # imports shirt, scales to fit, converts to ncloth
    try:
        cmds.loadPlugin("objExport")
    except:
        pass
    mel.eval('file -f -options "mo=1" -ignoreVersion -typ "OBJ" -o "%s";' \
         % name)
    try:
        mel.eval('rename "Mesh" "shirt";')
    except:
        pass
    # scale shirt to fit
    create_table()
    if (fold_num == 0):
        bbx = cmds.xform("shirt", q=True, bb=True, ws=True)
        s_x_len = abs(bbx[3] - bbx[0])
        s_y_len = abs(bbx[4] - bbx[1])
        global GLOBAL_SCALE
        if (s_x_len >= s_y_len):
            GLOBAL_SCALE = s_x_len/(SHIRT_SCALE * TABLE_SIZE)
        else:
            GLOBAL_SCALE = s_y_len/(SHIRT_SCALE * TABLE_SIZE)
        cmds.select("shirt")
        cmds.move(0, 0.0001, 0, relative = True)
    cmds.scale(GLOBAL_SCALE, GLOBAL_SCALE, GLOBAL_SCALE, "table", centerPivot = True)
    shirt_to_nCloth()
    create_camera()
开发者ID:wenlongx,项目名称:Maya-Cloth-Simulation,代码行数:28,代码来源:main_backup.py

示例13: load

def load():
    '''loads animation environment'''
    print "loading animation environment presets..."
    #set autoKey
    cmds.autoKeyframe( state=True )
    #set 24fps and playback on all viewports
    cmds.playbackOptions(ps=1.0, v='all')
    #set unlimited undo's
    cmds.undoInfo( state=True, infinity=True )
    #set manipulator sizes
    if lib.checkAboveVersion(2014):
        cmds.manipOptions( r=False, hs=55, ls=4, sph=1 )
    else:
        cmds.manipOptions( r=False, hs=55, ls=4 )
    #set framerate visibility
    mel.eval("setFrameRateVisibility(1);")
    #gimbal rotation
    cmds.manipRotateContext('Rotate', e=True, mode=2)
    #world translation
    cmds.manipMoveContext('Move', e=True, mode=2)
    #time slider height
    aPlayBackSliderPython = mel.eval('$tmpVar=$gPlayBackSlider')
    cmds.timeControl(aPlayBackSliderPython, h=45, e=True);
    #special tick color
    cmds.displayRGBColor("timeSliderTickDrawSpecial", 1,0.5,0)

    #check if hotkeys have been set
    if (cmds.hotkey( 't', ctl=True, query=True, name = True)== 'CharacterAnimationEditorNameCommand'):
        print "Hotkeys have been previously loaded"
    else:
        setHotkeys('default')

    print "ENVIRONMENT SET\n", #the comma forces output on the status line
开发者ID:studiocoop,项目名称:maya-coop,代码行数:33,代码来源:animEnvironment.py

示例14: 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

示例15: setRecentFile

def setRecentFile(fileName):
    attr='mayaBinary'
    if fileName.split('.')[-1] == 'ma':
        attr='mayaAscii'

    melstr = 'addRecentFile("%s", "%s")' % (fileName, attr)
    mel.eval(melstr)
开发者ID:kuzubov,项目名称:maya_python_scripts,代码行数:7,代码来源:mayaMainBtns.py


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