pymel.core.animation.lattice

lattice(*args, **kwargs)

This command creates a lattice deformer that will deform the selected objects. If the object centered flag is used, the initial lattice will fit around the selected objects. The lattice will be selected when the command is completed. The lattice deformer has an associated base lattice. Only objects which are contained by the base lattice will be deformed by the lattice.

Flags:
Long name (short name) Argument Types Properties
after (af) bool ../../../_images/create.gif ../../../_images/edit.gif
 

If the default behavior for insertion/appending into/onto the existing chain is not what you want then you can use this flag to force the command to stick the deformer node after the selected node in the chain even if a new geometry shape has to be created in order to do so. Works in create mode (and edit mode if the deformer has no geometry added yet).

afterReference (ar) bool ../../../_images/create.gif ../../../_images/edit.gif
 

The -afterReference flag is used to specify deformer ordering in a hybrid way that choses between -before and -after automatically. If the geometry being deformed is referenced then -after mode is used in adding the new deformer otherwise -before mode is used. The net effect when using -afterReference to build deformer chains is that internal shape nodes in the deformer chain will only appear at reference file boundaries, leading to lightweight deformer networks that may be more amicable to reference swapping.

before (bf) bool ../../../_images/create.gif ../../../_images/edit.gif
 

If the default behavior for insertion/appending into/onto the existing chain is not what you want then you can use this flag to force the command to stick the deformer node before the selected node in the chain even if a new geometry shape has to be created in order to do so. Works in create mode (and edit mode if the deformer has no geometry added yet).

commonParent (cp) bool ../../../_images/create.gif
 

Group the base lattice and the deformed lattice under a common transform. This means that you can resize the lattice without affecting the deformation by resizing the common transform.

deformerTools (dt) bool ../../../_images/query.gif
 
Returns the name of the deformer tool objects (if any) as string string ...
divisions (dv) int, int, int ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

Set the number of lattice slices in x, y, z. Default is 2, 5, 2. When queried, this flag returns float float float. When you change the number of divisions, any tweaking or animation of lattice points must be redone.

dualBase (db) bool ../../../_images/create.gif
 

Create a special purpose ffd deformer node which accepts 2 base lattices. The default is off which results in the creation of a normal ffd deformer node. Intended for internal usage only.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

exclusive (ex) unicode ../../../_images/create.gif ../../../_images/query.gif
 
Puts the deformation set in a deform partition.
freezeMapping (fm) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

The base position of the geometries points is fixed at the time this flag is set. When mapping is frozen, moving the geometry with respect to the lattice will not cause the deformation to be recomputed.

frontOfChain (foc) bool ../../../_images/create.gif ../../../_images/edit.gif
 

This command is used to specify that the new deformer node should be placed ahead (upstream) of existing deformer and skin nodes in the shape’s history (but not ahead of existing tweak nodes). The input to the deformer will be the upstream shape rather than the visible downstream shape, so the behavior of this flag is the most intuitive if the downstream deformers are in their reset (hasNoEffect) position when the new deformer is added. Works in create mode (and edit mode if the deformer has no geometry added yet).

geometry (g) unicode ../../../_images/query.gif ../../../_images/edit.gif
 

The specified object will be added to the list of objects being deformed by this deformer object, unless the -rm flag is also specified. When queried, this flag returns string string string ...

geometryIndices (gi) bool ../../../_images/query.gif
 
Complements the -geometry flag in query mode. Returns the multi index of each geometry.
ignoreSelected (ignoreSelected) bool ../../../_images/create.gif
 
Tells the command to not deform objects on the current selection list
latticeReset (lr) bool ../../../_images/edit.gif
 

Reset the lattice to match its base position. This will undo any deformations that the lattice is causing. The lattice will only deform points that are enclosed within the lattice’s reset (base) position.

ldivisions (ldv) int, int, int ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Set the number of local lattice slices in x, y, z.
name (n) unicode ../../../_images/create.gif
 
Used to specify the name of the node being created
objectCentered (oc) bool ../../../_images/create.gif
 
Centers the lattice around the selected object(s) or components. Default is off which centers the lattice at the origin.
| .. |
ofd)** | float | .. image:: /images/create.gif |
 

Set the falloff distance used when the setting for transforming points outside of the base lattice is set to 2. The distance value is a positive number which specifies the size of the falloff distance as a multiple of the base lattice size, thus a value of 1.0 specifies that only points up to the base lattice width/height/depth away are transformed. A value of 0.0 is equivalent to an outsideLattice value of 0 (i.e. no points outside the base lattice are transformed). A huge value is equivalent to transforming an outsideLattice value of 1 (i.e. all points are transformed).

outsideLattice (ol) int ../../../_images/create.gif
 

Set the mode describing how points outside the base lattice are transformed. 0 (the default) specifies that no outside points are transformed. 1 specifies that all outside points are transformed, and 2 specifies that only those outside points which fall within the “falloff distance” (see the -ofd/outsideFalloffDistance flag) are transformed. When querying, the current setting for the lattice is returned.

parallel (par) bool ../../../_images/create.gif ../../../_images/edit.gif
 

Inserts the new deformer in a parallel chain to any existing deformers in the history of the object. A blendShape is inserted to blend the parallel results together. Works in create mode (and edit mode if the deformer has no geometry added yet).

position (pos) float, float, float ../../../_images/create.gif
 
Used to specify the position of the newly created lattice.
prune (pr) bool ../../../_images/edit.gif
 
Removes any points not being deformed by the deformer in its current configuration from the deformer set.
remove (rm) bool ../../../_images/edit.gif
 
Specifies that objects listed after the -g flag should be removed from this deformer.
removeTweaks (rt) bool ../../../_images/edit.gif
 
Remove any lattice deformations caused by moving lattice points. Translations/rotations and scales on the lattice itself are not removed.
rotation (ro) float, float, float ../../../_images/create.gif
 
Used to specify the initial rotation of the newly created lattice.
scale (s) float, float, float ../../../_images/create.gif
 
Used to specify the initial scale of the newly created lattice.
split (sp) bool ../../../_images/create.gif ../../../_images/edit.gif
 

Branches off a new chain in the dependency graph instead of inserting/appending the deformer into/onto an existing chain. Works in create mode (and edit mode if the deformer has no geometry added yet).

Derived from mel command maya.cmds.lattice

Example:

import pymel.core as pm

import maya.cmds as cmds

# to create a 4x5x4 lattice centered around the sphere
#
pm.sphere();
pm.lattice( dv=(4, 5, 4), oc=True )
# Result: [nt.Ffd(u'ffd1'), nt.Transform(u'ffd1Lattice'), nt.Transform(u'ffd1Base')] #

# to edit the lattice divisions to be 6x6x6
#
pm.lattice( 'ffd1', e=True, dv=(6, 6, 6) )

# move a point on the lattice
pm.select('ffd1Lattice.pt[2][2][5]',r=True)
pm.move(0,0,3,r=True)

# to reset the lattice
#
pm.lattice( 'ffd1', e=True, lr=True )

Previous topic

pymel.core.animation.keyingGroup

Next topic

pymel.core.animation.listAnimatable

Core

Core Modules

Other Modules

This Page