<s> import weakref <EOL> import pymel . util as util <EOL> from maya . OpenMaya import * <EOL> from maya . OpenMayaAnim import * <EOL> try : from maya . OpenMayaCloth import * <EOL> except : pass <EOL> try : from maya . OpenMayaFX import * <EOL> except : pass <EOL> try : from maya . OpenMayaMPx import * <EOL> except : pass <EOL> if not MGlobal . mayaState ( ) == MGlobal . kBatch : <EOL> try : from maya . OpenMayaUI import * <EOL> except : pass <EOL> try : from maya . OpenMayaRender import * <EOL> except : pass <EOL> class SafeApiPtr ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , valueType , scriptUtil = None , size = <NUM_LIT:1> , asTypeNPtr = False ) : <EOL> """<STR_LIT>""" <EOL> if not scriptUtil : <EOL> self . scriptUtil = MScriptUtil ( ) <EOL> if size < <NUM_LIT:1> : <EOL> raise ValueError ( '<STR_LIT>' ) <EOL> else : <EOL> self . scriptUtil . createFromList ( [ <NUM_LIT:0.0> ] * size , size ) <EOL> else : <EOL> self . scriptUtil = scriptUtil <EOL> self . size = size <EOL> capValue = util . capitalize ( valueType ) <EOL> self . _normPtr = getattr ( self . scriptUtil , '<STR_LIT>' + capValue + '<STR_LIT>' ) ( ) <EOL> if asTypeNPtr : <EOL> self . _nPtr = getattr ( self . scriptUtil , '<STR_LIT>' + capValue + <EOL> str ( size ) + '<STR_LIT>' ) ( ) <EOL> self . _ptr = self . _nPtr <EOL> else : <EOL> self . _ptr = self . _normPtr <EOL> self . _getter = getattr ( MScriptUtil , '<STR_LIT>' + capValue , None ) <EOL> self . _setter = getattr ( MScriptUtil , '<STR_LIT>' + capValue , None ) <EOL> self . _indexGetter = getattr ( MScriptUtil , <EOL> '<STR_LIT>' + capValue + '<STR_LIT>' , None ) <EOL> self . _indexSetter = getattr ( MScriptUtil , <EOL> '<STR_LIT>' + capValue + '<STR_LIT>' , None ) <EOL> def __call__ ( self ) : <EOL> return self . _ptr <EOL> def get ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _getter ( self . _normPtr ) <EOL> def set ( self , value ) : <EOL> """<STR_LIT>""" <EOL> return self . _setter ( self . _normPtr , value ) <EOL> def __getitem__ ( self , index ) : <EOL> if index < <NUM_LIT:0> or index > ( self . size - <NUM_LIT:1> ) : <EOL> raise IndexError ( index ) <EOL> return self . _indexGetter ( self . _normPtr , index ) <EOL> def __setitem__ ( self , index , value ) : <EOL> if index < <NUM_LIT:0> or index > ( self . size - <NUM_LIT:1> ) : <EOL> raise IndexError ( index ) <EOL> return self . _indexSetter ( self . _normPtr , index , value ) <EOL> def __len__ ( self ) : <EOL> return self . size <EOL> def isValidMObjectHandle ( obj ) : <EOL> if isinstance ( obj , MObjectHandle ) : <EOL> return obj . isValid ( ) and obj . isAlive ( ) <EOL> else : <EOL> return False <EOL> def isValidMObject ( obj ) : <EOL> if isinstance ( obj , MObject ) : <EOL> return not obj . isNull ( ) <EOL> else : <EOL> return False <EOL> def isValidMPlug ( obj ) : <EOL> if isinstance ( obj , MPlug ) : <EOL> return not obj . isNull ( ) <EOL> else : <EOL> return False <EOL> def isValidMDagPath ( obj ) : <EOL> if isinstance ( obj , MDagPath ) : <EOL> return obj . isValid ( ) and obj . fullPathName ( ) <EOL> else : <EOL> return False <EOL> def isValidMNode ( obj ) : <EOL> if isValidMObject ( obj ) : <EOL> return obj . hasFn ( MFn . kDependencyNode ) <EOL> else : <EOL> return False <EOL> def isValidMDagNode ( obj ) : <EOL> if isValidMObject ( obj ) : <EOL> return obj . hasFn ( MFn . kDagNode ) <EOL> else : <EOL> return False <EOL> def isValidMNodeOrPlug ( obj ) : <EOL> return isValidMPlug ( obj ) or isValidMNode ( obj ) <EOL> def toMObject ( nodeName ) : <EOL> """<STR_LIT>""" <EOL> sel = MSelectionList ( ) <EOL> obj = MObject ( ) <EOL> result = None <EOL> try : <EOL> sel . add ( nodeName ) <EOL> sel . getDependNode ( <NUM_LIT:0> , obj ) <EOL> if isValidMObject ( obj ) : <EOL> result = obj <EOL> except : <EOL> pass <EOL> return result <EOL> def toApiObject ( nodeName , dagPlugs = True , numMultiple = False ) : <EOL> """<STR_LIT>""" <EOL> sel = MSelectionList ( ) <EOL> try : <EOL> sel . add ( nodeName ) <EOL> except Exception : <EOL> if "<STR_LIT:.>" in nodeName : <EOL> try : <EOL> buf = nodeName . split ( '<STR_LIT:.>' ) <EOL> obj = toApiObject ( buf [ <NUM_LIT:0> ] ) <EOL> if isinstance ( obj , MDagPath ) : <EOL> mfn = MFnDagNode ( obj ) <EOL> else : <EOL> mfn = MFnDependencyNode ( obj ) <EOL> plug = mfn . findPlug ( buf [ - <NUM_LIT:1> ] , False ) <EOL> if dagPlugs : <EOL> return ( obj , plug ) <EOL> return plug <EOL> except ( RuntimeError , ValueError ) : <EOL> pass <EOL> if numMultiple : <EOL> sel . clear ( ) <EOL> try : <EOL> sel . add ( '<STR_LIT>' + nodeName ) <EOL> except Exception : <EOL> pass <EOL> else : <EOL> return sel . length ( ) <EOL> return None <EOL> else : <EOL> if sel . length ( ) != <NUM_LIT:1> : <EOL> if numMultiple : <EOL> return sel . length ( ) <EOL> else : <EOL> return None <EOL> if "<STR_LIT:.>" in nodeName : <EOL> try : <EOL> plug = MPlug ( ) <EOL> sel . getPlug ( <NUM_LIT:0> , plug ) <EOL> if dagPlugs : <EOL> try : <EOL> sel . add ( nodeName . split ( '<STR_LIT:.>' ) [ <NUM_LIT:0> ] ) <EOL> dag = MDagPath ( ) <EOL> sel . getDagPath ( <NUM_LIT:1> , dag ) <EOL> if not dag . node ( ) . hasFn ( MFn . kDagNode ) : <EOL> obj = MObject ( ) <EOL> sel . getDependNode ( <NUM_LIT:1> , obj ) <EOL> return ( obj , plug ) <EOL> return ( dag , plug ) <EOL> except RuntimeError : pass <EOL> return plug <EOL> except RuntimeError : <EOL> dag = MDagPath ( ) <EOL> comp = MObject ( ) <EOL> try : <EOL> sel . getDagPath ( <NUM_LIT:0> , dag , comp ) <EOL> except RuntimeError : <EOL> pass <EOL> if not comp . isNull ( ) : <EOL> return ( dag , comp ) <EOL> splitName = nodeName . split ( '<STR_LIT:.>' ) <EOL> if len ( splitName ) == <NUM_LIT:2> : <EOL> obj = MObject ( ) <EOL> try : <EOL> sel . add ( splitName [ <NUM_LIT:0> ] ) <EOL> sel . getDependNode ( <NUM_LIT:1> , obj ) <EOL> except RuntimeError : <EOL> pass <EOL> else : <EOL> mfn = MFnDependencyNode ( obj ) <EOL> aliases = [ ] <EOL> if mfn . getAliasList ( aliases ) : <EOL> for aliasName , trueName in util . pairIter ( aliases ) : <EOL> if aliasName == splitName [ <NUM_LIT:1> ] : <EOL> return toApiObject ( '<STR_LIT:.>' . join ( ( splitName [ <NUM_LIT:0> ] , trueName ) ) ) <EOL> else : <EOL> try : <EOL> dag = MDagPath ( ) <EOL> sel . getDagPath ( <NUM_LIT:0> , dag ) <EOL> if not dag . node ( ) . hasFn ( MFn . kDagNode ) : <EOL> raise RuntimeError <EOL> return dag <EOL> except RuntimeError : <EOL> obj = MObject ( ) <EOL> sel . getDependNode ( <NUM_LIT:0> , obj ) <EOL> return obj <EOL> def toMDagPath ( nodeName ) : <EOL> """<STR_LIT>""" <EOL> obj = toMObject ( nodeName ) <EOL> if obj : <EOL> dagFn = MFnDagNode ( obj ) <EOL> dagPath = MDagPath ( ) <EOL> dagFn . getPath ( dagPath ) <EOL> return dagPath <EOL> def toMPlug ( plugName ) : <EOL> """<STR_LIT>""" <EOL> nodeAndAttr = plugName . split ( '<STR_LIT:.>' , <NUM_LIT:1> ) <EOL> obj = toMObject ( nodeAndAttr [ <NUM_LIT:0> ] ) <EOL> plug = None <EOL> if obj : <EOL> depNodeFn = MFnDependencyNode ( obj ) <EOL> attr = depNodeFn . attribute ( nodeAndAttr [ <NUM_LIT:1> ] ) <EOL> plug = MPlug ( obj , attr ) <EOL> if plug . isNull ( ) : <EOL> plug = None <EOL> return plug <EOL> def toComponentMObject ( dagPath ) : <EOL> """<STR_LIT>""" <EOL> component = MObject ( ) <EOL> sel = MSelectionList ( ) <EOL> mit = MItGeometry ( dagPath ) <EOL> while not mit . isDone ( ) : <EOL> comp = mit . currentItem ( ) <EOL> sel . add ( dagPath , comp , True ) <EOL> mit . next ( ) <EOL> sel . getDagPath ( <NUM_LIT:0> , dagPath , component ) <EOL> return component <EOL> def MObjectName ( obj ) : <EOL> """<STR_LIT>""" <EOL> if isValidMPlug ( obj ) : <EOL> return obj . name ( ) <EOL> elif isValidMNode ( obj ) : <EOL> depNodeFn = MFnDependencyNode ( obj ) <EOL> return depNodeFn . name ( ) <EOL> elif isValidMDagPath ( obj ) : <EOL> return obj . partialPathName ( ) <EOL> else : <EOL> return unicode ( obj ) <EOL> def nameToMObject ( * args ) : <EOL> """<STR_LIT>""" <EOL> sel = MSelectionList ( ) <EOL> for name in args : <EOL> sel . add ( name ) <EOL> result = [ ] <EOL> obj = MObject ( ) <EOL> for i in range ( sel . length ( ) ) : <EOL> try : <EOL> sel . getDependNode ( i , obj ) <EOL> except : <EOL> result . append ( None ) <EOL> if isValidMObject ( obj ) : <EOL> result . append ( obj ) <EOL> else : <EOL> result . append ( None ) <EOL> if len ( result ) == <NUM_LIT:1> : <EOL> return result [ <NUM_LIT:0> ] <EOL> else : <EOL> return tuple ( result ) <EOL> def MItNodes ( * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> typeFilter = MIteratorType ( ) <EOL> if args : <EOL> if len ( args ) == <NUM_LIT:1> : <EOL> typeFilter . setFilterType ( args [ <NUM_LIT:0> ] ) <EOL> else : <EOL> typeIntM = MIntArray ( ) <EOL> MScriptUtil . createIntArrayFromList ( args , typeIntM ) <EOL> typeFilter . setFilterList ( typeIntM ) <EOL> typeFilter . setObjectType ( MIteratorType . kMObject ) <EOL> iterObj = MItDependencyNodes ( typeFilter ) <EOL> while not iterObj . isDone ( ) : <EOL> yield ( iterObj . thisNode ( ) ) <EOL> iterObj . next ( ) <EOL> def MItGraph ( nodeOrPlug , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> startObj = None <EOL> startPlug = None <EOL> if isValidMPlug ( nodeOrPlug ) : <EOL> startPlug = nodeOrPlug <EOL> elif isValidMNode ( nodeOrPlug ) : <EOL> startObj = nodeOrPlug <EOL> else : <EOL> raise ValueError , "<STR_LIT>" % MObjectName ( nodeOrPlug ) <EOL> upstream = kwargs . get ( '<STR_LIT>' , False ) <EOL> breadth = kwargs . get ( '<STR_LIT>' , False ) <EOL> plug = kwargs . get ( '<STR_LIT>' , False ) <EOL> prune = kwargs . get ( '<STR_LIT>' , False ) <EOL> if args : <EOL> typeFilter = MIteratorType ( ) <EOL> if len ( args ) == <NUM_LIT:1> : <EOL> typeFilter . setFilterType ( args [ <NUM_LIT:0> ] ) <EOL> else : <EOL> typeIntM = MIntArray ( ) <EOL> MScriptUtil . createIntArrayFromList ( args , typeIntM ) <EOL> typeFilter . setFilterList ( typeIntM ) <EOL> if startPlug is not None : <EOL> typeFilter . setObjectType ( MIteratorType . kMPlugObject ) <EOL> else : <EOL> typeFilter . setObjectType ( MIteratorType . kMObject ) <EOL> if upstream : <EOL> direction = MItDependencyGraph . kUpstream <EOL> else : <EOL> direction = MItDependencyGraph . kDownstream <EOL> if breadth : <EOL> traversal = MItDependencyGraph . kBreadthFirst <EOL> else : <EOL> traversal = MItDependencyGraph . kDepthFirst <EOL> if plug : <EOL> level = MItDependencyGraph . kPlugLevel <EOL> else : <EOL> level = MItDependencyGraph . kNodeLevel <EOL> iterObj = MItDependencyGraph ( startObj , startPlug , typeFilter , direction , traversal , level ) <EOL> if prune : <EOL> iterObj . enablePruningOnFilter ( ) <EOL> else : <EOL> iterObj . disablePruningOnFilter ( ) <EOL> while not iterObj . isDone ( ) : <EOL> yield ( iterObj . thisNode ( ) ) <EOL> iterObj . next ( ) <EOL> def MItDag ( root = None , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> startObj = startPath = None <EOL> if isValidMDagPath ( root ) : <EOL> startPath = root <EOL> elif isValidMDagNode ( root ) : <EOL> startObj = root <EOL> else : <EOL> raise ValueError , "<STR_LIT>" % MObjectName ( root ) <EOL> breadth = kwargs . get ( '<STR_LIT>' , False ) <EOL> underworld = kwargs . get ( '<STR_LIT>' , False ) <EOL> prune = kwargs . get ( '<STR_LIT>' , False ) <EOL> path = kwargs . get ( '<STR_LIT:path>' , False ) <EOL> allPaths = kwargs . get ( '<STR_LIT>' , False ) <EOL> if args : <EOL> typeFilter = MIteratorType ( ) <EOL> if len ( args ) == <NUM_LIT:1> : <EOL> typeFilter . setFilterType ( args [ <NUM_LIT:0> ] ) <EOL> else : <EOL> typeIntM = MIntArray ( ) <EOL> MScriptUtil . createIntArrayFromList ( args , typeIntM ) <EOL> typeFilter . setFilterList ( typeIntM ) <EOL> if startPath is not None : <EOL> typeFilter . setObjectType ( MIteratorType . kMDagPathObject ) <EOL> else : <EOL> typeFilter . setObjectType ( MIteratorType . kMObject ) <EOL> if breadth : <EOL> traversal = MItDag . kBreadthFirst <EOL> else : <EOL> traversal = MItDag . kDepthFirst <EOL> iterObj = MItDag ( typeFilter , traversal ) <EOL> if root is not None : <EOL> iterObj . reset ( typeFilter , startObj , startPath , traversal ) <EOL> if underworld : <EOL> iterObj . traverseUnderWorld ( True ) <EOL> else : <EOL> iterObj . traverseUnderWorld ( False ) <EOL> instance = [ ] <EOL> if allPaths : <EOL> dPathArray = MDagPathArray ( ) <EOL> while not iterObj . isDone ( ) : <EOL> if iterObj . isInstanced ( True ) : <EOL> obj = iterObj . currentItem ( ) <EOL> if not obj in instance : <EOL> iterObj . getAllPaths ( dPathArray ) <EOL> nbDagPath = dPathArray . length ( ) <EOL> for i in range ( nbDagPath ) : <EOL> dPath = MDagPath ( dPathArray [ i ] ) <EOL> yield dPath <EOL> instance . append ( obj ) <EOL> else : <EOL> iterObj . getAllPaths ( dPathArray ) <EOL> nbDagPath = dPathArray . length ( ) <EOL> for i in range ( nbDagPath ) : <EOL> dPath = MDagPath ( dPathArray [ i ] ) <EOL> yield dPath <EOL> iterObj . next ( ) <EOL> elif path : <EOL> while not iterObj . isDone ( ) : <EOL> if iterObj . isInstanced ( True ) : <EOL> obj = iterObj . currentItem ( ) <EOL> if not obj in instance : <EOL> dPath = MDagPath ( ) <EOL> iterObj . getPath ( dPath ) <EOL> yield dPath <EOL> instance . append ( obj ) <EOL> else : <EOL> dPath = MDagPath ( ) <EOL> iterObj . getPath ( dPath ) <EOL> yield dPath <EOL> iterObj . next ( ) <EOL> else : <EOL> while not iterObj . isDone ( ) : <EOL> obj = iterObj . currentItem ( ) <EOL> if iterObj . isInstanced ( True ) : <EOL> if not obj in instance : <EOL> yield obj <EOL> instance . append ( obj ) <EOL> else : <EOL> yield obj <EOL> iterObj . next ( ) <EOL> def getPlugValue ( plug ) : <EOL> """<STR_LIT>""" <EOL> obj = plug . attribute ( ) <EOL> apiType = obj . apiType ( ) <EOL> if apiType in [ MFn . kAttribute2Double , MFn . kAttribute2Float , MFn . kAttribute2Short , MFn . kAttribute2Int , <EOL> MFn . kAttribute3Double , MFn . kAttribute3Float , MFn . kAttribute3Short , MFn . kAttribute3Int , <EOL> MFn . kAttribute4Double , <EOL> MFn . kCompoundAttribute ] : <EOL> res = [ ] <EOL> for i in range ( plug . numChildren ( ) ) : <EOL> res . append ( getPlugValue ( plug . child ( i ) ) ) <EOL> return tuple ( res ) <EOL> elif apiType in [ MFn . kDoubleLinearAttribute , MFn . kFloatLinearAttribute ] : <EOL> return plug . asMDistance ( ) <EOL> elif apiType in [ MFn . kDoubleAngleAttribute , MFn . kFloatAngleAttribute ] : <EOL> return plug . asMAngle ( ) <EOL> elif apiType == MFn . kTimeAttribute : <EOL> return plug . asMTime ( ) <EOL> elif apiType == MFn . kNumericAttribute : <EOL> nAttr = MFnNumericAttribute ( obj ) <EOL> dataType = nAttr . unitType ( ) <EOL> if dataType == MFnNumericData . kBoolean : <EOL> return plug . asBool ( ) <EOL> elif dataType in [ MFnNumericData . kShort , MFnNumericData . kInt , MFnNumericData . kLong , MFnNumericData . kByte ] : <EOL> return plug . asInt ( ) <EOL> elif dataType in [ MFnNumericData . kFloat , MFnNumericData . kDouble , MFnNumericData . kAddr ] : <EOL> return plug . asDouble ( ) <EOL> raise "<STR_LIT>" % ( plug . partialName ( True , True , True , False , True , True ) , dataType ) <EOL> elif apiType == MFn . kEnumAttribute : <EOL> return plug . asInt ( ) <EOL> elif apiType == MFn . kTypedAttribute : <EOL> tAttr = MFnTypedAttribute ( obj ) <EOL> dataType = tAttr . attrType ( ) <EOL> if dataType == MFnData . kInvalid : <EOL> return None <EOL> elif dataType == MFnData . kString : <EOL> return plug . asString ( ) <EOL> elif dataType == MFnData . kNumeric : <EOL> try : <EOL> dataObj = plug . asMObject ( ) <EOL> except : <EOL> return <EOL> try : <EOL> numFn = MFnNumericData ( dataObj ) <EOL> except RuntimeError : <EOL> if plug . isArray ( ) : <EOL> raise TypeError , "<STR_LIT>" % plug . partialName ( True , True , True , False , True , True ) <EOL> else : <EOL> raise TypeError , "<STR_LIT>" % plug . partialName ( True , True , True , False , True , True ) <EOL> dataType = numFn . numericType ( ) <EOL> if dataType == MFnNumericData . kBoolean : <EOL> return plug . asBool ( ) <EOL> elif dataType in [ MFnNumericData . kShort , MFnNumericData . kInt , MFnNumericData . kLong , MFnNumericData . kByte ] : <EOL> return plug . asInt ( ) <EOL> elif dataType in [ MFnNumericData . kFloat , MFnNumericData . kDouble , MFnNumericData . kAddr ] : <EOL> return plug . asDouble ( ) <EOL> elif dataType == MFnNumericData . k2Short : <EOL> ptr1 = SafeApiPtr ( '<STR_LIT>' ) <EOL> ptr2 = SafeApiPtr ( '<STR_LIT>' ) <EOL> numFn . getData2Short ( ptr1 ( ) , ptr2 ( ) ) <EOL> return ( ptr1 . get ( ) , ptr2 . get ( ) ) <EOL> elif dataType in [ MFnNumericData . k2Int , MFnNumericData . k2Long ] : <EOL> ptr1 = SafeApiPtr ( '<STR_LIT:int>' ) <EOL> ptr2 = SafeApiPtr ( '<STR_LIT:int>' ) <EOL> numFn . getData2Int ( ptr1 ( ) , ptr2 ( ) ) <EOL> return ( ptr1 . get ( ) , ptr2 . get ( ) ) <EOL> elif dataType == MFnNumericData . k2Float : <EOL> ptr1 = SafeApiPtr ( '<STR_LIT:float>' ) <EOL> ptr2 = SafeApiPtr ( '<STR_LIT:float>' ) <EOL> numFn . getData2Float ( ptr1 ( ) , ptr2 ( ) ) <EOL> return ( ptr1 . get ( ) , ptr2 . get ( ) ) <EOL> elif dataType == MFnNumericData . k2Double : <EOL> ptr1 = SafeApiPtr ( '<STR_LIT>' ) <EOL> ptr2 = SafeApiPtr ( '<STR_LIT>' ) <EOL> numFn . getData2Double ( ptr1 ( ) , ptr2 ( ) ) <EOL> return ( ptr1 . get ( ) , ptr2 . get ( ) ) <EOL> elif dataType == MFnNumericData . k3Float : <EOL> ptr1 = SafeApiPtr ( '<STR_LIT:float>' ) <EOL> ptr2 = SafeApiPtr ( '<STR_LIT:float>' ) <EOL> ptr3 = SafeApiPtr ( '<STR_LIT:float>' ) <EOL> numFn . getData3Float ( ptr1 ( ) , ptr2 ( ) , ptr3 ( ) ) <EOL> return ( ptr1 . get ( ) , ptr2 . get ( ) , ptr3 . get ( ) ) <EOL> elif dataType == MFnNumericData . k3Double : <EOL> ptr1 = SafeApiPtr ( '<STR_LIT>' ) <EOL> ptr2 = SafeApiPtr ( '<STR_LIT>' ) <EOL> ptr3 = SafeApiPtr ( '<STR_LIT>' ) <EOL> numFn . getData3Double ( ptr1 ( ) , ptr2 ( ) , ptr3 ( ) ) <EOL> return ( ptr1 . get ( ) , ptr2 . get ( ) , ptr3 . get ( ) ) <EOL> elif dataType == MFnNumericData . kChar : <EOL> return plug . asChar ( ) <EOL> raise TypeError , "<STR_LIT>" % ( plug . partialName ( True , True , True , False , True , True ) , dataType ) <EOL> elif dataType == MFnData . kMatrix : <EOL> return MFnMatrixData ( plug . asMObject ( ) ) . matrix ( ) <EOL> elif dataType == MFnData . kDoubleArray : <EOL> try : <EOL> dataObj = plug . asMObject ( ) <EOL> except RuntimeError : <EOL> return [ ] <EOL> return MFnDoubleArrayData ( dataObj ) . array ( ) <EOL> elif dataType == MFnData . kIntArray : <EOL> try : <EOL> dataObj = plug . asMObject ( ) <EOL> except RuntimeError : <EOL> return [ ] <EOL> return MFnIntArrayData ( dataObj ) . array ( ) <EOL> elif dataType == MFnData . kPointArray : <EOL> try : <EOL> dataObj = plug . asMObject ( ) <EOL> except RuntimeError : <EOL> return [ ] <EOL> return MFnPointArrayData ( dataObj ) . array ( ) <EOL> elif dataType == MFnData . kVectorArray : <EOL> try : <EOL> dataObj = plug . asMObject ( ) <EOL> except RuntimeError : <EOL> return [ ] <EOL> return MFnVectorArrayData ( dataObj ) . array ( ) <EOL> elif dataType == MFnData . kStringArray : <EOL> try : <EOL> dataObj = plug . asMObject ( ) <EOL> except RuntimeError : <EOL> return [ ] <EOL> return MFnStringArrayData ( dataObj ) . array ( ) <EOL> raise TypeError , "<STR_LIT>" % ( plug . partialName ( True , True , True , False , True , True ) , dataType ) <EOL> raise TypeError , "<STR_LIT>" % ( plug . partialName ( True , True , True , False , True , True ) , obj . apiTypeStr ( ) ) </s>
