#include <MFnLatticeDeformer.h>
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.
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.
Class constructor that initializes the function set to the given MObject.
[in] | object | The MObject to attach the function set to |
[out] | ReturnStatus | the return status |
Constructor.
Class constructor that initializes the function set to the given MObject.
[in] | object | The MObject to attach the function set to |
[out] | ReturnStatus | the return status |
MFn::Type MFnLatticeDeformer::type | ( | ) | const [virtual] |
const char * MFnLatticeDeformer::className | ( | ) | const [protected, virtual] |
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.
[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 |
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.
[in] | object | the geometry |
Removes a piece of geometry from the deformation.
[in] | object | the geometry |
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.
[out] | objects | storage for the returned array |
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.
[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 |
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.
[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 |
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.
[in] | centerLattice | whether to center the lattice |
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.
[out] | ReturnStatus | return status |
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.
[out] | ReturnStatus | return status |
Autodesk® Maya® 2010 © 1997-2009 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |