Sets values of built-in fluid attributes such as density, velocity, etc., for individual grid cells or for all cells in the grid.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
addValue (ad) | bool | ||
|
|||
attribute (at) | unicode | ||
|
|||
clear (cl) | bool | ||
|
|||
floatRandom (fr) | float | ||
If this was a scalar (e.g. density) attribute, use a random value in +-VALUE If fv is specified, it is used as the base value and combined with the random value. If the fv flag is not specified, the base is assumed to be 0. |
|||
floatValue (fv) | float | ||
|
|||
lowerFace (lf) | bool | ||
Only valid with -at velocity. Since velocity values are stored on the edges of each voxel and not at the center, using voxel based indices to set velocity necessarily affects neighboring voxels. Use this flag to only set velocity components on the lower left three faces of a voxel, rather than all six. Flag can have multiple arguments, passed either as a tuple or a list. |
|||
reset (re) | bool | ||
|
|||
vectorRandom (vr) | float, float, float | ||
If this was a vector (e.g. velocity) attribute, use a random value in +-VALUE If vv is specified, it is used as the base value and combined with the random value. If the vv flag is not specified, the base is assumed to be 0,0,0. |
|||
vectorValue (vv) | float, float, float | ||
|
|||
xIndex (xi) | int | ||
|
|||
xvalue (x) | bool | ||
|
|||
yIndex (yi) | int | ||
|
|||
yvalue (y) | bool | ||
|
|||
zIndex (zi) | int | ||
|
|||
zvalue (z) | bool | ||
|
Derived from mel command maya.cmds.setFluidAttr
Example:
import pymel.core as pm
# set density for entire fluid
pm.setFluidAttr( at='density', fv=1.0 )
# add 3.5 to the density at the cell x=1, y=2, z=3
pm.setFluidAttr( at='density', ad=True, fv-3.5, xi=1, yi=2, zi=3 )
# clear the density for the whole fluid
pm.setFluidAttr( at='density', cl=True )
# reset the velocity at the cell x=1, y=2, z=3
pm.setFluidAttr( at='velocity', re=True, xi=1, yi=2, zi=3 )
# set the velocity at the centers of the voxels on plane y=5
# to approximately (-1, 0, 0)
pm.setFluidAttr( at='velocity', vv=(-1, 0, 0), yi=5 )
# set the Z-component of the velocity at the bottom of cell [0, 0, 0]
# to exactly 1.3
pm.setFluidAttr( at='velocity', z=True, xi=0, yi=0, zi=0, fv=1.3 )
# set the X-component of the velocity at the right of cell [5, 3, 2]
# (which is also the left of cell [6, 3, 2]) to exactly 4.8
pm.setFluidAttr( at='velocity', x=True, xi=5, yi=3, zi=2, fv=4.8 )
# set the density to a random value in the range 0.1 to 0.9
# the fv flag specfies the base value, and then we add a a
# random value in the range of -fr to +fr
pm.setFluidAttr( at='density', fv=0.5, fr=0.4 )