The nParticle command creates a new nParticle object from a list of world space points. If an nParticle object is created, the command returns the names of the new particle shape and its associated particle object dependency node. If an object was queried, the results of the query are returned. Per particle attributes can be queried using the particleId or the order of the particle in the particle array. If an object was edited, nothing is returned.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
attribute (at) | unicode | ||
|
|||
cache (ch) | bool | ||
|
|||
conserve (c) | float | ||
Conservation of momentum control (between 0 and 1). Specifies the fraction of the particle shape’s existing momentum which is conserved from frame to frame. A value of 1 (the default) corresponds to true Newtonian physics, in which momentum is conserved. |
|||
count (ct) | bool | ||
|
|||
deleteCache (dc) | bool | ||
Deletes the particle shapes cache. This command is not undoable.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
dynamicAttrList (dal) | bool | ||
|
|||
floatValue (fv) | float | ||
|
|||
gridSpacing (grs) | float | ||
|
|||
inherit (i) | float | ||
|
|||
jitterBasePoint (jbp) | float, float, float | ||
Base point (center point) for jitters. The command will create one swatch of jitters for each base point. It will pair up other flags with base points in the order they are given in the command line. If not enough instances of the other flags are availble, the last one on the line with be used for all other instances of -jpb. |
|||
jitterRadius (jr) | float | ||
|
|||
lowerLeft (ll) | float, float, float | ||
|
|||
name (n) | unicode | ||
|
|||
numJitters (nj) | int | ||
|
|||
order (order) | int | ||
Used in per particle attribute query and edit. Specifies the zero-based order (index) of the particle whose attribute is being queried or edited in the particle array. Querying the value of a per particle attribute requires the -attribute and -id or -order flags and their arguments to precede the -q flag. |
|||
particleId (id) | int | ||
Used in per particle attribute query and edit. Specifies the id of the particle whose attribute is being queried or edited. Querying the value of a per particle attribute requires the -attribute and -id or -order flags and their arguments to precede the -q flag. |
|||
perParticleDouble (ppd) | bool | ||
|
|||
perParticleVector (ppv) | bool | ||
|
|||
position (p) | float, float, float | ||
|
|||
shapeName (sn) | unicode | ||
|
|||
upperRight (ur) | float, float, float | ||
|
|||
vectorValue (vv) | float, float, float | ||
|
Derived from mel command maya.cmds.nParticle
Example:
import pymel.core as pm
import maya.cmds as cmds
# Creates a particle object with four particles
pm.nParticle( p=[(0, 0, 0), (3, 5, 6), (5, 6, 7), (9, 9, 9)] )
# Result: [nt.Transform(u'nParticle1'), nt.NParticle(u'nParticleShape1')] #
# Returns the age of the particle with id 2 in object particle1
pm.nParticle( 'particle1', q=True, attribute='age', id=2 )
# Returns the velocity of the 3rd particle in the currently selected
# particle object
pm.nParticle( attribute='velocity', q=True, order=3 )
# Edits the velocity of the 7th particle in the currently selected
# particle object to be 0.0, 1.0, 0.0
pm.nParticle( e=True, attribute='velocity', order=3, vectorValue=(0.0, 1.0, 0.0) )
# Edits the mass of the particle in "particle1" with id 3 to be 0.7
pm.nParticle( 'nParticle1', e=True, attribute='mass', id=3, fv=0.7 )