Module Lattice :: Class Lattice

Class Lattice

source code

The Lattice object

This object gives access to Lattices in Blender.

Instance Methods
string
getName()
Get the name of this Lattice datablock.
source code
 
setName(name)
Set the name of this Lattice datablock.
source code
list of ints
getPartitions()
Gets the number of 'walls' or partitions that the Lattice has in the x, y, and z dimensions.
source code
 
setPartitions(x, y, z)
Set the number of 'walls' or partitions that the Lattice will be created with in the x, y, and z dimensions.
source code
list of strings
getKeyTypes()
Returns the deformation key types for the x, y, and z dimensions of the Lattice.
source code
 
setKeyTypes(xType, yType, zType)
Sets the deformation key types for the x, y, and z dimensions of the Lattice.
source code
string
getMode()
Returns the current Lattice mode
source code
 
setMode(modeType)
Sets the current Lattice mode There are two Lattice modes possible:
source code
list of floats
getPoint(index)
Returns the coordinates of a point in the Lattice by index.
source code
 
setPoint(index, position)
Sets the coordinates of a point in the Lattice by index.
source code
Key.Key
getKey()
Returns the Key.Key object associated with this Lattice.
source code
 
insertKey(frame)
Inserts the current state of the Lattice as a new absolute keyframe
source code
Lattice
__copy__()
Make a copy of this lattice
source code
Class Variables
  key
The Key.Key object associated with this Lattice or None.
Instance Variables
  depth
The number of z dimension partitions.
  depthType
The z dimension key type.
bool fakeUser
When set to True, this datablock wont be removed, even if nothing is using it.
  height
The number of y dimension partitions.
  heightType
The y dimension key type.
  latSize
The number of points in this Lattice (width*height*depth).
string or None lib
path to the blend file this datablock is stored in (readonly).
  mode
The current mode of the Lattice.
string name
unique name within each blend file.
IDGroup properties
Returns an IDGroup reference to this datablocks's ID Properties.
bool tag
A temporary tag that to flag data as being used within a loop.
int users
The number of users this datablock has.
  width
The number of x dimension partitions.
  widthType
The x dimension key type.
Method Details

getName()

source code 
Get the name of this Lattice datablock.
Returns: string
The name of the Lattice datablock.

setName(name)

source code 
Set the name of this Lattice datablock.
Parameters:
  • name (string) - The new name.

getPartitions()

source code 
Gets the number of 'walls' or partitions that the Lattice has in the x, y, and z dimensions.
Returns: list of ints
A list corresponding to the number of partitions: [x,y,z]

setPartitions(x, y, z)

source code 
Set the number of 'walls' or partitions that the Lattice will be created with in the x, y, and z dimensions.
Parameters:
  • x (int) - The number of partitions in the x dimension of the Lattice.
  • y (int) - The number of partitions in the y dimension of the Lattice.
  • z (int) - The number of partitions in the z dimension of the Lattice.

getKeyTypes()

source code 
Returns the deformation key types for the x, y, and z dimensions of the Lattice.
Returns: list of strings
A list corresponding to the key types will be returned: [x,y,z]

setKeyTypes(xType, yType, zType)

source code 
Sets the deformation key types for the x, y, and z dimensions of the Lattice. There are three key types possible:
  • Lattice.CARDINAL
  • Lattice.LINEAR
  • Lattice.BSPLINE
Parameters:
  • xType (enum constant) - the deformation key type for the x dimension of the Lattice
  • yType (enum constant) - the deformation key type for the y dimension of the Lattice
  • zType (enum constant) - the deformation key type for the z dimension of the Lattice

getMode()

source code 
Returns the current Lattice mode
Returns: string
A string representing the current Lattice mode

setMode(modeType)

source code 
Sets the current Lattice mode There are two Lattice modes possible:
  • Lattice.GRID
  • Lattice.OUTSIDE
Parameters:
  • modeType (enum constant) - the Lattice mode

getPoint(index)

source code 
Returns the coordinates of a point in the Lattice by index.
Parameters:
  • index (int) - The index of the point on the Lattice you want returned
Returns: list of floats
The x,y,z coordiates of the Lattice point : [x,y,z]

setPoint(index, position)

source code 
Sets the coordinates of a point in the Lattice by index.
Parameters:
  • index (int) - The index of the point on the Lattice you want set
  • position (list of floats) - The x,y,z coordinates that you want the point to be: [x,y,z]

getKey()

source code 
Returns the Key.Key object associated with this Lattice.
Returns: Key.Key
A key object representing the keyframes of the lattice or None.

insertKey(frame)

source code 

Inserts the current state of the Lattice as a new absolute keyframe

Example:
       for z in range(5):
               for y in range(125):
                       vec = myLat.getPoint(y)
                       co1 = vec[0] + vec[2]
                       co2 = vec[1] - vec[2]
                       co3 = vec[2] + vec[1]
                       myLat.setPoint(y,[co1,co2,co3])
               w = (z + 1) * 10
               myLat.insertKey(w)
Parameters:
  • frame (int) - the frame at which the Lattice will be set as a keyframe

__copy__()

source code 
Make a copy of this lattice
Returns: Lattice
a copy of this lattice

Instance Variable Details

fakeUser

When set to True, this datablock wont be removed, even if nothing is using it. All data has this disabled by default except for Actions.
Type:
bool

lib

path to the blend file this datablock is stored in (readonly).

lib will be None unless you are using external blend files with (File, Append/Link)

Note: the path may be relative, to get the full path use Blender.sys.expandpath
Type:
string or None

name

unique name within each blend file.

The name is case sensitive and 21 characters maximum length.

Note: a blend file may have naming collisions when external library data is used, be sure to check the value of lib.

Note: Setting a value longer then 21 characters will be shortened
Type:
string

tag

A temporary tag that to flag data as being used within a loop. always set all tags to True or False before using since blender uses this flag for its own internal operations.
Type:
bool

users

The number of users this datablock has. (readonly) Zero user datablocks are de-allocated after reloading and saving.
Type:
int