Python: how to get expressions of a particle system


#1

Hello everyone,
I would like to know if there’s a command to get the expressions (creation, before and after dynamic) of a particle system as a string, so I can modify it and put it back by using “dynExpression”.

Long story and my scenario.
The fact is I referenced a maya file by python.
In that file there are particles that read values of two ramps thanks to their expressions.
To read the ramps I use this:

float $radius[] = `colorAtPoint -output RGB -u .5 -v (blahblah) "ramp1"`;

My scenario is I need to change that “ramp1” according its real name when the file is referenced.
I have everything I need (I can reference the file, I can have the name of the texture when the file is referenced…), I miss only how to read all the expressions by python, search that “ramp1” and changing it with something like “fileRef1|ramp1”.

Thank you very much.


#2

Nevermind!

Just reading the maya scene file in text editor I discovered:

.irbx: Before
.irax: After
.icx: Creation

And they seem to be what I need.
Thank you anyway.


#3

NOOOOPE!

I still have problem, so if someone can help me, I’d really appreciate it!


#4

i don’t think it’s a good idea to change text of expressions when you need to change source file.
it would be better to add extra string attribute to particle system for example and put file node name there. in expression you will read this attribute value, which you can easily change.
but i would probably add a color attribute and connect it to a specified file


#5

Hi DennisT,
sorry to be so late.
I tried what I suggested, well, something closer, but with no success.
In the end I used another solution.
Because the python script creates the particle system, the same script reads all the expressions from a txt file, it changes variables names adding the namespace, then it overwrites the particles expressions.
Thank you very much for your time.