Public Member Functions | Static Public Member Functions

MPxGeometryIterator Class Reference

This reference page is linked to from the following overview topics: Components.


Search for all occurrences

Detailed Description

Base class for user defined geometry iterators.

This is the base class for user defined geometry iterators. Geometry iterator allow iterating over components in geometry in a geometry independent manner. This base class defines the interface to be used by maya when a generic component iteration is required.

This class is used in conjunction with MPxSurfaceShape to provide an iterator for components in a user defined shape. Also this method can is used by MPxGeometryData to provide an iterator over geometry that is passed through DG connections.

The main methods to override in this class are point and setPoint. The reset, isDone, and next methods have a default implementation and should only be overridden if the component being iterator on is not a single indexed component type.

The iterator works in two modes, over components or over all elements in some geometry. If the components passed into the constructors are null or empty then the iteration is meant to be over the entire object.

Examples:

apiMeshData.cpp, apiMeshData.h, apiMeshIterator.cpp, apiMeshIterator.h, apiMeshShape.cpp, apiMeshShape.h, apiSimpleShape.cpp, apiSimpleShape.h, apiSimpleShapeIterator.cpp, and apiSimpleShapeIterator.h.

#include <MPxGeometryIterator.h>

List of all members.

Public Member Functions

  MPxGeometryIterator (void *userGeometry, MObjectArray &components)
  Class constructor.
  MPxGeometryIterator (void *userGeometry, MObject &components)
  Class constructor.
virtual  ~MPxGeometryIterator ()
  Class destructor.
virtual bool  isDone () const
  Indicates if all the items have been traversed yet.
virtual void  next ()
  Advances to the next component.
virtual void  reset ()
  Resets the iterator to the start of the components so that another pass over them may be made.
virtual void  component (MObject &component)
  Returns a component for the current item in the iteration.
virtual bool  hasPoints () const
  Indicates whether the underlying geometry has point data.
virtual int  iteratorCount () const
  Returns an estimate of how many items will be iterated over.
virtual MPoint  point () const
  Returns the current component's positional data.
virtual void  setPoint (const MPoint &) const
  Sets the current component's positional data.
virtual int  setPointGetNext (MPoint &)
  Sets the current component's positional data, gets the next point.
virtual int  index () const
  Returns a unique index for the current item in the iteration.
virtual bool  hasNormals () const
  Indicates whether the underlying geometry has normals.
virtual int  indexUnsimplified () const
  Returns a unique index for the current item in the iteration Rather than being the iterator index this is the index for the actual item when simplification is skipping items.
int  currentPoint () const
  Returns the index that is being iterated on.
void  setCurrentPoint (int)
  Set the current index of the iteration.
int  maxPoints () const
  Returns the largest index that will be iterated over.
void  setMaxPoints (int)
  Sets the largest index that will be iterated over.
void  setObject (MPxSurfaceShape &)
  Optional method to set a shape object to iterate over to allow tweaking of the shape's history (input geometry).
void *  geometry () const
  Returns a pointer to the geometry that this iterator is iterating over.

Static Public Member Functions

static const char *  className ()
  Returns the name of this class.

Constructor & Destructor Documentation

MPxGeometryIterator ( void *  userGeometry,
MObjectArray components 
)

Class constructor.

The components can be NULL if the iteration is to be over all elements in the geometry.

Parameters:
[in] userGeometry the geometry that will be iterated over
[in] components the (optional) list of components to iterate over
MPxGeometryIterator ( void *  userGeometry,
MObject components 
)

Class constructor.

The components can be NULL if the iteration is to be over all elements in the geometry.

Parameters:
[in] userGeometry the geometry that will be iterated over
[in] components the (optional) components to iterate over

Member Function Documentation

bool isDone ( ) const [virtual]

Indicates if all the items have been traversed yet.

Returns:
  • true the iterator has no more elements to traverse
  • false the iterator is not finished traversing
void component ( MObject component ) [virtual]

Returns a component for the current item in the iteration.

Parameters:
[out] component storage for the returned component
bool hasPoints ( ) const [virtual]

Indicates whether the underlying geometry has point data.

Returns:
  • true the geometry has point data
  • false the geometry does not have point data
Examples:
apiMeshIterator.h, and apiSimpleShapeIterator.h.
int iteratorCount ( ) const [virtual]

Returns an estimate of how many items will be iterated over.

Returns:
The iterator count
Examples:
apiMeshIterator.h, and apiSimpleShapeIterator.h.
MPoint point ( ) const [virtual]

Returns the current component's positional data.

Returns:
The current point being iterated over
Examples:
apiMeshIterator.h, and apiSimpleShapeIterator.h.
void setPoint ( const MPoint point ) const [virtual]

Sets the current component's positional data.

Parameters:
[in] point the new positional value to set
Examples:
apiMeshIterator.h, and apiSimpleShapeIterator.h.
int setPointGetNext ( MPoint point ) [virtual]

Sets the current component's positional data, gets the next point.

Parameters:
[in] point the positional value to set
Returns:
The next index value
int index ( ) const [virtual]

Returns a unique index for the current item in the iteration.

If the iteration is over the whole geometry then this index is the same as current point. If the iteration is over some elements of the geometry specified by a component then this index is the index in your geometry.

Returns:
The index of the current element
bool hasNormals ( ) const [virtual]

Indicates whether the underlying geometry has normals.

Returns:
  • true this geometry has normals
  • false this geometry has no normals
int indexUnsimplified ( ) const [virtual]

Returns a unique index for the current item in the iteration Rather than being the iterator index this is the index for the actual item when simplification is skipping items.

This index will be equal to index() if no simplification, otherwise it will be larger.

Returns:
The unsimplified index
int currentPoint ( ) const

Returns the index that is being iterated on.

This value is used when iterating over all elements of your geometry, i.e. when there are no components specified.

Returns:
The current point index
void setCurrentPoint ( int  index )

Set the current index of the iteration.

This value is used when iterating over all elements of your geometry, i.e. when there are no components specified.

Parameters:
[in] index the current point in the iteration
int maxPoints ( ) const

Returns the largest index that will be iterated over.

This value is used when iterating over all elements of your geometry, i.e. when there are no components specified.

Returns:
The max index
void setMaxPoints ( int  index )

Sets the largest index that will be iterated over.

This value is used when iterating over all elements of your geometry, i.e. when there are no components specified.

Parameters:
[in] index the maximum index value
void setObject ( MPxSurfaceShape shape )

Optional method to set a shape object to iterate over to allow tweaking of the shape's history (input geometry).

Parameters:
[in] shape a user defined shape object
const char * className ( ) [static]

Returns the name of this class.

Returns:
The name of this class.

MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator
MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator MPxGeometryIterator