Go to: Synopsis. Return value. Keywords. Flags. Python examples.
setFluidAttr([addValue=boolean], [attribute=string], [clear=boolean], [floatRandom=float], [floatValue=float], [lowerFace=boolean], [reset=boolean], [vectorRandom=[float, float, float]], [vectorValue=[float, float, float]], [xIndex=int], [xvalue=boolean], [yIndex=int], [yvalue=boolean], [zIndex=int], [zvalue=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
setFluidAttr is NOT undoable, NOT queryable, and NOT editable.
Sets values of built-in fluid attributes such as density, velocity, etc.,
for individual grid cells or for all cells in the grid.
None
fluid
addValue, attribute, clear, floatRandom, floatValue, lowerFace, reset, vectorRandom, vectorValue, xIndex, xvalue, yIndex, yvalue, zIndex, zvalue
Long name (short name) |
Argument types |
Properties |
addValue(ad)
|
boolean
|
|
|
Add specified value to attribute
|
|
attribute(at)
|
string
|
|
|
Specifies the fluid attribute for which to set values. Valid
attributes are "velocity", "density", "fuel", "color", "falloff", and "temperature".
|
|
clear(cl)
|
boolean
|
|
|
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
|
|
|
If this was a scalar (e.g. density) attribute, use this value
|
|
lowerFace(lf)
|
boolean
|
|
|
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.
|
|
reset(re)
|
boolean
|
|
|
Set this attribute to default value
|
|
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]
|
|
|
If this was a vector (e.g. velocity) attribute, use this value
|
|
xIndex(xi)
|
int
|
|
|
Only return values for cells with this X index
|
|
xvalue(x)
|
boolean
|
|
|
Only set the first component of the vector-valued attribute specified by
the "-at/attribute" flag.
|
|
yIndex(yi)
|
int
|
|
|
Only return values for cells with this Y index
|
|
yvalue(y)
|
boolean
|
|
|
Only set the second component of the vector-valued attribute specified by
the "-at/attribute" flag.
|
|
zIndex(zi)
|
int
|
|
|
Only return values for cells with this Z index
|
|
zvalue(z)
|
boolean
|
|
|
Only set the third component of the vector-valued attribute specified by
the "-at/attribute" flag.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can have multiple arguments, passed either as a tuple or a list.
|
import maya.cmds as cmds
# set density for entire fluid
cmds.setFluidAttr( at='density', fv=1.0 )
# add 3.5 to the density at the cell x=1, y=2, z=3
cmds.setFluidAttr( at='density', ad=True, fv-3.5, xi=1, yi=2, zi=3 )
# clear the density for the whole fluid
cmds.setFluidAttr( at='density', cl=True )
# reset the velocity at the cell x=1, y=2, z=3
cmds.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)
cmds.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
cmds.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
cmds.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
cmds.setFluidAttr( at='density', fv=0.5, fr=0.4 )