@Justin: thx so much for the help!

Okay, so it's possible I may have gotten this to work, but won't really 
know until I start part 2…

After cutting and pasting your script I was getting the following error:
// Error: An execution error occurred in the creation expression for 
particleShape1. // 
# Error: RuntimeError: (kInvalidParameter): value not in valid range #


Examining your script, there was one part that I didn't understand:
point = om.MPoint(*cmds.xform(q=True, t=True, ws=True))

How was "point" supposed to represent the just-born particle?  It seemed to 
me that xform needed to be passed a particular particle, like so:

point = om.MPoint(*cmds.xform(*'particle1.pt[particleId]'*, q=True, t=True, 
ws=True))
//see: 
http://mayaspiral.blogspot.com/2013/04/python-getting-particle-rgbpp-and-apply.html
 


After much googling I still couldn't figure out how to get the particleId 
via openMaya so I came up with a pretty ugly looking hack to pass it from 
MEL:

(Note: For now I'm doing all this from within the Expression Editor for 
particleShape1; which means that I wrapped each line of your script in 
python() commands and am executing it from within the Expression Editor.)


//get particleId via MEL
$pid = particleShape1.particleId;

//pass MEL variable to python, see: 
http://forums.cgsociety.org/archive/index.php/t-696519.html
string $s = "pid = " + $pid;
string $sCMD = "python(\"" + $s + "\")";
eval($sCMD);

//create particleIdString for xform command
python("particleIdStr=\"particle1.pt[\" + str(pid) + \"]\"");
python("point = om.MPoint(*cmds.xform(particleIdStr, q=True, t=True, 
ws=True))");


And so far that seems to work!  The error went away and I'm getting 
normalized values for norm.  Next will be integrating the ramp…if you have 
any ideas about how to do that I'm all ears (or a more elegant way of doing 
what I did), otherwise I'll post back when I get it.  Thanks again–much 
appreciated!

>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/141ca6f5-bb8a-4936-95f4-4312710e5d7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to