particle runtime expr - getting the particle name

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 05 May 2006   #1
particle runtime expr - getting the particle name

Simple question. How do I get the name of the particle object in a runtime expression to which particle it belongs to?
Old 05 May 2006   #2
Afaik, it's unfortunately not possible to do that (you usually don't need it since maya's expressions take care of renaming and stuff when you duplicate or change the name of an object connected to an expression). In some cases you need the name of the object explicitly however, e.g. when using a mel command, e.g. getParticleAttr, inside an expression. In these situations I usually make a string variable holding the name of the object at the top of the expression code (so it's easy to find if you need to change it). Here's an example:
string $theParentParticle = "particleShape1";
// some code
int $parentId = parentId;
float $parentAge [] = `getParticleAttr -at ageNormalized -array true ($theParentParticle + ".pt[" + $parentId + "]")`;
Old 05 May 2006   #3
That's what I thought too but wanted to ask anyway. The situation i'm working on is rather unusual. I'm creating curves that follow the particle paths and wanted to keep the naming of the curves consistent using the particle name as the prefix. It's an ugly hack anyway so I might just use your suggestion... Thanks.
Old 05 May 2006   #4
maybe U can use the ParticleID for that ? so U get the ID and put it in the prefix of the curveName?
Old 05 May 2006   #5
Yeah, too bad there isn't a "this" keyword for particle expressions. It's understandable why there can't be for common expressions since they don't really belong to an object, but are just connected to them, but particle expressions always belong to particle shape, so it would be possible there. Maybe there is a less hacky way around it (it might be possible to trace connections to/within the particle, I don't know).

Anyway, your particle effect sounds really cool, do the curves appear at each particle's creation, and if so do you have any trick to get rid of them when you rewind the animation? What will happen when you cache the particles?

Would be cool if you could share some thoughts on this.
Old 05 May 2006   #6
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:56 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.