pymel.core.effects.addPP¶
- addPP(*args, **kwargs)¶
Adds per-point (per-cv, per-vertex, or per-particle) attribute capability for an attribute of an emitter or field. The -atr flag identifies the attribute. If no attribute is named, addPP returns a warning and does nothing. The command adds any other necessary attributes wherever they are needed, and makes all necessary connections. If any of the attributes already exist, the command simply connects to them. The command also toggles any relevant attributes in the emitter or field to indicate that per-point capability is being used. The command adds a separate per-point attribute to the owning object for each emitter/field. For example, for emission rate, there is a separate ratePP for each emitter. These attributes are named according to the convention emitter/field nameattr namePP. For example, if a particle shape owned an emitter smoke, that shape would get attribute smokeRatePP.The name of the object must be the emitter or field for which per-point capability is to be added (or the name of its parent transform). The addPP command adds the per- point capability for that emitter or field but not for any others owned by the same object. If per-point capability is not supported for a named object, the command will trigger a warning, but will continue executing for any other objects which were valid. If no objects are named, addPP uses any objects in the current selection list for which the specified attribute is applicable. (For example, it would add per-point rate for all selected emitters.) If addPP detects that the owner object has left-over attributes from a deleted emitter, it will remove those attributes before adding the new ones. Thus, you can delete the emitter, make a new one, and run addPP again, and addPP will clean up after the deleted emitter. This is most commonly used if you have a geometry emitter and then decide to change the geometry. Likewise, if addPP detects that some cvs or vertices have been added to the geometry, then it will expand the corresponding multi- attributes as necessary. However, if it detects that some cvs/vertices have been removed, it will not remove any entries from the multi. See the user manual for more discussion.
- Modifications:
- returns a list of PyNode objects
Flags:
Long Name / Short Name Argument Types Properties attribute / atr unicode Name of attribute to which you wish to add PP capability. Currently the only attribute supported is rate (for emitters). Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.addPP
Example:
import pymel.core as pm import maya.cmds as cmds pm.emitter( n='myEmitter1' ) # Result: nt.PointEmitter(u'myEmitter1') # pm.particle( n='myParticle1' ) # Result: [nt.Transform(u'myParticle1'), nt.Particle(u'myParticle1Shape')] # pm.connectDynamic( 'myParticle1', em='myEmitter1' ) # Result: [u'myParticle1Shape'] # pm.select( 'myParticle1' ) pm.emitter( n='myEmitter2' ) # Result: nt.Transform(u'myParticle1') # pm.particle( n='myParticle2' ) # Result: [nt.Transform(u'myParticle2'), nt.Particle(u'myParticle2Shape')] # pm.connectDynamic( 'myParticle2', em='myEmitter2' ) # Result: [u'myParticle2Shape'] # pm.addPP( 'myEmitter2', atr='rate' ) # Result: [nt.PointEmitter(u'myEmitter2')] # # Suppose that myEmitter2 is owned by a particle shape, "myParticle1." # addPP will add an attribute "myEmitter2RatePP" to myParticle1, will connect # myParticle1.myEmitter2RatePP to myEmitter2.ratePP, and will set myEmitter2.useRatePP # to true.