本文整理汇总了Python中maya.OpenMaya.MGlobal.apiVersion方法的典型用法代码示例。如果您正苦于以下问题:Python MGlobal.apiVersion方法的具体用法?Python MGlobal.apiVersion怎么用?Python MGlobal.apiVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maya.OpenMaya.MGlobal
的用法示例。
在下文中一共展示了MGlobal.apiVersion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parseVersionStr
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import apiVersion [as 别名]
def parseVersionStr(versionStr, extension=False):
"""
Parse a verbose version string (like the one displayed in the Maya title
bar) and return the base version.
:Parameters:
extension : `bool`
if True, leave the -x64 tag
>>> from pymel.all import *
>>> versions.parseVersionStr('2008 Service Pack1 x64')
'2008'
>>> versions.parseVersionStr('2008 Service Pack1 x64', extension=True)
'2008-x64'
>>> versions.parseVersionStr('2008x64', extension=True)
'2008-x64'
>>> versions.parseVersionStr('8.5', extension=True)
'8.5'
>>> versions.parseVersionStr('2008 Extension 2')
'2008'
>>> versions.parseVersionStr('/Applications/Autodesk/maya2009/Maya.app/Contents', extension=True)
'2009'
>>> versions.parseVersionStr('C:\Program Files (x86)\Autodesk\Maya2008', extension=True)
'2008'
"""
if 'Preview' in versionStr:
# Beta versions of Maya may use the format 'Preview Release nn x64', which
# doesn't contain the actual Maya version. If we have one of those, we'll
# make up the version from the API version. Not foolproof, but should work
# in most cases.
version = str(_MGlobal.apiVersion())[0:4]
if extension and bitness() == 64:
version += '-x64'
else:
# problem with service packs addition, must be able to match things such as :
# '2008 Service Pack 1 x64', '2008x64', '2008', '8.5'
# NOTE: we're using the same regular expression (parseVersionStr) to parse both the crazy human readable
# maya versions as returned by about, and the maya location directory. to handle both of these i'm afraid
# the regular expression might be getting unwieldy
ma = re.search("((?:maya)?(?P<base>[\d.]{3,})(?:(?:[ ].*[ ])|(?:-))?(?P<ext>x[\d.]+)?)", versionStr)
version = ma.group('base')
if extension and (ma.group('ext') is not None):
version += "-" + ma.group('ext')
return version
示例2: and
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import apiVersion [as 别名]
if extension and (ma.group('ext') is not None):
version += "-" + ma.group('ext')
return version
def bitness():
"""
The bitness of python running inside Maya as an int.
"""
# NOTE: platform.architecture()[0] returns '64bit' on OSX 10.6 (Snow Leopard)
# even when Maya is running in 32-bit mode. The struct technique
# is more reliable.
return struct.calcsize("P") * 8
_is64 = bitness() == 64
_current = _MGlobal.apiVersion()
_fullName = _MGlobal.mayaVersion()
_shortName = parseVersionStr(_fullName, extension=False)
_installName = _shortName + ('-x64' if (_is64 and _current < 201600) else '')
v85 = 200700
v85_SP1 = 200701
v2008 = 200800
v2008_SP1 = 200806
v2008_EXT2 = 200806
v2009 = 200900
v2009_EXT1 = 200904
v2009_SP1A = 200906
v2010 = 201000
v2011 = 201100
示例3: __init__
# 需要导入模块: from maya.OpenMaya import MGlobal [as 别名]
# 或者: from maya.OpenMaya.MGlobal import apiVersion [as 别名]
def __init__(self, obj):
args = [self, obj, zRigHandleDrawOverride.draw]
if MGlobal.apiVersion() >= 201700:
# This argument is only present in 2017, and improves performance substantially.
args.append(False)
omr.MPxDrawOverride.__init__(*args)