PDA

View Full Version : Particle instancer on deformed NParticles with custom attributes


wolverine
04-10-2012, 06:02 PM
Is there a way to tell the paticle instancer to use custom attributes?

I created a nParticle.. added a IndexNumber attribute to it so I can spawn random objects at every particle location.. After that I through a Wave Deformer over the particles.. Maya creates a nParticleShape_Deformed out of it...

If I use the Particle Instancer on the nParticleShape_Deformed my custom IndexNumber attribute that I created is nowhere to be found.

Anyone know how to get it deformed and still keep my custom attributes?

ginodauri
04-10-2012, 06:24 PM
When you apply deformer maya created new particle shape node.
But there is still your old particle shape in scene.

What you can do is to create attribute on ps_deformed node , and wite pp expression:

ps_deformed.newIndex= ps_old.index.

wolverine
04-10-2012, 06:36 PM
Thanks for the reply..

Maya doesn't allow me to put expression on the deformedShape..
I tried an expression like

nParticleShape20Deformed.IndexNumber = nParticleShape20.IndexNumber;

Maya errors with
Warning: Deformed particleShapes do not handle expressions; apply the expression on the original non-deformed particleShape. //

You can't wite the expression on its own either
Error: Attribute of a particle object can only be used with dynExpression command: IndexNumber //

I don't get why when it creates the DeformedShape it doesn't just pass everything over from the original.. that is... including all custom attributes.

wolverine
04-10-2012, 07:24 PM
Since I only needed the indexNumber to be set once I ended up creating a script that does assigns values to the deformedShape attribute.


float $array[] = `getAttr nParticleShape20.IndexNumber`;
for ($count = 0; $count `size $array` $count++)
{
particle -e -or $count -at IndexNumber -fv $b nParticleShape20Deformed ;
$count ++;
}


How would one do this if it was dynamic? Sample the whole timeframe (Cache) and set it?
I mean.. Is there really no easier way to do this?
Whats odd is.. The created 'deformedShape' it's not even a duplicate of the real shape.. w00t why? :argh:

CGTalk Moderation
04-10-2012, 07:24 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.