class MItSurfaceCV

Jump to documentation

NURBS surface CV iterator. (OpenMaya) (OpenMaya.py)

public members:

MItSurfaceCV ( MObject & surface, bool useURows = true, MStatus * ReturnStatus = NULL )
MItSurfaceCV ( const MDagPath & surface, MObject & component = MObject::kNullObj , bool useURows = true, MStatus * ReturnStatus = NULL )
virtual ~MItSurfaceCV ()
bool isDone ( MStatus * ReturnStatus = NULL ) const
bool isRowDone ( MStatus * ReturnStatus = NULL ) const
MStatus next ()
MStatus nextRow ()
MStatus reset ()
MStatus reset ( MObject & surface, bool useURows = true )
MStatus reset ( const MDagPath & surface, MObject & component, bool useURows = true )
MPoint position ( MSpace::Space space = MSpace::kObject , MStatus * ReturnStatus = NULL ) const
MStatus setPosition ( const MPoint & point, MSpace::Space space = MSpace::kObject )
MStatus translateBy ( const MVector & vector, MSpace::Space space = MSpace::kObject )
int index ( MStatus * ReturnStatus = NULL ) const
MStatus getIndex ( int& indexU, int& indexV ) const
MObject cv ( MStatus * ReturnStatus = NULL ) const
OBSOLETE
MObject currentItem ( MStatus * ReturnStatus = NULL ) const
bool hasHistoryOnCreate ( MStatus * ReturnStatus = NULL ) const
MStatus updateSurface ()

Documentation

Iterate over CVs in a NURBS surface.
Description

Iterator class for NURBS surface CVs.

Example: Translates the CVs for a surface in the X direction (world space).

    MItSurfaceCV cvIter( surface, true, &stat );
    MVector vector(1.0,0.0,0.0);

    if ( MS::kSuccess == stat ) {
        for ( ; !cvIter.isDone(); cvIter.nextRow() )
        {
            for ( ; !cvIter.isRowDone(); cvIter.next() )
            {
                cvIter.translateBy( vector, MSpace::kWorld );
            }
        }
        cvIter.updateSurface();    // Tell surface is has been changed
    }
    else {
        cerr << "Error creating iterator!" << endl;
    }

Functions

MItSurfaceCV:: MItSurfaceCV ( MObject & surface, bool useURows, MStatus * ReturnStatus )

Description

Constructor. This constructor is used when iterating over all the CVs on the given surface.

Arguments

  • surface The surface for the iteration
  • useURows If true then the iterator will iterate in the U direction, otherwise it will be in the V direction.
  • ReturnStatus Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MItSurfaceCV:: MItSurfaceCV ( const MDagPath & surface, MObject & component, bool useURows, MStatus * ReturnStatus )

Description

Constructor. This constructor is used when iterating over a group of CVs. If the component is not given then the iteration will be for the whole surface.

Arguments

  • surface The surface for the iteration
  • component A group of CVs to be iterated on
  • useURows If true then the iterator will iterate in the U direction, otherwise it will be in the V direction.
  • ReturnStatus Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MItSurfaceCV:: ~MItSurfaceCV ()

Description

Class destructor.

MStatus MItSurfaceCV:: reset ()

Description

Reset the iterator to the first CV.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MItSurfaceCV:: isDone ( MStatus * ReturnStatus ) const

Description

Returns true if the iteration is finished, i.e. there are no more CVs to iterate on.

Arguments

  • ReturnStatus Status code

Return Value

  • true There are no more CVs to iterate on
  • false There are more CVs in the iteration

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MItSurfaceCV:: isRowDone ( MStatus * ReturnStatus ) const

Description

Returns true if the current row has no more CVs to iterate over. The row can be in the U or V direction depending on what value of useURows has been set in the constructor.

Arguments

  • ReturnStatus Status code

Return Value

  • true The current row in the iteration is finished
  • false There are more CVs to iterate over in the current row

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MItSurfaceCV:: next ()

Description

Advance to the next CV in the iteration. If the iterator is already at the last CV then this method has no effect. Use isDone to determine if the iterator is at the last CV.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MItSurfaceCV:: nextRow ()

Description

Advance to the next row in the iteration. The row can be in the U or V direction depending on what value of useURows has been set in the constructor.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MItSurfaceCV:: reset ( MObject & surface, bool useURows )

Description

Reset the iterator to iterate over all CVs on the specified surface.

Arguments

  • surface The surface for the iteration
  • useURows If true then the iterator will iterate in the U direction, otherwise it will be in the V direction.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MItSurfaceCV:: reset ( const MDagPath & surface, MObject & component, bool useURows )

Description

Reset the iterator to iterate over the CVs of the given surface that are specified in the given component. If the component is NULL then the iteration will be over all CVs on the surface.

Arguments

  • surface The surface for the iteration
  • component A group of CVs to be iterated on
  • useURows If true then the iterator will iterate in the U direction, otherwise it will be in the V direction.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MPoint MItSurfaceCV:: position ( MSpace::Space space, MStatus * ReturnStatus ) const

Description

Returns the position of the current CV in the iteration in the specified space.

Arguments

  • space The coordinate space in which the CV is set
  • ReturnStatus Status code

Return Value

  • The position of the current CV in the iteration

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MItSurfaceCV:: setPosition ( const MPoint & point, MSpace::Space space )

Description

Set the position of the current CV in the iteration to the specified point.

Arguments

  • point The new position for the current CV in the iteration
  • space The coordinate space in which the CV is set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MItSurfaceCV:: translateBy ( const MVector & vector, MSpace::Space space )

Description

Move the current CV in the iteration by the sepcified vector.

Arguments

  • vector The translation vector
  • space The coordinate space in which the CV is set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MItSurfaceCV:: index ( MStatus * ReturnStatus ) const

Description

Get the index of the current CV as it appears in CV array for this surface.

The index returned is a single index. To convert this into a double (U,V) index:

    sizeInV = MFnNurbsSurfaceInstance.numCVsInV();
    indexU = index() / sizeInV;
    indexV = index() % sizeInV;
	

Arguments

  • ReturnStatus Status code

Return Value

  • The index for the current CV in the iteration

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MItSurfaceCV:: getIndex ( int& indexU, int& indexV ) const

Description

Get the index of the current CV as it appears in CV array for this surface.

The index returned is a double (U,V) index. To convert this into a single index:

	index = numCVsInV()*indexU + indexV
	

Arguments

  • indexU Storage for the u index
  • indexV Storage for the v index

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MObject MItSurfaceCV:: cv ( MStatus * ReturnStatus ) const

Description

This method is OBSOLETE, please use the currentItem method.

Get the current CV in the iteration as a component.

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

Arguments

  • ReturnStatus Status code

Return Value

  • The current CV in the interation

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInsufficientMemory No memory available.
  • MS::kFailure An object error has occurred.

MObject MItSurfaceCV:: currentItem ( MStatus * ReturnStatus ) const

Description

Get the current CV in the iteration as a component.

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

Arguments

  • ReturnStatus Status code

Return Value

  • The current CV in the interation

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInsufficientMemory No memory available.
  • MS::kFailure An object error has occurred.

bool MItSurfaceCV:: hasHistoryOnCreate ( MStatus * ReturnStatus ) const

Description

This method determines if the shape was created with history.

If the object that this iterator is attached to is not a shape then this method will fail.

Arguments

  • ReturnStatus

Return Value

  • true shape has history
  • false shape does not have history

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MItSurfaceCV:: updateSurface ()

Description

This method is used to signal the surface that it has been changed and needs to redraw itself.

When modifying a large number of CVs, it is most efficient to call this method after all of the CVs have been modified.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright