akril
07-29-2008, 06:32 PM
Hi everybody,
I have a big trouble on my particle expression and I'm not able to figure out how to fix it. So I hope you will help me to find the way...
Actually, I put all my expressions (creation, rbd and rad) in 3 differents files. It's pretty usefull 'cause these are long expression scripts.
Using a script I build my dynamics setup (particle, emitter, goal and fields) and afterwards I call each files separetly (store the result in a string) to create each expression using the dynExpression command.
Sometimes Maya is pretty smart :applause:, for instance in the creation of the particles expression is able to replace the attribute "position" or "rgbPP" by the name "particleShape.position" or "particleShape.rgbPP". That's usefull because I don't want to use any particleShape in my expressions files... it's better for kinda dynamic setup.
But...I guess this is the but you waiting for... if I use the attribute name as command parameters (`listConnections goalGeometry[0]`)... it's not working and I'm affraid there's no way for Maya to replace it.
This is an example of an expression file :
// maya will replace "position" by "particleShape.position"
vector $pos = position;
vector $vel = velocity;
goalPP = 1;
// here I need to retrieve the goal Shape in order to send it to an inhouse plug... but it's not working because maya don't replace goalGeometry[0] by particleShape.goalGeometry[0]
string $buf[] = `listConnections -p 1 goalGeometry[0]`;
string $goalShape = plugNode($buf[0]);
// so I'd like to use this syntax... If I set the valid name it works but i don't know how to retrieve it as string inside the expression.
string $pShape = THE_PARTICLE_SHAPE_NAME
string $buf[] = `listConnections -p 1 ($pShape+".goalGeometry[0]")`;
string $goalShape = plugNode($buf[0]);
string $eConnect[] = `listConnections ($pShape+".newParticles[0]")`;
string $emitter = $eConnect[0];
Some people propose me to store the shape name, the emitter name and the goal shape name in attributes but it's not a dynamic way and I really don't like this way. If the user change the particle Shape name it will crash :-/
so if anyone have some tips to share.. I will appreciate ;-)
thanks.
I have a big trouble on my particle expression and I'm not able to figure out how to fix it. So I hope you will help me to find the way...
Actually, I put all my expressions (creation, rbd and rad) in 3 differents files. It's pretty usefull 'cause these are long expression scripts.
Using a script I build my dynamics setup (particle, emitter, goal and fields) and afterwards I call each files separetly (store the result in a string) to create each expression using the dynExpression command.
Sometimes Maya is pretty smart :applause:, for instance in the creation of the particles expression is able to replace the attribute "position" or "rgbPP" by the name "particleShape.position" or "particleShape.rgbPP". That's usefull because I don't want to use any particleShape in my expressions files... it's better for kinda dynamic setup.
But...I guess this is the but you waiting for... if I use the attribute name as command parameters (`listConnections goalGeometry[0]`)... it's not working and I'm affraid there's no way for Maya to replace it.
This is an example of an expression file :
// maya will replace "position" by "particleShape.position"
vector $pos = position;
vector $vel = velocity;
goalPP = 1;
// here I need to retrieve the goal Shape in order to send it to an inhouse plug... but it's not working because maya don't replace goalGeometry[0] by particleShape.goalGeometry[0]
string $buf[] = `listConnections -p 1 goalGeometry[0]`;
string $goalShape = plugNode($buf[0]);
// so I'd like to use this syntax... If I set the valid name it works but i don't know how to retrieve it as string inside the expression.
string $pShape = THE_PARTICLE_SHAPE_NAME
string $buf[] = `listConnections -p 1 ($pShape+".goalGeometry[0]")`;
string $goalShape = plugNode($buf[0]);
string $eConnect[] = `listConnections ($pShape+".newParticles[0]")`;
string $emitter = $eConnect[0];
Some people propose me to store the shape name, the emitter name and the goal shape name in attributes but it's not a dynamic way and I really don't like this way. If the user change the particle Shape name it will crash :-/
so if anyone have some tips to share.. I will appreciate ;-)
thanks.
