PDA

View Full Version : Using setAttr to set a per particle attribute


jporter313
04-22-2008, 09:19 PM
hi all, I'm trying to use a loop to go through each particle in a particle object I created and set it's color individually. My question is, how do I set a per-particle attribute using the setAttr command.

Currently I am trying to do it this way:

setAttr ( $particleObjectName + ".rgbPP[" + $colorIndex + "]") $colorArray[0] $colorArray[1] $colorArray[2];

where $particleObjectName is the name of the particle object being acted on, $colorIndex is an incremented variable used to specify the ID of the Particle I'm trying to affect, and $colorArray is a floating point array set up to temporarily store the RGB values that I want to apply to the particle.

When I run it, I get this error:

// Error: No object matches name: Particle_Test_Output.rgbPP[0] //

"Particle_Test_Output" is the value stored in the $particleObjectName variable.

Can anyone tell me what I'm doing wrong and how to make it right?

DOor
04-23-2008, 12:11 AM
I dont have a proper test but I entered the following command with no errors.



particle -e -attribute rgbPP -id 2 -vectorValue 0.0 1.0 0.0 particleShape1;




if it does what I hope youc an replace the the id with $colorIndex and each of the vectorValues with your $colorArray variables and the particleShape name.

let me know how that works.

jporter313
04-23-2008, 06:27 AM
thanks DOor, I tried that and it worked.

CGTalk Moderation
04-23-2008, 06:27 AM
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.