Go to: Synopsis. Return value. Related. Flags. Python examples.
setParticleAttr(
selectionList
, [attribute=string], [floatValue=float], [object=string], [randomFloat=float], [randomVector=[float, float, float]], [relative=boolean], [vectorValue=[float, float, float]])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
setParticleAttr is undoable, NOT queryable, and NOT editable.
This action will set the value of the chosen attribute for every
particle or selected component in the selected or passed particle object.
Components should not be passed to the command line.
For setting the values of components, the components must be
selected and only the particle object's names should be passed to
this action.
If the attribute is a vector attribute and the -vv flag is passed,
then the three floats passed will be used to set the values. If
the attribute is a vector and the -fv flag is pass and the -vv flag
is not passed, then the float will be repeated for each of the
X, Y, and Z values of the attribute. Similarly, if the attribute is
a float attribute and a vector value is passed, then the length of
the vector passed will be used for the value.
Note: The attribute passed must be a Per-Particle attribute.
None
getParticleAttr, particle
attribute, floatValue, object, randomFloat, randomVector, relative, vectorValue
Long name (short name) |
Argument types |
Properties |
attribute(at)
|
string
|
|
|
Tells the action which attribute you want to set
|
|
floatValue(fv)
|
float
|
|
|
Tells what you want the value to be set to of a float attribute
|
|
vectorValue(vv)
|
[float, float, float]
|
|
|
Tells what you want the value to be set to of a vector
attribute
|
|
randomFloat(rf)
|
float
|
|
|
Tells the command to add a random value from -FLOAT to +FLOAT to
the results of each particle. The default is 0.0.
|
|
randomVector(rv)
|
[float, float, float]
|
|
|
Tells the command to add a random value from <<-x,-y,-z>> to <<x,y,z>> to
the results of each particle. The default 0 0 0.
|
|
relative(r)
|
boolean
|
|
|
If this is set to TRUE (the default is FALSE), then the float or vector value will be added to the current value
for each particle.
|
|
object(o)
|
string
|
|
|
If this flag is passed and the STRING is the name of a particle object's transform or shape,
then ONLY that object will be edited, ignoring the selection list or command line, and
ALL of its particles' values will be changed for the specified attribute.
|
|
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
cmds.setParticleAttr( 'particle1', at='velocity', vv=(1, 2, 3) )
# This will set the velocity of all of the particles in particle1
# to << 1, 2, 3 >>.
cmds.select( 'particleShape1.pt[0:7]', 'particleShape1.pt[11]' )
cmds.setParticleAttr( vv=(1, 2, 3), at='velocity' )
cmds.setParticleAttr( 'particleShape1', at='velocity' )
# This will set the velocity of particles 0-7 and 11 of
# particleShape1 to << 1, 2, 3 >>. The rest of the particles are
# not changed.