- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

# MFnLatticeDeformer Class Reference

# OpenMayaAnim - API module for animation | FunctionSet classes

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:
[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] | object | The MObject to attach the function set to
  [out] | ReturnStatus | the return status

Status Codes:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

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:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

## Member Function Documentation

MFn::Type type | ( |  | ) | const `[virtual]`

Search for all occurrences

Function set type.

Return the class type : MFn::kFFD.

Reimplemented from MFnDependencyNode.

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

Search for all occurrences

Class name.

Return the class name : "MFnLatticeDeformer".

Reimplemented from MFnDependencyNode.

MObject create | ( | unsigned int | xDiv,
|  | unsigned int | yDiv,
|  | unsigned int | zDiv,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

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:
  - MS::kSuccess operation successful
  - MS::kFailure unexpected failure
  - MS::kLicenseFailure application not licensed for attempted operation
  - MS::kInsufficientMemory out of memory

Examples:
  latticeNoiseCmd.cpp.

MStatus addGeometry | ( | const MObject & | object | ) |

Search for all occurrences

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:
  - MS::kSuccess operation successful
  - MS::kFailure addition of geometry failed
  - MS::kInsufficientMemory out of memory

Examples:
  latticeNoiseCmd.cpp.

MStatus removeGeometry | ( | const MObject & | object | ) |

Search for all occurrences

Removes a piece of geometry from the deformation.

Parameters:

  [in] | object | the geometry

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure addition of geometry failed
  - MS::kInsufficientMemory out of memory

MStatus getAffectedGeometry | ( | MObjectArray & | objects | ) |

Search for all occurrences

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:
  - MS::kSuccess operation successful
  - MS::kFailure function set doesn not have a valid object
  - MS::kInsufficientMemory out of memory

MStatus getDivisions | ( | unsigned int & | x,
|  | unsigned int & | y,
|  | unsigned int & | z
| ) |  |

Search for all occurrences

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:
  - MS::kSuccess operation successful
  - MS::kFailure function set doesn not have a valid object
  - MS::kInsufficientMemory out of memory

MStatus setDivisions | ( | unsigned int | x,
|  | unsigned int | y,
|  | unsigned int | z
| ) |  |

Search for all occurrences

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:
  - MS::kSuccess operation successful
  - MS::kFailure function set doesn not have a valid object
  - MS::kInsufficientMemory out of memory

MStatus resetLattice | ( | bool | centerLattice = `false` | ) |

Search for all occurrences

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:
  latticeNoiseCmd.cpp.

MObject deformLattice | ( | MStatus * | ReturnStatus = `NULL` | ) |

Search for all occurrences

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:
  latticeNoiseCmd.cpp.

MObject baseLattice | ( | MStatus * | ReturnStatus = `NULL` | ) |

Search for all occurrences

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

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