View Full Version : setAttr problem (python)

07 July 2011, 03:05 PM
Hi there,

i m strating to learn python , and i m facing a little problem with the setAttr command

This is the simple code :

Emit = cmds.emitter(typ="omni", n="DirtEmtr", r=100, sro=1, spd=2, srn=0.5, nsp=1)
Ptcl = cmds.particle(n="DirtPtcl")
cmds.connectDynamic (Ptcl , em=Emit)

i want to make a setAttr to change the speed value of the emiiter so i try :

cmds.setAttr (Emit+".speed",4)


cmds.setAttr ("%s.speed" %(Emit),4)

Both give me an error , and dont understand why. if someone ca help...


07 July 2011, 04:35 PM
print a
Result: [u'emitter1']

So this is list [].

YOur code should be cmds.setAttr (Emit[0]+".speed",4)

But be aware , if you have selection (particleShape,object) , emitter will be parented under selection and your list will be [particle,emitter] etc.

07 July 2011, 05:38 PM
Thanks a lot , didn't realized it was a list

CGTalk Moderation
07 July 2011, 05:38 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.