return the name of the closest MEL type equivalent for the given python object. MEL has no true boolean or matrix types, but it often reserves special treatment for them in other ways. To control the handling of these types, use allowBool and allowMatrix. For python iterables, the first element in the array is used to determine the type. for empty lists, ‘string[]’ is returned.
>>> from pymel.all import *
>>> getMelType( 1 )
'int'
>>> p = SCENE.persp
>>> getMelType( p.translate.get() )
'vector'
>>> getMelType( datatypes.Matrix )
'int[]'
>>> getMelType( datatypes.Matrix, allowMatrix=True )
'matrix'
>>> getMelType( True )
'int'
>>> getMelType( True, allowBool=True)
'bool'
>>> # make a dummy class
>>> class MyClass(object): pass
>>> getMelType( MyClass ) # returns None
>>> getMelType( MyClass, exactOnly=False )
'MyClass'
Parameters: |
|
---|---|
Return type: | str |