本文整理汇总了Python中maya.mel.eval方法的典型用法代码示例。如果您正苦于以下问题:Python mel.eval方法的具体用法?Python mel.eval怎么用?Python mel.eval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maya.mel
的用法示例。
在下文中一共展示了mel.eval方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_active_scene
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def parse_active_scene():
"""Parse active scene for arguments for capture()
*Resolution taken from render settings.
"""
time_control = mel.eval("$gPlayBackSlider = $gPlayBackSlider")
return {
"start_frame": cmds.playbackOptions(minTime=True, query=True),
"end_frame": cmds.playbackOptions(maxTime=True, query=True),
"width": cmds.getAttr("defaultResolution.width"),
"height": cmds.getAttr("defaultResolution.height"),
"compression": cmds.optionVar(query="playblastCompression"),
"filename": (cmds.optionVar(query="playblastFile")
if cmds.optionVar(query="playblastSaveToFile") else None),
"format": cmds.optionVar(query="playblastFormat"),
"off_screen": (True if cmds.optionVar(query="playblastOffscreen")
else False),
"show_ornaments": (True if cmds.optionVar(query="playblastShowOrnaments")
else False),
"quality": cmds.optionVar(query="playblastQuality"),
"sound": cmds.timeControl(time_control, q=True, sound=True) or None
}
示例2: doControlAction
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def doControlAction(self, destinationList, *args):
""" Action to do when creating a control
Do action as user wants:
1 = New control
2 = Add shape
3 = Replace shapes
"""
if self.cvAction == 1: #new control
pass
else:
if destinationList:
if self.cvAction == 2: #add shape
self.ctrls.transferShape(True, False, self.cvCurve, destinationList, True)
elif self.cvAction == 3: #replace shapes
self.ctrls.transferShape(True, True, self.cvCurve, destinationList, True)
else:
cmds.delete(self.cvCurve)
mel.eval("warning \""+self.langDic[self.langName]['e011_notSelShape']+"\";")
示例3: dpMain
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def dpMain(self, *args):
""" Main function.
Check existen nodes and call the scripted function.
"""
callAction = False
self.allGrp = self.dpFindAllGrpBySelection()
if self.allGrp:
callAction = True
else:
allGrpList = self.dpCountAllGrp()
if allGrpList:
if len(allGrpList) > 1:
self.allGrp = cmds.confirmDialog(title=self.langDic[self.langName]["m166_selAllControls"], message=self.langDic[self.langName]["m168_wichAllGrp"], button=allGrpList)
else:
self.allGrp = self.dpCheckAllGrp(self.allGrp)
if self.allGrp:
callAction = True
else:
self.allGrp = self.dpFindAllGrp()
if self.allGrp:
callAction = True
if callAction:
self.dpSelectAllCtrls(self.allGrp)
else:
mel.eval("warning \""+self.langDic[self.langName]["e019_notFoundAllGrp"]+"\";")
示例4: dpLoadBSNode
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def dpLoadBSNode(self, *args):
""" Load selected object as blendShapeNode
"""
selectedList = cmds.ls(selection=True)
if selectedList:
if cmds.objectType(selectedList[0]) == "blendShape":
cmds.textField(self.bsNodeTextField, edit=True, text=selectedList[0])
self.dpLoadBSTgtList(selectedList[0])
self.bsNode = selectedList[0]
elif cmds.objectType(selectedList[0]) == "transform":
meshList = cmds.listRelatives(selectedList[0], children=True, shapes=True, noIntermediate=True, type="mesh")
if meshList:
bsNodeList = cmds.listConnections(meshList[0], type="blendShape")
if bsNodeList:
self.dpLoadBSTgtList(bsNodeList[0])
self.bsNode = bsNodeList[0]
else:
mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";")
else:
mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";")
else:
mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";")
else:
mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";")
示例5: dpLoadGeoToAttach
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def dpLoadGeoToAttach(self, geoName=None, geoFromUI=None, *args):
""" Load selected object a geometry to attach rivet.
"""
if geoName:
selectedList = [geoName]
elif geoFromUI:
selectedList = [cmds.textField(self.geoToAttachTF, query=True, text=True)]
else:
selectedList = cmds.ls(selection=True)
if selectedList:
if self.dpCheckGeometry(selectedList[0]):
self.geoToAttach = selectedList[0]
cmds.textField(self.geoToAttachTF, edit=True, text=self.geoToAttach)
self.dpLoadUVSet(self.geoToAttach)
else:
mel.eval("warning \"Select a geometry in order use it to attach rivets, please.\";")
示例6: dpCheckGeometry
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def dpCheckGeometry(self, item, *args):
isGeometry = False
if item:
if cmds.objExists(item):
childList = cmds.listRelatives(item, children=True)
if childList:
self.itemType = cmds.objectType(childList[0])
if self.itemType == "mesh" or self.itemType == "nurbsSurface":
if self.itemType == "mesh":
self.meshNode = childList[0]
isGeometry = True
else:
mel.eval("warning \""+item+" is not a geometry.\";")
else:
mel.eval("warning \"Select the transform node instead of "+item+" shape, please.\";")
else:
mel.eval("warning \""+item+" does not exists, maybe it was deleted, sorry.\";")
else:
mel.eval("warning \"Not found "+item+"\";")
return isGeometry
示例7: verifyGuideModuleIntegrity
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def verifyGuideModuleIntegrity(self, *args):
""" This function verify the integrity of the current module.
Returns True if Ok and False if Fail.
"""
# conditionals to be elegible as a rigged guide module:
if cmds.objExists(self.moduleGrp):
if cmds.objExists(self.moduleGrp+'.guideBase'):
if cmds.getAttr(self.moduleGrp+'.guideBase') == 1:
return True
else:
try:
self.deleteModule()
mel.eval('warning \"'+ self.langDic[self.langName]['e000_GuideNotFound'] +' - '+ self.moduleGrp +'\";')
except:
pass
return False
示例8: global_reload
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def global_reload():
""" filter all loaded spore modules in the script dir and
reload each of them. this is a convenience function for developing """
import inspect
windowed = mel.eval('$temp1=$gMainWindow')
if windowed:
scripts_dir = os.path.dirname(__file__)
for key, module in sys.modules.iteritems():
try:
module_path = inspect.getfile(module)
except TypeError:
continue
if module_path == __file__:
continue
if module_path.startswith(scripts_dir):
reload(module)
示例9: __init__
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def __init__(self):
# set environment
self.set_environment()
# initialize global services
self.spore_globals = settings.SporeGlobals()
# initialize ui only in gui mode
windowed = mel.eval('$temp1=$gMainWindow')
if windowed:
self.spore_manager = manager.SporeManager()
self.spore_reporter = reporter.Reporter()
# self.spore_globals = self.parse_prefs()
self.logger = self.get_logger()
self.menu = self.build_menu()
self.callbacks = self.add_callbacks()
self.set_tracking_dir()
示例10: getChannelBoxMenu
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def getChannelBoxMenu():
"""
Get ChannelBox, convert the main channel box to QT and return the QMenu
which is part of the channel box' children.
:return: Maya's main channel box menu
:rtype: QMenu
"""
channelBox = getChannelBox()
for child in channelBox.children():
if type(child) == QMenu:
cmd = "generateChannelMenu {0} 1".format(qtToMaya(child))
mel.eval(cmd)
return child
# ----------------------------------------------------------------------------
示例11: __init__
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def __init__(self, total, message=None):
# set numeration variables
self._value = 0
self._total = total
self._message = message
# get progress bar
self._bar = None
self._batch = cmds.about(batch=True)
if not self._batch:
self._bar = mel.eval("$tmp = $gMainProgressBar")
cmds.progressBar(
self._bar,
edit=True,
isInterruptable=False,
status=self.message,
minValue=0,
maxValue=total
)
示例12: shelf
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def shelf():
"""
Add a new shelf in Maya with all the tools that are provided in the
SHELF_TOOLS variable. If the tab exists it will be deleted and re-created
from scratch.
"""
# get top shelf
gShelfTopLevel = mel.eval("$tmpVar=$gShelfTopLevel")
# get top shelf names
shelves = cmds.tabLayout(gShelfTopLevel, query=1, ca=1)
# delete shelf if it exists
if SHELF_NAME in shelves:
cmds.deleteUI(SHELF_NAME)
# create shelf
cmds.shelfLayout(SHELF_NAME, parent=gShelfTopLevel)
# add modules
for tool in SHELF_TOOLS:
if tool.get("image1"):
cmds.shelfButton(style="iconOnly", parent=SHELF_NAME, **tool)
else:
cmds.shelfButton(style="textOnly", parent=SHELF_NAME, **tool)
示例13: loadUiType
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def loadUiType(uiFile):
"""
Pyside lacks the "loadUiType" command, so we have to convert the ui file to py code in-memory first
and then execute it in a special frame to retrieve the form_class.
http://tech-artists.org/forum/showthread.php?3035-PySide-in-Maya-2013 (ChrisE)
"""
parsed = xml.parse(uiFile)
widget_class = parsed.find('widget').get('class')
form_class = parsed.find('class').text
with open(uiFile, 'r') as f:
o = StringIO()
frame = {}
pysideuic.compileUi(f, o, indent=0)
pyc = compile(o.getvalue(), '<string>', 'exec')
exec pyc in frame
#Fetch the base_class and form class based on their type in the xml from designer
form_class = frame['Ui_%s'%form_class]
base_class = eval('QtWidgets.%s'%widget_class)
return form_class, base_class
示例14: getStatusLine
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def getStatusLine():
"""
Get the QWidget of Maya's status line.
:return: QWidget of Maya's status line
:rtype: QWidget
"""
gStatusLine = mel.eval("$tmpVar=$gStatusLine")
return mayaToQT(gStatusLine)
# ----------------------------------------------------------------------------
示例15: dpAddSelect
# 需要导入模块: from maya import mel [as 别名]
# 或者: from maya.mel import eval [as 别名]
def dpAddSelect(self, *args):
""" Add selected items to target textscroll list
"""
# declare variables
selMeshList = []
# get selection
selList = cmds.ls(selection=True)
# check if there is any selected object in order to continue
if selList:
# find meshes transforms
for item in selList:
if not item in selMeshList:
if self.dpCheckGeometry(item):
selMeshList.append(item)
else:
return
if selMeshList:
# get current list
currentList = cmds.textScrollList(self.targetScrollList, query=True, allItems=True)
if currentList:
# clear current list
cmds.textScrollList(self.targetScrollList, edit=True, removeAll=True)
# avoid repeated items
for item in selMeshList:
if not item in currentList:
currentList.append(item)
# refresh textScrollList
cmds.textScrollList(self.targetScrollList, edit=True, append=currentList)
else:
# add selected items in the empyt target scroll list
cmds.textScrollList(self.targetScrollList, edit=True, append=selMeshList)
else:
mel.eval("warning \""+self.langDic[self.langName]["i055_tgtSelect"]+"\";")
else:
mel.eval("warning \""+self.langDic[self.langName]["i055_tgtSelect"]+"\";")