Oh I hope I didn't mislead you too much on that. The part at the beginning
was really a temp example solution to producing a point. I assumed you
would be slotting in your own source for the particle birth location. Mine
was just grabbing a point off a locator for test.
 On Jun 14, 2014 7:10 PM, "Eric Corriel" <[email protected]> wrote:

> @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
> <http://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
> <https://groups.google.com/d/msgid/python_inside_maya/141ca6f5-bb8a-4936-95f4-4312710e5d7d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAPGFgA01nWT3n%2BhEAv1P38WpKLNp%2BgF9D%2BeYDMs%2Be2Fy9XUDVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to