本文整理汇总了Python中maya.cmds.about函数的典型用法代码示例。如果您正苦于以下问题:Python about函数的具体用法?Python about怎么用?Python about使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了about函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: enableBordersHighlight
def enableBordersHighlight(self, *args):
'''
'''
if cmds.objExists(self._IScontextTool._mVoroObject):
bEnabled = cmds.checkBox(self._ISborderEdgesCbx, query = True, value = True)
if bEnabled:
if int(cmds.about(version = True).split()[0]) < 2016:
mDisplay = cmds.listRelatives(self._IScontextTool._mVoroDisplay[0], fullPath = True)[1]
cmds.setAttr(mDisplay + '.overrideEnabled', False)
aShapes = cmds.listRelatives(self._IScontextTool._mVoroObject, children = True, shapes = True, type = 'mesh', f = True)
if aShapes:
self._IScontextTool._mDisplayType = cmds.attributeQuery('displayEdges', node = aShapes[0], max = True)[0] # Depending on Maya Version Max Number can be 2 or 3
else:
self._IScontextTool._mDisplayType = 2
else:
if int(cmds.about(version = True).split()[0]) < 2016:
mDisplay = cmds.listRelatives(self._IScontextTool._mVoroDisplay[0], fullPath = True)[1]
cmds.setAttr(mDisplay + '.overrideEnabled', True)
self._IScontextTool._mDisplayType = 1
try:
if cmds.objExists(self._IScontextTool._mVoroDisplay[0]):
mVoroDisplayShape = cmds.listRelatives(self._IScontextTool._mVoroDisplay[0], fullPath = True)[1]
cmds.setAttr(mVoroDisplayShape + '.displayEdges', self._IScontextTool._mDisplayType)
except:
pass
示例2: 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)
示例3: printTopExceptionForDebug
def printTopExceptionForDebug(error_stack_frames):
'''
Prints top-down unhandled exception info generated by MRT. To be used for debugging.
'''
# Collect maya/os info.
debugInfoTxt = '\n\n{0} MRT ERROR/EXCEPTION OCCURRED {0}'.format('*'*40)
debugInfoTxt += '\n%s(Please use the text below for sending error messages)\n' % ('\t'*7)
debugInfoTxt += '\nMRT VERSION: %s' % _mrt_version
debugInfoTxt += '\nMAYA VERSION: %sx%s' % (cmds.about(version=True), 64 if cmds.about(is64=True) else 32)
debugInfoTxt += '\nOS: %s' % cmds.about(os=True)
debugInfoTxt += '\nPY VERSION: %s' % platform.python_version()
debugInfoTxt += '\n\nEXCEPTION DATA (SOURCE TOP DOWN):-\n'
# Collect info for each error stack trace, from top down.
for e_frame in error_stack_frames[-1::-1]:
e_frame_info = traceback.extract_stack(e_frame, 1)[0]
debugInfoTxt += '\nSOURCE: %s\nLINE: %s\nFRAME: "%s"\nAT: "%s"\nLOCALS:' % (e_frame_info[0], e_frame_info[1], e_frame_info[2], e_frame_info[3])
local_items = e_frame.f_locals.items()
if local_items:
for key, value in local_items:
debugInfoTxt += '\n%30s = %s' % (key, value)
else:
debugInfoTxt += 'None'
debugInfoTxt += '\n'
return debugInfoTxt
示例4: fileDialog2_openDirInExplorer
def fileDialog2_openDirInExplorer(self, *args):
ctrlName = long(self.MQtUtil.findControl('QFileDialog'))
qObj = self.wrapInstance(ctrlName, self.QtGui.QFileDialog)
dirPath = qObj.directory().path()
if cmds.about(macOS= 1):
subprocess.Popen(['open', '--', dirPath])
if cmds.about(linux= 1):
subprocess.Popen(['xdg-open', '--', dirPath])
if cmds.about(windows= 1):
os.startfile(dirPath)
示例5: loadStringResourcesForModule
def loadStringResourcesForModule( moduleName ):
"""
Load the string resources associated with the given module
Note that the argument must be a string containing the full name of the
module (eg "maya.app.utils"). The module of that name must have been
previously imported.
The base resource file is assumed to be in the same location as the file
defining the module and will have the same name as the module except with
_res.py appended to it. So, for the module foo, the resource file should
be foo_res.py.
If Maya is running in localized mode, then the standard location for
localized scripts will also be searched (the location given by the
command cmds.about( localizedResourceLocation=True ))
Failure to find the base resources for the given module will trigger an
exception. Failure to find localized resources is not an error.
"""
try:
module = sys.modules[moduleName]
except:
raise RuntimeError( 'Failed to load base string resources for module %s because it has not been imported' % moduleName )
modulePath, moduleFileName = os.path.split( module.__file__ )
moduleName, extension = os.path.splitext( moduleFileName )
resourceFileName = moduleName + '_res.py'
# Try to find the base version of the file next to the module
try:
baseVersionPath = os.path.join( modulePath, resourceFileName )
execfile( baseVersionPath, {} )
except:
raise RuntimeError( 'Failed to load base string resources for module %s' % moduleName )
if cmds.about( uiLanguageIsLocalized=True ):
scriptPath = cmds.about( localizedResourceLocation=True )
if scriptPath != '':
localizedPath = os.path.join( scriptPath, 'scripts', resourceFileName )
try:
execfile( localizedPath, {} )
# We don't generate any warnings or errors if localized
# file is not there
# TODO: we could consider issuing a warning in debug mode
except IOError:
pass
except Exception, err:
raise RuntimeError( 'Unexpected error encountered when attempting to load localized string resources for module %s: %s' % (moduleName,err) )
示例6: env_from_sql
def env_from_sql(table_location,initial_vars):
print "\n============================================================\n"
print " GLOBAL VARIABLE SETTING INITIALIZED \n\nRunning SQL ENV Var Settings from '%s'\n"%(table_location)
# Retrieve Version String
version = mc.about(v=1)
# Retrieve Mode
batch = mc.about(b=1)
print "\n Maya Version Detected as %s"%(version)
if batch ==1:
mode = 'BATCH'
print " Maya Running in Batch Mode"
else:
mode = 'GUI'
print " Maya is Running in GUI Mode"
# Pass Vars to SQL and retrieve Vals
print "\n Retrieving variables for Version = '",version,"'","\n Mode = '",mode,"'"
# Get Strings from SQL Table for version of Maya
returned_new_envs = sql_handle(version,mode,table_location)
print "\n ....Variables Retrieved"
# Conglomerate Strings from existing Envs
vars_to_set = conglomerate_vars(returned_new_envs)
print " ....Variables Conglomerated Setting "
# Print Vars
print_vars(vars_to_set)
# Set Vars
set_env_vars(vars_to_set)
print "\n Completed ENV Setting"
print "\n=============================================================="
print " LOADING APPROPRIATE PLUG-INS \n\nRunning SQL Plugin Var Settings from '%s'\n"%(table_location)
# Pass Vars to SQL and retrieve Vals
print "\n Retrieving Loadable Plug-ins for Version = '",version,"'","\n Mode = '",mode,"'"
plugins_loadable = sql_plugin_handle(version,mode,table_location)
print "\n ...Retrieved Loadable Plug-ins "
load_plugins_status = load_plugins(plugins_loadable)
print "\n=============================================================="
示例7: returnMayaInfo
def returnMayaInfo():
mayaInfoDict = {}
mayaInfoDict['year'] = mc.about(file=True)
mayaInfoDict['qtVersion'] = mc.about(qtVersion=True)
mayaInfoDict['version'] = mc.about(version=True)
mayaInfoDict['apiVersion'] = mc.about(apiVersion=True)
mayaInfoDict['product'] = mc.about(product=True)
mayaInfoDict['qtVersion'] = mc.about(qtVersion=True)
mayaInfoDict['environmentFile'] = mc.about(environmentFile=True)
mayaInfoDict['operatingSystem'] = mc.about(operatingSystem=True)
mayaInfoDict['operatingSystemVersion'] = mc.about(operatingSystemVersion=True)
mayaInfoDict['currentTime'] = mc.about(currentTime=True)
mayaInfoDict['currentUnit'] = mc.currentUnit(q=True,linear=True)
return mayaInfoDict
示例8: renderLogCallback
def renderLogCallback(line):
if "Writing image" in line:
imageName = line.split("\"")[-2]
# Display the render
if not cmds.about(batch=True):
MitsubaRendererUI.showRender(imageName)
示例9: initPlugin
def initPlugin(invert=False):
pluginFolder = cmds.about(preferences=True) + "/modules/<pluginName>"
if not invert:
if not pluginFolder in sys.path: sys.path.append(pluginFolder)
else:
if pluginFolder in sys.path: sys.path.remove(pluginFolder)
示例10: __init__
def __init__(self):
self.dGlobals = {}
self.dMasterRenderGlobals = {}
self.lstLayers = []
self.sCurrentLayer = ""
self.oCurrentLayer = None
self.sMasterLayer = "masterLayer"
self.bIsFirstRun = False
self.lstSelection = []
# Get the Maya version as a integer
self.iMayaVersion = int(re.search("\d+", mc.about(v=True)).group())
self.reloadEngines()
self.out = libOutput.Output(self)
self.utils = libUtils.Utils()
self.node = libNode.Node()
self.reIsLight = re.compile("Light$")
self.reload()
# Post actions that have to take place after the initialization of above classes
self.selectLayer(self.node.selected())
示例11: getMayaVersion
def getMayaVersion():
'''
returns maya version (use Utils.MAYA* constants for comparision of a returned result)
currently uses "about -v" string parsing
'''
if Utils.CURRENT_MAYA_VERSION is None:
version = cmds.about(v=True)
Utils.CURRENT_MAYA_VERSION = Utils.MAYA_UNKNOWN_VERSION
def testVersion(search,result):
if search in version:
Utils.CURRENT_MAYA_VERSION = result
return True
return False
testVersion('2011', Utils.MAYA2011) or \
testVersion('2012', Utils.MAYA2012) or \
testVersion('2013', Utils.MAYA2013) or \
testVersion('2014', Utils.MAYA2014) or \
testVersion('2015', Utils.MAYA2015) or \
testVersion('2016', Utils.MAYA2016)
return Utils.CURRENT_MAYA_VERSION
示例12: clearCallbacks
def clearCallbacks():
if cmds.about(batch=True):
return
try:
cmds.callbacks(clearAllCallbacks=True, owner="arnold")
except:
pass
示例13: __init__
def __init__(self, title, *args, **kwargs ):
QWidget.__init__( self, *args )
self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_loadJoints_%s.txt" % title
sgCmds.makeFile( self.infoPath )
layout = QVBoxLayout( self ); layout.setContentsMargins(0,0,0,0)
groupBox = QGroupBox( title )
layout.addWidget( groupBox )
baseLayout = QVBoxLayout()
groupBox.setLayout( baseLayout )
listWidget = QListWidget()
hl_buttons = QHBoxLayout(); hl_buttons.setSpacing( 5 )
b_addSelected = QPushButton( "Add Selected" )
b_clear = QPushButton( "Clear" )
hl_buttons.addWidget( b_addSelected )
hl_buttons.addWidget( b_clear )
baseLayout.addWidget( listWidget )
baseLayout.addLayout( hl_buttons )
self.listWidget = listWidget
QtCore.QObject.connect( listWidget, QtCore.SIGNAL( "itemClicked(QListWidgetItem*)" ), self.selectJointFromItem )
QtCore.QObject.connect( b_addSelected, QtCore.SIGNAL("clicked()"), self.addSelected )
QtCore.QObject.connect( b_clear, QtCore.SIGNAL( "clicked()" ), self.clearSelected )
self.otherWidget = None
self.loadInfo()
示例14: _install_maya
def _install_maya(use_threaded_wrapper):
"""Helper function to Autodesk Maya support"""
from maya import utils, cmds
def threaded_wrapper(func, *args, **kwargs):
return utils.executeInMainThreadWithResult(
func, *args, **kwargs)
sys.stdout.write("Setting up Pyblish QML in Maya\n")
if use_threaded_wrapper:
register_dispatch_wrapper(threaded_wrapper)
if cmds.about(version=True) == "2018":
_remove_googleapiclient()
app = QtWidgets.QApplication.instance()
if not _is_headless():
# mayapy would have a QtGui.QGuiApplication
app.aboutToQuit.connect(_on_application_quit)
# acquire Maya's main window
_state["hostMainWindow"] = {
widget.objectName(): widget
for widget in QtWidgets.QApplication.topLevelWidgets()
}["MayaWindow"]
_set_host_label("Maya")
示例15: arnoldBatchRenderOptionsString
def arnoldBatchRenderOptionsString():
origFileName = cmds.file(q=True, sn=True)
if not cmds.about(batch=True):
silentMode = 0
try:
silentMode = int(os.environ["MTOA_SILENT_MODE"])
except:
pass
if silentMode != 1:
dialogMessage = "Are you sure you want to start a potentially long task?"
if platform.system().lower() == "linux":
dialogMessage += " (batch render on linux cannot be stopped)"
ret = cmds.confirmDialog(
title="Confirm",
message=dialogMessage,
button=["Yes", "No"],
defaultButton="Yes",
cancelButton="No",
dismissString="No",
)
if ret != "Yes":
raise Exception("Stopping batch render.")
try:
port = core.MTOA_GLOBALS["COMMAND_PORT"]
return ' -r arnold -ai:ofn \\"' + origFileName + '\\" -ai:port %i ' % port
except:
return ' -r arnold -ai:ofn \\"' + origFileName + '\\" '