Argh, i cannot get this method to work!
Code:
polygonIter = maya.OpenMaya.MItMeshPolygon(myObject)
faceIndex = 0
scriptUtil = maya.OpenMaya.MScriptUtil()
scriptUtil.createFromInt(0)
dummyIndex = scriptUtil.asIntPtr()
polygonIter.setIndex(faceIndex, dummyIndex)
And the error:
polygonIter.setIndex(faceIndex, dummyIndex)
File “D:\buildforge\Maya_2011_Win64_Build\build\wrk\optim\runTime\Python\Lib\site-packages\maya\OpenMaya.py”, line 6367, in setIndex
TypeError: in method ‘MItMeshPolygon_setIndex’, argument 2 of type ‘int’
The parameter docs say this:
MStatus MItMeshPolygon::setIndex(int index, int & prevIndex)
[in] index The index of desired face to access.
[in] prevIndex The index of the current face in the iteration
Why prevIndex is needed is beyond me, and why its an int & is also baffling…
Any ideas? Cheers!