Public Member Functions | Protected Member Functions

MFnLatticeDeformer Class Reference

Search for all occurrences

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.

#include <MFnLatticeDeformer.h>

Inheritance diagram for MFnLatticeDeformer:
Inheritance graph
[legend]

List of all members.

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)
 Creates a new lattice deformer with the given number of divisions.
MStatus addGeometry (const MObject &object)
 Adds a piece of geometry to the deformation.
MStatus removeGeometry (const MObject &object)
 Removes a piece of geometry from the deformation.
MStatus getAffectedGeometry (MObjectArray &objects)
 The geometry affected by this deformer is packed into the provided list of MObjects.
MStatus getDivisions (unsigned int &x, unsigned int &y, unsigned int &z)
 Retrieve the number of divisions in each of the X, Y, and Z directions.
MStatus setDivisions (unsigned int x, unsigned int y, unsigned int z)
 Set the number of divisions in each of the X, Y, and Z directions.
MStatus resetLattice (bool centerLattice=false)
 This method resets the deformed lattice to match the base lattice.
MObject deformLattice (MStatus *ReturnStatus=NULL)
 This returns the deformed version of the lattice.
MObject baseLattice (MStatus *ReturnStatus=NULL)
 This returns the base version of the lattice that describes the region of space deformed by the lattice.
 MFnLatticeDeformer (const MObject &object, MStatus *ReturnStatus=NULL)
 Constructor.

Protected Member Functions

virtual const char * className () const
 Class name.

Constructor & Destructor Documentation

MFnLatticeDeformer ( MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

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

Parameters:
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:
MFnLatticeDeformer ( const MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

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

Parameters:
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:

Member Function Documentation

MFn::Type type ( ) const [virtual]

Function set type.

Return the class type : MFn::kFFD.

Reimplemented from MFnDependencyNode.

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

Class name.

Return the class name : "MFnLatticeDeformer".

Reimplemented from MFnDependencyNode.

MObject 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]xDivnumber of divisions in x (must be at least 2)
[in]yDivnumber of divisions in y (must be at least 2)
[in]zDivnumber of divisions in z (must be at least 2)
[out]ReturnStatusreturn status
Returns:
Returns a handle to the new deformer
Status Codes:
Examples:
latticeNoiseCmd.cpp.
MStatus 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]objectthe geometry
Returns:
Return status
Status Codes:
Examples:
latticeNoiseCmd.cpp.
MStatus removeGeometry ( const MObject object)

Removes a piece of geometry from the deformation.

Parameters:
[in]objectthe geometry
Returns:
Return status
Status Codes:
MStatus 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]objectsstorage for the returned array
Returns:
Return status
Status Codes:
MStatus 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]xa reference parameter that on return contains the number of divisions in the X direction
[out]ya reference parameter that on return contains the number of divisions in the Y direction
[out]za reference parameter that on return contains the number of divisions in the Z direction
Returns:
Return status
Status Codes:
MStatus 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]xnumber of divisions in the X direction
[in]ynumber of divisions in the Y direction
[in]znumber of divisions in the Z direction
Returns:
Return status
Status Codes:
MStatus 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]centerLatticewhether 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:
latticeNoiseCmd.cpp.
MObject 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]ReturnStatusreturn 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:
latticeNoiseCmd.cpp.
MObject 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]ReturnStatusreturn 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

MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer
MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer MFnLatticeDeformer