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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

# MFnLattice Class Reference
OpenMayaAnim - API module for animation | FunctionSet classes

This reference page is linked to from the following overview topics: Using the Maya Python API.

Search for all occurrences

## Detailed Description

Lattice function set.

MFnLattice is the function set for lattice shapes and lattice geometry. It can be used on lattices in the DAG or on lattice geometry from a dependency node attribute.

Lattices are most commonly used for specifying FFDs (free-form deformations). See MFnLatticeDeformer for more information on those.

MFnLatticeData can be used to create new lattice data objects for use with dependency node attributes.

Examples:

  latticeNoiseCmd.cpp, and latticeNoiseNode.cpp.

`#include <MFnLattice.h>`

Inheritance diagram for MFnLattice:
[legend]

List of all members.

## Public Member Functions
virtual MFn::Type | type () const
| Function set type.
virtual | ~MFnLattice ()
| Destructor.
| MFnLattice ()
| Default constructor.
| MFnLattice (MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
| MFnLattice (const MDagPath &object, MStatus *ret=NULL)
| Constructor.
MObject | create (unsigned int xDiv, unsigned int yDiv, unsigned int zDiv, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
| Create a new lattice.
MStatus | reset (double sSize=1.0, double tSize=1.0, double uSize=1.0)
| Reset the lattice points to a uniform parallelipiped shape with the specified dimensions: sSize x tSize x uSize.
MStatus | getDivisions (unsigned int &s, unsigned int &t, unsigned int &u)
| Get the number of divisions in the lattice.
MStatus | setDivisions (unsigned int s, unsigned int t, unsigned int u)
| Set the number of divisions in the lattice.
MPoint & | point (unsigned int s, unsigned int t, unsigned int u, MStatus *ReturnStatus=NULL)
| Returns the point in the lattice that is at the given indices.
| MFnLattice (const MObject &object, MStatus *ret=NULL)
| Constructor.
## Protected Member Functions
virtual const char * | className () const
| Class name.

## Constructor & Destructor Documentation

~MFnLattice | ( |  | ) | `[virtual]`

Destructor.

Class destructor.

MFnLattice | ( | 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

MFnLattice | ( | const MDagPath & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

Class constructor that initializes the function set to the given constant MDagPath object.

Parameters:

  [in] | object | The const MDagPath 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

MFnLattice | ( | 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::kLattice.

Reimplemented from MFnDagNode.

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

Search for all occurrences

Class name.

Return the class name : "MFnLattice".

Reimplemented from MFnDagNode.

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

Search for all occurrences

Create a new lattice.

This can be used to create either a new lattice shape in the DAG, or to place new lattice geometry into a dependency graph lattice data object. Lattice data objects can be created with MFnLatticeData or can be obtained from an MDataHandle in the compute method of a dependency node.

The parentOrOwner argument is used to specify the owner of the new lattice.

If parentOrOwner is a kLatticeData data wrapper (e.g. as returned by MFnLatticeData::create) then a new kLattice object will be created and placed inside the wrapper. No nodes will be created and the method will return the kLattice object.

If parentOrOwner is NULL then new lattice and transform nodes will be created and added to the DAG, with the lattice parented under the transform. The method will return the transform node.

If parentOrOwner is a DAG node then a new lattice node will be created and parented under that DAG node. The method will return the lattice node.

Parameters:

  [in] | xDiv | Lattice divisions in x (must be at least 2).
  [in] | yDiv | Lattice divisions in y (must be at least 2).
  [in] | zDiv | Lattice divisions in z (must be at least 2).
  [in] | parentOrOwner | Parent node or data wrapper. See discussion above.
  [out] | ReturnStatus | Status code.

Returns:
  A handle to the new lattice data, lattice node or transform node. See the discussion of the parentOrOwner parameter above for more details.

Status Codes:
  - MS::kSuccess Operation successful.
  - MS::kFailure Unexpected failure.
  - MS::kInsufficientMemory Out of memory.
  - MS::kLicenseFailure Application not licensed for attempted operation.

MStatus reset | ( | double | sSize = `1.0`,
|  | double | tSize = `1.0`,
|  | double | uSize = `1.0`
| ) |  |

Search for all occurrences

Reset the lattice points to a uniform parallelipiped shape with the specified dimensions: sSize x tSize x uSize.

Parameters:

  [in] | sSize | size in s dimension
  [in] | tSize | size in t dimension
  [in] | uSize | size in u dimension

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure function set does not have a valid object

MStatus getDivisions | ( | unsigned int & | s,
|  | unsigned int & | t,
|  | unsigned int & | u
| ) |  |

Search for all occurrences

Get the number of divisions in the lattice.

Parameters:

  [out] | s | divisions in s dimension
  [out] | t | divisions in t dimension
  [out] | u | divisions in u dimension

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure function set does not have a valid object

MStatus setDivisions | ( | unsigned int | s,
|  | unsigned int | t,
|  | unsigned int | u
| ) |  |

Search for all occurrences

Set the number of divisions in the lattice.

Parameters:

  [in] | s | divisions in s dimension
  [in] | t | divisions in t dimension
  [in] | u | divisions in u dimension

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure function set does not have a valid object

MPoint & point | ( | unsigned int | s,
|  | unsigned int | t,
|  | unsigned int | u,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Returns the point in the lattice that is at the given indices.

Parameters:

  [in] | s | s index
  [in] | t | t index
  [in] | u | u index
  [out] | ReturnStatus | return status

Returns:
  The point

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure function set does not have a valid object
  - MS::kInvalidParameter an index is out of range

MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice
MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice MFnLattice