pymel.core.effects.addDynamic

addDynamic(*args, **kwargs)

Makes the “object” specified as second argument the source of an existing field or emitter specified as the first argument. In practical terms, what this means is that a field will emanate its force from its owner object, and an emitter will emit from its owner object. addDynamic makes the specified field or emitter a child of the owner’s transform (adding it to the model if it was not already there), and makes the necessary attribute connections. If either of the arguments is omitted, addDynamic searches the selection list for objects to use instead. If more than one possible owner or field/emitter is selected, addDynamic will do nothing. If the specified field/emitter already has a source, addDynamic will remove the current source and replace it with the newly specified source. If a subset of the owner object’s cvs/particles/vertices is selected, addDynamic will add the field/emitter to that subset only.

Modifications:
  • returns a list of PyNode objects

Derived from mel command maya.cmds.addDynamic

Example:

import pymel.core as pm

import maya.cmds as cmds

# Create an emitter
pm.emitter( pos=(0, 0, 0), type='omni', r=100, sro=0, nuv=0, cye='none', cyi=1, spd=1, srn=0, nsp=1, tsp=0, mxd=0, mnd=0, dx=1, dy=0, dz=0, sp=0 )
# Result: nt.PointEmitter(u'emitter1') #

# Get the emitter to emit particles
pm.particle()
# Result: [nt.Transform(u'particle1'), nt.Particle(u'particleShape1')] #
# Result: particle2
pm.connectDynamic( 'particle1', em='emitter1' )
# Result: [u'particleShape1'] #

# Create a particle to use as the source of the emitter
pm.particle( p=((6.0, 0, 7.0), (6.0, 0, 2.0)), c=1 )
# Result: [nt.Transform(u'particle2'), nt.Particle(u'particleShape2')] #
# Result: particle2

# Use particle2 as a source of the emitter
pm.addDynamic( 'emitter1', 'particle2' )
# Result: [nt.PointEmitter(u'emitter1'), nt.Particle(u'particleShape2')] #

Previous topic

pymel.core.effects.vortex

Next topic

pymel.core.effects.addPP

Core

Core Modules

Other Modules

This Page