FORUMS: list search recent posts

particleFill mel command breaks future command from executing

COW Forums : Autodesk Maya

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Pawel Grochola
particleFill mel command breaks future command from executing
on Aug 12, 2011 at 4:17:52 am

Hi,
I'm using the particleFill mel command in one of my scripts.
It works fine but the problems is that after it executes all future script commands do not evaluate!
For example:

polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1;
particleFill -rs 10 -maxX 1 -maxY 1 -maxZ 1 -minX 0 -minY 0 -minZ 0 -pd 1 -cp pSphere1;
print "bob!n";

will not print bob!. The particleFill command stops the print command from evaluating.

Anyone have any idea what's going on here? Or how to work around it?

Thanks for your help!


Return to posts index

Steve Sayer
Re: particleFill mel command breaks future command from executing
on Aug 12, 2011 at 6:04:41 pm

This is interesting. I'm getting the same results you are.

What seems to be happening is that the 'particleFill' command causes an nParticle object to be created, which in turn comes along with a bunch of supplementary scripts and procedures that set up the nParticle object to its default state. You can see this if you activate 'echo all commands' and then run your code.

I don't know why those scripts don't seem to exit properly and return control to the next line of your code. I've tried variation on eval, evalDeferred, and enclosing the particleFill command in a procedure. Nothing seems to work!

Sorry, I wish I had an answer for you! This is very odd!

-Steve


Return to posts index

Steve Sayer
Re: particleFill mel command breaks future command from executing
on Aug 12, 2011 at 8:00:02 pm

Here's some more information from the Release Notes:

Scripting nParticle creation invokes other commands

Using the nParticle command, the particleFill command, or the nCreateEmitter script, invokes some lower level scripts with evalDeferred. If you want to use these commands in a script and then access any per-particle dynamic attributes in the same script, you need to first allow the deferred commands the chance to catch up.

Workaround

Insert a command that lists each evalDeferred such as to flush out all the deferred commands.


Unfortunately, I have no idea whether or not this information might lead to a solution for you... this seems like a really terrible oversight on the programmers' part!

-Steve


Return to posts index


Pawel Grochola
Re: particleFill mel command breaks future command from executing
on Aug 13, 2011 at 3:05:11 am

Thanks for looking into this Steve.
You've at least given me something else to try..I was out of ideas also.
I'll re-post if I find a solution!
Cheers
Pav


Return to posts index

Pawel Grochola
Re: particleFill mel command breaks future command from executing
on Aug 15, 2011 at 4:54:59 am

here's the work around:
Thanks David Johnson!

polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1;
evalDeferred "particleFill -rs 10 -maxX 1 -maxY 1 -maxZ 1 -minX 0 -minY 0 -minZ 0 -pd 1 -cp pSphere1";
for($i=0; $i<1000; $i++)
{
string $eList[] = `evalDeferred -list`;
if(size($eList) == 0) break;
}
print "bob!\n";


Return to posts index

Steve Sayer
Re: particleFill mel command breaks future command from executing
on Aug 15, 2011 at 2:05:18 pm

Oof, that is not an ideal solution, is it? Shame on Autodesk for making you jump through hoops like that.

I wonder if it could be tightened up a little by using a 'while' statement instead of a 'for' loop with an arbitrary count of 1000? Have it execute the loop 'while' the list size is greater than zero? I don't know.

'while' statements can be dangerous, of course, because they can sometimes get stuck in an infinite loop; your 'for' statement doesn't run that risk.

I guess if it works, go with it! Thanks for posting the solution.

-Steve


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]