本文整理汇总了Python中maya.mel.eval函数的典型用法代码示例。如果您正苦于以下问题:Python eval函数的具体用法?Python eval怎么用?Python eval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eval函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: main
def main(centerCurrentTime=False):
'''
Replacement command for "fitPanel -selected"
If graph editor has focus, run frameGraphEditor, otherwise default to fitPanel -selected mel command.
'''
if not frameGraphEditor(centerCurrentTime=centerCurrentTime):
mm.eval("fitPanel -selected")
开发者ID:Italic-,项目名称:maya-prefs,代码行数:7,代码来源:ml_frameGraphEditor.py
示例17: getFileName
def getFileName():
base = studioBase.StudioSQL()
loadType = {'Load saved reference load state':'',
'Load all references':'all',
'Load top-level references only':'topOnly',
'Load no references':'none'}
fileData = mop.OpenDialog.openFile()
if fileData[0] and fileData[1] and fileData[2]:
fileName = fileData[1] + '/' + fileData[2]
else:
return False
ref = loadType[fileData[3]]
selective = fileData[4]
print('filename', fileName, ref, 'selective', selective, fileData)
base.setAction('open', fileName)
if selective:
cmds.file(fileName, open=True, buildLoadSettings=True )
num = cmds.selLoadSettings( q=True, numSettings=True)
cmds.optionVar(sv=('preloadRefEdTopLevelFile', fileName))
mel.eval('PreloadReferenceEditor')
else:
if ref:
cmds.file(fileName, o=True, f=True, lrd=ref)
else:
cmds.file(fileName, o=True, f=True)
setRecentFile(fileName)
return True
开发者ID:kuzubov,项目名称:maya_python_scripts,代码行数:34,代码来源:mayaMainBtns.py
示例18: open_scene
def open_scene(*args):
'''
Function to open a new scene file and reload the tool
'''
mel.eval('OpenScene;')
import threeDF_script
threeDF_script.gui()
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:7,代码来源:threeDF_rig_check_v011.py
示例19: stateFromFileInfo
def stateFromFileInfo():
from fnmatch import fnmatch
selInfo = m.fileInfo('onSaveSelection', q=1)
if len(selInfo) != 0:
sel = []
for i in selInfo[0].split('?'):
if m.objExists(i):
sel.append(i)
if len(sel):
m.select(sel)
hilite = []
c1 = ['f[*','e[*','map[*','vtx[*','vtxFace[*']
c2 = ['facet','edge','puv','vertex','pvf']
for x in sel:
if x.count('.'):
parts = x.split('.')
for i in range(5):
if fnmatch(parts[1],c1[i]) and parts[0] not in hilite:
hilite.append(parts[0])
mel.eval('doMenuComponentSelection("' + parts[0] + '", "' + c2[i] + '");')
ctxInfo = m.fileInfo('onSaveCtx', q=1)
if len(ctxInfo) != 0:
print ('ctxInfo: ' + str(ctxInfo))
try:
m.setToolTo(ctxInfo[0])
except:
print 'could not set "' + ctxInfo[0] + '"!'
开发者ID:ewerybody,项目名称:melDrop,代码行数:29,代码来源:scene.py
示例20: import_hierarchy_geo
def import_hierarchy_geo(self):
"""Import all the obj objects"""
file_info = self.geo_file_info
for self.current_target in file_info.keys():
cmds.file(file_info[self.current_target],
rpr="PKD_Temp",
i=1,
type="OBJ",
loadReferenceDepth="all",
ra=True,
mergeNamespacesOnClash=False,
options="mo=1")
# Delete Existing geo if it exists
if not self.cleansing_mode:
if pm.objExists(self.current_target):
pm.delete(self.current_target)
logger.info("Importing\n%s" % file_info[self.current_target])
if self.cleansing_mode:
os.remove(file_info[self.current_target])
for top in pm.ls(assemblies=True, ud=True):
if top.getShape():
if top.getShape().type() == "mesh" and top.name() == "PKD_Temp_Mesh":
top.rename(self.current_target)
pm.select(self.current_target)
mel.eval("polySetToFaceNormal")
mel.eval("polySoftEdge -a 180 -ch 1 %s" % self.current_target)
pm.delete(self.current_target, ch=1)
pm.refresh()
self.update_progress()
开发者ID:pritishd,项目名称:PKD_Tools,代码行数:29,代码来源:libGeo.py
注:本文中的maya.mel.eval函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论