C++ API Reference
MItMeshEdge Class Reference

Polygon edge iterator. More...

#include <MItMeshEdge.h>

Public Member Functions

 MItMeshEdge (MObject &polyObject, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
 MItMeshEdge (MObject &polyObject, MObject &component, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
 MItMeshEdge (const MDagPath &polyObject, MObject &component=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
virtual ~MItMeshEdge ()
 Destructor. More...
 
bool isDone (MStatus *ReturnStatus=NULL)
 Indicates if all of the edges have been traversed yet. More...
 
MStatus next ()
 Advance to the next edge in the iteration. More...
 
MStatus reset ()
 Reset the iterator to the first edge. More...
 
MStatus reset (MObject &polyObject, MObject &component=MObject::kNullObj)
 Reset the iterator to the first edge in the supplied mesh. More...
 
MStatus reset (const MDagPath &polyObject, MObject &component=MObject::kNullObj)
 Reset the iterator to the first edge in the supplied mesh. More...
 
int count (MStatus *ReturnStatus=NULL)
 Return the number of edges in this iteration. More...
 
MPoint center (MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL)
 Returns the center of the current edge. More...
 
MPoint point (int index, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL)
 Return the position of the specified vertex of the current edge. More...
 
MStatus setPoint (const MPoint &point, unsigned int index, MSpace::Space space=MSpace::kObject)
 Set the specified vertex of the current edge to the given value. More...
 
bool isSmooth (MStatus *ReturnStatus=NULL) const
 This method determines if the current edge in the iteration is smooth (soft). More...
 
MStatus setSmoothing (bool smooth=true)
 This method sets the current edge to be hard or smooth (soft). More...
 
MStatus cleanupSmoothing ()
 Deprecated in 2019.0 More...
 
int index (int index, MStatus *ReturnStatus=NULL)
 This method returns a vertex index for the current edge based upon the specified index. More...
 
int index (MStatus *ReturnStatus=NULL) const
 This method returns the index of the current edge in the iteration. More...
 
MObject edge (MStatus *ReturnStatus=NULL)
 Deprecated in 2016.0 More...
 
MObject currentItem (MStatus *ReturnStatus=NULL)
 Get the current edge in the iteration as a component. More...
 
MStatus updateSurface ()
 Signal that this polygonal surface has changed and needs to redraw itself. More...
 
MStatus geomChanged ()
 Reset the geom pointer in the MItMeshEdge. More...
 
MStatus setIndex (int index, int &prevIndex)
 This method sets the index of the current edge to be accessed. More...
 
int getConnectedFaces (MIntArray &faceList, MStatus *ReturnStatus=NULL) const
 This method returns an array containing the indices of the faces connected to the current edge. More...
 
int getConnectedEdges (MIntArray &edgeList, MStatus *ReturnStatus=NULL) const
 This method returns a list of edges connected to the current edge. More...
 
MStatus numConnectedFaces (int &faceCount) const
 This method returns the number of faces (1 or 2 ) connected to the current edge. More...
 
MStatus numConnectedEdges (int &edgeCount) const
 This method returns the number of edges connected to the current edge. More...
 
bool connectedToFace (int index, MStatus *ReturnStatus=NULL)
 This method determines whether the given face contains the current edge. More...
 
bool connectedToEdge (int index, MStatus *ReturnStatus=NULL)
 This method determines whether the given edge is connected to the current edge. More...
 
bool onBoundary (MStatus *ReturnStatus=NULL)
 This method checks to see if the current edge is a border edge. More...
 
MStatus getLength (double &length, MSpace::Space space=MSpace::kObject)
 This method returns the length of the current edge. More...
 

Static Public Member Functions

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

Detailed Description

Polygon edge iterator.

This class is the edge iterator for polygonal surfaces.

The iterator functions in two modes depending on whether a component is specified. When a component is not given or is NULL the iteration will be over all edges for the polygon. When a component is given this iterator will iterate over the edges specified in the component. When iterating over components a DAG path to the polygon must also be supplied.

Examples:
convertEdgesToFacesCmd/convertEdgesToFacesCmd.cpp, convertVerticesToEdgesCmd/convertVerticesToEdgesCmd.cpp, lassoTool/lassoTool.cpp, meshOpCmd/meshOpFtyAction.cpp, and objExport/objExport.cpp.

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MItMeshEdge ( MObject polyObject,
MStatus ReturnStatus = NULL 
)

Constructor.

Creates an iterator for all edges of the given surface.

Parameters
[in]polyObjectThe surface to iterate over
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MItMeshEdge ( MObject polyObject,
MObject component,
MStatus ReturnStatus = NULL 
)

Constructor.

Creates an iterator for the edges of a given surface. The returned edges are connected to the component object. This component may be a vertex or a face or an edge component. If no component is specified then the iteration will be for all edges of the given polygon.

Parameters
[in]polyObjectThe surface to iterate over
[in]componentThe component that determines which edges to iterate over
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MItMeshEdge ( const MDagPath polyObject,
MObject component = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Constructor.

Creates an iterator for the edges of a given surface. The returned edges are connected to the component object. This component may be a vertex or a face or an edge component. If no component is specified then the iteration will be for all edges of the given polygon.

Parameters
[in]polyObjectThe surface to iterate over
[in]componentThe edges of the polyObject to iterate over
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
~MItMeshEdge ( )
virtual

Destructor.

Frees up storage used by the iterator.

Member Function Documentation

bool isDone ( MStatus ReturnStatus = NULL)

Indicates if all of the edges have been traversed yet.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true All edges have been traversed, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
Examples:
convertEdgesToFacesCmd/convertEdgesToFacesCmd.cpp.
MStatus next ( )

Advance to the next edge in the iteration.

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus reset ( )

Reset the iterator to the first edge.

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus reset ( MObject polyObject,
MObject component = MObject::kNullObj 
)

Reset the iterator to the first edge in the supplied mesh.

Uses the edges constrained by the given component. If component is null then the iteration will be for all edges in the given polygon. If component has invalid indices those will be automatically removed.

Parameters
[in]polyObjectThe mesh object for the iteration
[in]componentThe constraint object. May be a vertex, a face or an edge component
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid object given.
  • MS::kInsufficientMemory Memory error.
MStatus reset ( const MDagPath polyObject,
MObject component = MObject::kNullObj 
)

Reset the iterator to the first edge in the supplied mesh.

Uses the edges constrained by the given component. If component is null then the iteration will be for all edges in the given polygon. If component has invalid indices those will be automatically removed.

Parameters
[in]polyObjectThe surface to iterate over
[in]componentThe constraint object. May be a vertex, a face or an edge component
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid object given.
int count ( MStatus ReturnStatus = NULL)

Return the number of edges in this iteration.

Parameters
[out]ReturnStatusStatus code
Returns
The number of edges in the iteration
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MPoint center ( MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
)

Returns the center of the current edge.

Parameters
[in]spaceThe coordinate system for this operation
[out]ReturnStatusStatus code
Returns
The center of the current edge
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MPoint point ( int  index,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
)

Return the position of the specified vertex of the current edge.

Parameters
[in]indexThe vertex of the edge we wish to examine (0 or 1)
[in]spaceThe coordinate system for this operation
[out]ReturnStatusStatus code
Returns
The position of the edge vertex for the given index
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus setPoint ( const MPoint point,
unsigned int  index,
MSpace::Space  space = MSpace::kObject 
)

Set the specified vertex of the current edge to the given value.

Parameters
[in]pointThe new value for the edge
[in]indexThe vertex index of the current edge we wish to set (0 or 1)
[in]spaceThe coordinate system for this operation
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool isSmooth ( MStatus ReturnStatus = NULL) const

This method determines if the current edge in the iteration is smooth (soft).

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true if the edge is smooth (soft), false if the edge is hard.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus setSmoothing ( bool  smooth = true)

This method sets the current edge to be hard or smooth (soft).

The cleanupSmoothing method is no longer required to be called after setSmoothing in Maya3.0 and later versions.

Parameters
[in]smoothif true the edge will be smooth (soft), otherwise the edge will be hard.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus cleanupSmoothing ( )

Deprecated in 2019.0

Deprecated:
This method is no longer required in Maya3.0 and later versions. (In previous versions, this method was needed to clean up the geometry after setSmoothing has been done on one or more edges).
2019.0:
Deprecated in this version.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
int index ( int  index,
MStatus ReturnStatus = NULL 
)

This method returns a vertex index for the current edge based upon the specified index.

The index can be either 0 or 1 since an edge is made up of exactly two vertices.

Parameters
[in]indexThe vertex index in current edge (0 or 1)
[out]ReturnStatusStatus code
Returns
The index in the vertex list of the edge vertex requested
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
int index ( MStatus ReturnStatus = NULL) const

This method returns the index of the current edge in the iteration.

Parameters
[out]ReturnStatusStatus code
Returns
The index of the current edge in the iteration
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MObject edge ( MStatus ReturnStatus = NULL)

Deprecated in 2016.0

Get the current edge in the iteration as a component.

Deprecated:
Use MItMeshEdge::currentItem instead.
2016.0:
Deprecated in this version.

Components are used to specify one or more edges and are usefull in operating on groups of non-contiguous edges for a surface. Components do not contain any information about the surface that they refer to so an MDagPath must be specified when dealing with components.

Parameters
[out]ReturnStatusStatus code
Returns
The current edge in the interation
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInsufficientMemory No memory available.
  • MS::kFailure An object error has occurred.
MObject currentItem ( MStatus ReturnStatus = NULL)

Get the current edge in the iteration as a component.

Components are used to specify one or more edges and are usefull in operating on groups of non-contiguous edges for a surface. Components do not contain any information about the surface that they refer to so an MDagPath must be specified when dealing with components.

Parameters
[out]ReturnStatusStatus code
Returns
The current edge in the interation
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInsufficientMemory No memory available.
  • MS::kFailure An object error has occurred.
MStatus updateSurface ( )

Signal that this polygonal surface has changed and needs to redraw itself.

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus geomChanged ( )

Reset the geom pointer in the MItMeshEdge.

If you're using MFnMesh to update Normals or Color per vertex while iterating, you must call geomChanged on the iterator immediately after the MFnMesh call to make sure that your geometry is up to date. A crash may result if this method is not called.

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus setIndex ( int  index,
int &  prevIndex 
)

This method sets the index of the current edge to be accessed.

The current edge will no longer be in sync with any previous iteration.

Parameters
[in]indexThe index of desired edge to access.
[out]prevIndexIndex of the edge which was current before the change.
Returns
The index of the current edge in the iteration
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
int getConnectedFaces ( MIntArray faces,
MStatus ReturnStatus = NULL 
) const

This method returns an array containing the indices of the faces connected to the current edge.

Normally a boundary edge will only have one face connected to it and an internal edge will have two, but if the mesh has manifold geometry then the edge may have three or more faces connected to it.

Parameters
[out]facesArray of face indices.
[out]ReturnStatusStatus code
Returns
Number of connected faces
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
int getConnectedEdges ( MIntArray edges,
MStatus ReturnStatus = NULL 
) const

This method returns a list of edges connected to the current edge.

Parameters
[out]edgesArray of edge indices.
[out]ReturnStatusStatus code
Returns
Number of connected edges
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus numConnectedFaces ( int &  faceCount) const

This method returns the number of faces (1 or 2 ) connected to the current edge.

Parameters
[in]faceCountNumber of connected faces
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus numConnectedEdges ( int &  edgeCount) const

This method returns the number of edges connected to the current edge.

Parameters
[out]edgeCountNumber of connected edges.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool connectedToFace ( int  index,
MStatus ReturnStatus = NULL 
)

This method determines whether the given face contains the current edge.

Parameters
[in]indexIndex of face to check.
[out]ReturnStatusStatus code
Returns
Boolean value: true if contained, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool connectedToEdge ( int  index,
MStatus ReturnStatus = NULL 
)

This method determines whether the given edge is connected to the current edge.

Parameters
[in]indexIndex of edge to check.
[in]ReturnStatusStatus code
Returns
Boolean value: true if contained, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool onBoundary ( MStatus ReturnStatus = NULL)

This method checks to see if the current edge is a border edge.

NOTE: it is possible to turn all edges into boundaries by extracting faces. In this case, onBoundary() will always return true even though it appears that there are internal edges.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true if it's a border edge, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus getLength ( double &  length,
MSpace::Space  space = MSpace::kObject 
)

This method returns the length of the current edge.

Parameters
[in]lengthlength of edge
[in]spaceCoordinate space in which to perform the operation.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid coordinate space given.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

The documentation for this class was generated from the following files: