Bug with MPxFieldNode and nParticles in latest API

Bug with MPxFieldNode and nParticles in latest API

Anonymous
Not applicable
525 Views
4 Replies
Message 1 of 5

Bug with MPxFieldNode and nParticles in latest API

Anonymous
Not applicable

Hi

 

There seems to be a bug/issue when using custom MPxFieldNodes with nParticles in the latest version of the Maya API (2016.5 and 2017). I have checked and the issue was not present in any earlier version of the api. I thought it might be related to my code but I have also tested this out with an example plug-in shipped with the Maya devkit and encountered the same issue.

 

Repro steps are as follows:

 

1) Build the "torusField" example from the devkit for Maya 2016.5 or 2017
2) Create a torusField node
3) Create an nParticle node
4) Assign the torusField to the nParticle
5) Press play
6) In the output window you will notice this line being repeatedly printed to the screen:

 

ERROR in plug.logicalIndex.

 

7) Now if you try the same with a legacy particle this error message is not printed

 

The bug is triggered by line 135 of torusField.cpp. For some reason this line is returning an error stating that the plug is not an array element plug.

 

However what I have found is that the check on line 129:

 

if( !(plug == mOutputForce) )

Seems to be getting passed for both the multi plug and its elements and so the node functions correctly for the element plug but throws an error for the multi plug. This behavior never existed previously and also does not happen with legacy particles, which leads me to believe that there must have been a recent change to the way nParticles works that has caused this.

 

If someone from Autodesk can take a look and let me know if this is a bug or if there is a workaround (other than removing the error message) that would be great.

 

Thanks

0 Likes
Accepted solutions (1)
526 Views
4 Replies
Replies (4)
Message 2 of 5

cheng_xi_li
Autodesk Support
Autodesk Support

Hi chestermikeb,

 

I've tested your issue and I am able to reproduce it.

 

 

When using EM, em will mark the mOutputForce as dirty and nParticle will mark its element as dirty. If you switched to DG, this issue is gone. I am discussing this issue with our engineers. Once I've heard something, I'll come back and post here.

 

Yours,

Li

0 Likes
Message 3 of 5

Anonymous
Not applicable

Thanks for looking into this Li. I hadn't actually considered trying out the evaluation modes. That makes perfect sense.

 

Please let me know what the engineers say on this particular issue as Im keen to know what solution they are able to offer.

 

Cheers

 

Mike

0 Likes
Message 4 of 5

cheng_xi_li
Autodesk Support
Autodesk Support
Accepted solution

Hi Mike,

 

I've got replies from our engineers. 

 

When EM evaluates a node, it will always dirty the root plug, which in this case is the MOutputForce array of torusField.You can find more details in our Using Parallel Maya white paper.

 

Nucleus setups usually create “cycles” between nodes.  The nucleus reads something from the particle node, but the particle node also reads something from the nucleus, etc.  When you have such a cycle, EM doesn’t know where to start: any node that gets evaluated might pull on data in another node in the cycle and this data might not have been evaluated yet.  So it “arbitrarily” picks up a node and starts evaluating.  This node might pull on other things, causing them to evaluate.So, the the element plug will be evaluated first, caused by the nParticle node pulling data from torusField. Then EM goes to evaluate torusField node and it will evaluate the full array. When evaluating the array, you can optimize the process(e.g. ignore clean plugs)

 

So, basically, you'll need to update your compute node like this:

 

if(plug.isElement()) {
    ProcessPlug(plug);
} else
{
    ProcessArray(plug);
}

Yours,

Li

Message 5 of 5

Anonymous
Not applicable
Thanks Li, I appreciated the feedback. I'll make the suggested change to my code. I guess the example plug-ins probably need a bit of an update now too 🙂
0 Likes