MFnLatticeDeformer Class Reference
[OpenMayaAnim - API module for animationFunctionSet classes]

#include <MFnLatticeDeformer.h>
Inheritance diagram for MFnLatticeDeformer:
Inheritance graph
[legend]
Collaboration diagram for MFnLatticeDeformer:
Collaboration graph
[legend]

List of all members.


Detailed Description

FFD lattice deformer function set.

MFnLatticeDeformer is the function set for lattice deformers. Lattice deformers use FFDs to deform geometry.

The lattice deformer is actually a small network of dependency nodes in the dependency graph. This function set is provided to make manipulation of the network easier. The main deformer node should be given to this function set as its object.

There are two lattices associated with a lattice deformer. There is a base lattice that defines the start position for the lattice. The second lattice is the version that is modified to deform the geometry. The difference between the two lattices defines the deformation that is applied to the geometry.

The base lattice is a very simple shape that only defines a box in space. The base lattice should be modified by using the standard DAG transformation support. The second deformable lattice has geometry that can be modified using the MFnLattice function set.

For a piece of geometry to be modified by this deformer, the geometry must be attached to the deformer (use addGeometry method) and the geometry must be contained within the base lattice. The resetLattice method can be used to make the lattice resize to the bounding box of the attached geometry.

Examples:

latticeNoiseCmd.cpp.


Public Member Functions

virtual MFn::Type  type () const
  Function set type.
virtual  ~MFnLatticeDeformer ()
  Destructor.
  MFnLatticeDeformer ()
  Default constructor.
  MFnLatticeDeformer (MObject &object, MStatus *ReturnStatus=NULL)
  Constructor.
MObject  create (unsigned int xDiv, unsigned int yDiv, unsigned int zDiv, MStatus *ReturnStatus=NULL)
MStatus  addGeometry (const MObject &object)
MStatus  removeGeometry (const MObject &object)
MStatus  getAffectedGeometry (MObjectArray &objects)
MStatus  getDivisions (unsigned int &x, unsigned int &y, unsigned int &z)
MStatus  setDivisions (unsigned int x, unsigned int y, unsigned int z)
MStatus  resetLattice (bool centerLattice=false)
MObject  deformLattice (MStatus *ReturnStatus=NULL)
MObject  baseLattice (MStatus *ReturnStatus=NULL)
  MFnLatticeDeformer (const MObject &object, MStatus *ReturnStatus=NULL)
  Constructor.

Protected Member Functions

virtual const char *  className () const
  Class name.

Constructor & Destructor Documentation

MFnLatticeDeformer::MFnLatticeDeformer ( MObject object,
MStatus ReturnStatus = NULL  
)

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters:
[in]  object  The MObject to attach the function set to
[out]  ReturnStatus  the return status
Status Codes:

MFnLatticeDeformer::MFnLatticeDeformer ( const MObject object,
MStatus ReturnStatus = NULL  
)

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters:
[in]  object  The MObject to attach the function set to
[out]  ReturnStatus  the return status
Status Codes:

Member Function Documentation

MFn::Type MFnLatticeDeformer::type (  )  const [virtual]

Function set type.

Return the class type : MFn::kFFD

Reimplemented from MFnDependencyNode.

const char * MFnLatticeDeformer::className (  )  const [protected, virtual]

Class name.

Return the class name : "MFnLatticeDeformer"

Reimplemented from MFnDependencyNode.

MObject MFnLatticeDeformer::create ( unsigned int  xDiv,
unsigned int  yDiv,
unsigned int  zDiv,
MStatus ReturnStatus = NULL  
)

Creates a new lattice deformer with the given number of divisions. This function set's object is set to be the new lattice node.

Parameters:
[in]  xDiv  number of divisions in x (must be at least 2)
[in]  yDiv  number of divisions in y (must be at least 2)
[in]  zDiv  number of divisions in z (must be at least 2)
[out]  ReturnStatus  return status
Returns:
Returns a handle to the new deformer
Status Codes:
Examples:

MStatus MFnLatticeDeformer::addGeometry ( const MObject object  ) 

Adds a piece of geometry to the deformation.

After adding new geometry to the deformation, one must make sure that the new geometry is contained within the base lattice for the deformation to affect it. The easiest way to do this is to reset the deformation with the flag that causes it to expand the base lattice to the bounding box of all of the contained geometry.

Parameters:
[in]  object  the geometry
Returns:
Return status
Status Codes:
Examples:

MStatus MFnLatticeDeformer::removeGeometry ( const MObject object  ) 

Removes a piece of geometry from the deformation.

Parameters:
[in]  object  the geometry
Returns:
Return status
Status Codes:

MStatus MFnLatticeDeformer::getAffectedGeometry ( MObjectArray objects  ) 

The geometry affected by this deformer is packed into the provided list of MObjects. Each of the MObjects will be a DAG node that has geometry.

Parameters:
[out]  objects  storage for the returned array
Returns:
Return status
Status Codes:

MStatus MFnLatticeDeformer::getDivisions ( unsigned int &  x,
unsigned int &  y,
unsigned int &  z  
)

Retrieve the number of divisions in each of the X, Y, and Z directions. The number of divisions specifies the resolution of the lattice.

Parameters:
[out]  x  a reference parameter that on return contains the number of divisions in the X direction
[out]  y  a reference parameter that on return contains the number of divisions in the Y direction
[out]  z  a reference parameter that on return contains the number of divisions in the Z direction
Returns:
Return status
Status Codes:

MStatus MFnLatticeDeformer::setDivisions ( unsigned int  x,
unsigned int  y,
unsigned int  z  
)

Set the number of divisions in each of the X, Y, and Z directions. The number of divisions specifies the resolution of the lattice.

Parameters:
[in]  x  number of divisions in the X direction
[in]  y  number of divisions in the Y direction
[in]  z  number of divisions in the Z direction
Returns:
Return status
Status Codes:

MStatus MFnLatticeDeformer::resetLattice ( bool  centerLattice = false  ) 

This method resets the deformed lattice to match the base lattice.

The center option will resize the lattice to be the bounding box of all contained geometry. If instanced objects are being deformed, then then centering option will take the first instance found. So, it is possible to get unexpected results when centering around instanced objects.

Parameters:
[in]  centerLattice  whether to center the lattice
Returns:
Return status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure function set doesn not have a valid object or there was an unexpected error
Examples:

MObject MFnLatticeDeformer::deformLattice ( MStatus ReturnStatus = NULL  ) 

This returns the deformed version of the lattice. The deformed lattice is a shape in the DAG and should be modified using the MFnLattice function set.

Parameters:
[out]  ReturnStatus  return status
Returns:
Handle for the deformed lattice shape
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure function set doesn not have a valid object or there was an unexpected error
Examples:

MObject MFnLatticeDeformer::baseLattice ( MStatus ReturnStatus = NULL  ) 

This returns the base version of the lattice that describes the region of space deformed by the lattice. The returned base lattice is a shape in the DAG and can be accessed using the MFnDagNode function set.

Parameters:
[out]  ReturnStatus  return status
Returns:
Handle for the base lattice shape
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure function set doesn not have a valid object or there was an unexpected error

Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6