| MItGeometry ( const MDagPath & dagPath, MStatus * ReturnStatus = NULL) | |
| MItGeometry ( const MDagPath & dagPath, MObject & component , MStatus * ReturnStatus = NULL ) | |
| MItGeometry ( MObject & dagObject, MStatus * ReturnStatus = NULL ) | |
| MItGeometry ( MDataHandle & dataHandle, unsigned int groupId, bool readOnly = true, MStatus * ReturnStatus = NULL ) | |
| MItGeometry ( MDataHandle & dataHandle, bool readOnly = true, MStatus * ReturnStatus = NULL ) | |
| ~MItGeometry () | |
| isDone ( MStatus * ReturnStatus = NULL ) const | |
| next () | |
| position ( MSpace::Space space = MSpace::kObject , MStatus * ReturnStatus = NULL ) const | |
| setPosition ( const MPoint & point, MSpace::Space space = MSpace::kObject ) | |
| index ( MStatus * ReturnStatus = NULL ) const | |
| component ( MStatus * ReturnStatus = NULL ) const OBSOLETE | |
| currentItem ( MStatus * ReturnStatus = NULL ) const | |
| count ( MStatus * ReturnStatus = NULL ) const | |
| reset ( ) |
MItGeometry iter( dagPath );
for ( ; !iter.isDone(); iter.next() )
{
MPoint pt = iter.position();
// do something with it
}
Example: (of a traversal of a geometry group within a compute() method.)
MStatus
exampleIterator::compute(const MPlug& plug, MDataBlock& dataBlock)
{
MStatus status;
if (plug.attribute() == oOutputGeometry) {
// get the input geometry and input groupId
MDataHandle hInputGeom = dataBlock.inputValue(inputGeomAttr);
MDataHandle hGroupId = dataBlock.inputValue(inputGroupIdAttr);
unsigned int groupId = hGroup.asLong();
MDataHandle hOutput = dataBlock.outputValue(plug);
hOutput.copy(hInputGeom);
// do an iteration where we get each point and set it to a new value
MItGeometry iter(hOutput,groupId,false);
for ( ; !iter.isDone(); iter.next()) {
MPoint pt = iter.position();
// do something here to modify the point ...
iter.setPosition(pt);
}
} else {
status = MS::kUnknownParameter;
}
return status;
}
| Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. | doc++ Copyright |