Go to: Synopsis. Return value. Keywords. Flags. MEL examples.

Synopsis

setFluidAttr [-addValue] [-attribute string] [-clear] [-floatRandom float] [-floatValue float] [-lowerFace] [-reset] [-vectorRandom float float float] [-vectorValue float float float] [-xIndex int] [-xvalue] [-yIndex int] [-yvalue] [-zIndex int] [-zvalue]

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.

Return value

None

Keywords

fluid

Flags

addValue, attribute, clear, floatRandom, floatValue, lowerFace, reset, vectorRandom, vectorValue, xIndex, xvalue, yIndex, yvalue, zIndex, zvalue
Long name (short name) Argument types Properties
-attribute(-at) string create
Specifies the fluid attribute for which to set values. Valid attributes are "velocity", "density", "fuel", "color", "falloff", and "temperature".
-xvalue(-x)
Only set the first component of the vector-valued attribute specified by the "-at/attribute" flag.
-yvalue(-y)
Only set the second component of the vector-valued attribute specified by the "-at/attribute" flag.
-zvalue(-z)
Only set the third component of the vector-valued attribute specified by the "-at/attribute" flag.
-clear(-cl)
Set this attribute to 0
-reset(-re)
Set this attribute to default value
-addValue(-ad)
Add specified value to attribute
-floatValue(-fv) float
If this was a scalar (e.g. density) attribute, use this value
-vectorValue(-vv) float float float
If this was a vector (e.g. velocity) attribute, use this value
-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.
-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.
-xIndex(-xi) int create
Only return values for cells with this X index
-yIndex(-yi) int create
Only return values for cells with this Y index
-zIndex(-zi) int create
Only return values for cells with this Z index
-lowerFace(-lf) create
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 appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

// set density for entire fluid
setFluidAttr -at "density" -fv 1.0;
// add 3.5 to the density at the cell x=1, y=2, z=3
setFluidAttr -at "density" -ad -fv 3.5 -xi 1 -yi 2 -zi 3;
// clear the density for the whole fluid
setFluidAttr -at "density" -cl;
// reset the velocity at the cell x=1, y=2, z=3
setFluidAttr -at "velocity" -re -xi 1 -yi 2 -zi 3;
// set the velocity at the centers of the voxels on plane y=5
// to approximately (-1, 0, 0)
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
setFluidAttr -at "velocity" -z -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
setFluidAttr -at "velocity" -x -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
setFluidAttr -at "density" -fv 0.5 -fr 0.4;