chadmv
12-12-2007, 01:12 AM
I'm writing a python script that accesses array attributes but I'm getting an error with the elementByPhysicalIndex function:
itDag = OpenMaya.MItDag( OpenMaya.MItDag.kDepthFirst, OpenMaya.MFn.kMesh )
while not itDag.isDone():
fnDepNode = OpenMaya.MFnDependencyNode( itDag.currentItem() )
print fnDepNode.name()
plugArray = fnDepNode.findPlug( "vrts" )
numElements = plugArray.numElements()
print "numElements = ", numElements
for i in range( numElements ):
# Get plug for i'th array element
print "Looking up index", i
plugCompound = plugArray.elementByPhysicalIndex( i )
itDag.next()
And the error I get from elementByPhysicalIndex
# Error: (kFailure): Unexpected Internal Failure
# Traceback (most recent call last):
# File "<maya console>", line 11, in ?
# File "C:\engserv\rbuild\164\build\wrk\optim\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 7914, in elementByPhysicalIndex
# RuntimeError: (kFailure): Unexpected Internal Failure #
I can't see anything wrong. Any ideas? thanks!
itDag = OpenMaya.MItDag( OpenMaya.MItDag.kDepthFirst, OpenMaya.MFn.kMesh )
while not itDag.isDone():
fnDepNode = OpenMaya.MFnDependencyNode( itDag.currentItem() )
print fnDepNode.name()
plugArray = fnDepNode.findPlug( "vrts" )
numElements = plugArray.numElements()
print "numElements = ", numElements
for i in range( numElements ):
# Get plug for i'th array element
print "Looking up index", i
plugCompound = plugArray.elementByPhysicalIndex( i )
itDag.next()
And the error I get from elementByPhysicalIndex
# Error: (kFailure): Unexpected Internal Failure
# Traceback (most recent call last):
# File "<maya console>", line 11, in ?
# File "C:\engserv\rbuild\164\build\wrk\optim\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 7914, in elementByPhysicalIndex
# RuntimeError: (kFailure): Unexpected Internal Failure #
I can't see anything wrong. Any ideas? thanks!
