本文整理汇总了Python中maya.cmds.about函数的典型用法代码示例。如果您正苦于以下问题:Python about函数的具体用法?Python about怎么用?Python about使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了about函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:jeffhong21,项目名称:scripts,代码行数:32,代码来源:IShatterGUI.py
示例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)
开发者ID:jeanim,项目名称:deltaMushToSkinCluster,代码行数:25,代码来源:dm2scSetup.py
示例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
开发者ID:animformed,项目名称:mrt,代码行数:31,代码来源:mrt_errorHandle.py
示例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)
开发者ID:davidpower,项目名称:MayaSceneTool,代码行数:12,代码来源:SceneTools_PySide.py
示例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) )
开发者ID:NicoMaya,项目名称:pymel,代码行数:50,代码来源:utils.py
示例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=============================================================="
开发者ID:priceeeee,项目名称:tool_setup,代码行数:49,代码来源:setup_loader.py
示例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
开发者ID:Italic-,项目名称:maya-prefs,代码行数:15,代码来源:search.py
示例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)
开发者ID:hpd,项目名称:MitsubaForMaya,代码行数:7,代码来源:MitsubaRenderer.py
示例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)
开发者ID:esernaalonso,项目名称:dev,代码行数:7,代码来源:pluginTemplate.py
示例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())
开发者ID:SolenOchHavet,项目名称:sandwich,代码行数:25,代码来源:libMain.py
示例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
开发者ID:leandropim,项目名称:Tapp,代码行数:27,代码来源:utils.py
示例12: clearCallbacks
def clearCallbacks():
if cmds.about(batch=True):
return
try:
cmds.callbacks(clearAllCallbacks=True, owner="arnold")
except:
pass
开发者ID:Quazo,项目名称:breakingpoint,代码行数:7,代码来源:rendererCallbacks.py
示例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()
开发者ID:jonntd,项目名称:mayadev-1,代码行数:35,代码来源:fingerWeightCopy.py
示例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")
开发者ID:mottosso,项目名称:pyblish-qml,代码行数:29,代码来源:host.py
示例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 + '\\" '
开发者ID:Quazo,项目名称:breakingpoint,代码行数:28,代码来源:arnoldRender.py
示例16: SGMPlugMod01Command_markingMenu_defaultMenu
def SGMPlugMod01Command_markingMenu_defaultMenu( parentName ):
modeFilePath = uiInfoPath = cmds.about(pd=True) + "/sg/sg_toolInfo/SGMPlugMod01.txt"
SGMPlugMod01_file.makeFile( modeFilePath )
f = open( modeFilePath, 'r' )
data = f.read()
f.close()
if not data:
mel.eval( "SGMPlugMod01Command -sym 0" )
f = open( modeFilePath, 'w' )
f.write( 'False' )
f.close()
SGMPlugMod01_markingMenuCmd.mirrorValue = 0
else:
if data == 'True':
mel.eval( "SGMPlugMod01Command -sym 1" )
SGMPlugMod01_markingMenuCmd.mirrorValue = 1
else:
mel.eval( "SGMPlugMod01Command -sym 0" )
SGMPlugMod01_markingMenuCmd.mirrorValue = 0
cmds.menuItem( "Symmetry X", cb=SGMPlugMod01_markingMenuCmd.mirrorValue, rp="N", c=SGMPlugMod01_markingMenuCmd.symmetryXOn, p=parentName )
cmds.menuItem( l="Average", p=parentName, sm=1, rp='NW' )
cmds.menuItem( l="Average Normal", rp="NW", c = SGMPlugMod01_markingMenuCmd.averageNormal )
cmds.menuItem( l="Average Vertex", rp="W", c = SGMPlugMod01_markingMenuCmd.averageVertex )
cmds.menuItem( l="Delete History", p = parentName, c = SGMPlugMod01_markingMenuCmd.deleteHistory )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:28,代码来源:execfunction.py
示例17: isAnimation
def isAnimation(self):
animation = cmds.getAttr("defaultRenderGlobals.animation")
if not cmds.about(batch=True) and animation:
print( "Animation isn't currently supported outside of Batch mode. Rendering current frame." )
animation = False
mayaReleasePythonGIL = os.environ.get('MAYA_RELEASE_PYTHON_GIL')
mayaVersion = float(cmds.about(version=True))
if mayaVersion >= 2016 and not mayaReleasePythonGIL:
print( "\n\n\n\n")
print( "For versions of Maya 2016 and greater, you must set the environment variable MAYA_RELEASE_PYTHON_GIL"
" to 1 to render animations. Rendering current frame only." )
print( "\n\n\n\n")
animation = False
return animation
开发者ID:hpd,项目名称:MitsubaForMaya,代码行数:16,代码来源:MitsubaRenderer.py
示例18: getRefFiles
def getRefFiles(self,file,*args):
"""
Scan .ma file for reference file names.
Prompt the user to browse to them if their path is invalid.
"""
version = cmds.about(v=True)
rootFile = open(file,'r')
refLines = []
refFiles = []
for line in rootFile:
if line.strip().startswith('file -rdi'):
refLines.append(line)
count = 0
refPath = ""
for each in refLines:
temp1 = refLines[count].split()
#No spaces in path name
if len(temp1) == 7:
refPath = temp1[7][1:-2]
#Spaces in path name
if len(temp1) > 7:
refPath = self.buildRefPath(temp1)
refFiles.append(refPath)
count = count + 1
for each in refFiles:
print each
self.editRef(each)
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:31,代码来源:SmartOpen.py
示例19: createPreviewMayaFile
def createPreviewMayaFile(self):
"""docstring for createPreviewMayaFile"""
createPrevScript = os.path.dirname(os.path.abspath(__file__)) + '/createPreview.py'
cmd = 'C:/"Program Files"/Autodesk/Maya' + mc.about(v = True) + '/bin/' + 'mayapy.exe ' + createPrevScript + ' ' + self.path + self.name + '.ma'
print cmd
#create preview scene
os.popen( cmd )
开发者ID:skarone,项目名称:PipeL,代码行数:7,代码来源:shaderLibrary.py
示例20: zipManyFiles
def zipManyFiles(files):
fileName = maya.cmds.file(q=True, sceneName=True)
# If the scene has not been saved
if (fileName==""):
pyError( maya.stringTable['y_zipScene.kSceneNotSavedError'] )
return
# If the scene has been created, saved and then erased from the disk
elif (maya.cmds.file(q=True, exists=True)==0):
msg = maya.stringTable['y_zipScene.kNonexistentFileError'] % fileName
pyError(msg)
return
# get the default character encoding of the system
theLocale = cmds.about(codeset=True)
# get a list of all the files associated with the scene
# files = maya.cmds.file(query=1, list=1, withoutCopyNumber=1)
# create a zip file named the same as the scene by appending .zip
# to the name
zipFileName = (files[0])+'.zip'
zip=zipfile.ZipFile(zipFileName, 'w', zipfile.ZIP_DEFLATED)
# add each file associated with the scene, including the scene
# to the .zip file
for file in files:
name = file.encode(theLocale)
zip.write(name)
zip.close()
# output a message whose result is the name of the zip file newly created
pyResult(zipFileName)
开发者ID:jadamburke,项目名称:toybox,代码行数:33,代码来源:zipStuff.py
注:本文中的maya.cmds.about函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论