Building upon footPrintNode_Geometry_Override for a plugin - Parallel Evaluation/setDependentsDirty/Compound Attribute issues and errors. Any better examples available?

Building upon footPrintNode_Geometry_Override for a plugin - Parallel Evaluation/setDependentsDirty/Compound Attribute issues and errors. Any better examples available?

muir.j
Contributor Contributor
540 Views
2 Replies
Message 1 of 3

Building upon footPrintNode_Geometry_Override for a plugin - Parallel Evaluation/setDependentsDirty/Compound Attribute issues and errors. Any better examples available?

muir.j
Contributor
Contributor

As background, I'm writing a plugin that instances assets along a curve in a highly specific way, but I am struggling with the footPrintNode_Geometry_Override example and its very specific behaviors - particularly compound attributes. Right now, I have just been focusing on getting the attributes working as expected.

For my curve deformer, I will be having a series of MfNPointOnCurve manipulators that will have their attributes tied into a compound attribute called 'inputTwistControl' in my code.

Building upon the footPrintNode_Geometry_Override example, for one of my attributes, I have 'inputTwistControl' as a compound attribute with two children 'twist' and 'parameter'. In my compute method, I process these and output them as two MDoubleArrays - outputTwistParameter and outputTwistAngle.

 

However the code does not evaluate the compound attribute changing at all unless I use the setDependentsDirty method where in a very hackish manner to search for a substring that matches the compound attribute

e.g.

if (plug.partialName().substring(0,9) == "inputTwist")

 

It won't evaluate at all without this - and the bad news is that with this it seems to trigger compute an inordinate amount of times with this because of each compound child, when I really want it to only trigger once in compute when the compound attribute is change.

My grievance is that footPrintNode_Geometry_Override seems to be the only recent example that is available for VP2.0, parallel and the evaluation manager, and when it has things like 'Technique 1: Hack the EM to force evaluate and cache attributes. in the source ' its not exactly inspiring confidence in the available examples 🙂

 

I've attached the code in the hope that I can learn what I'm doing wrong.
 

0 Likes
541 Views
2 Replies
Replies (2)
Message 2 of 3

jmreinhart
Advisor
Advisor

I don't know exactly what's going wrong in your code but I want to make sure you are aware of two thing.

 

In parallel evaluation the parent plug is always computed, not the children. 

In parallel evaluation setDependentsDirty is not called, instead it calls preEvaluate.

 

I created an MPxLocator recently so that code might be helpful to you as another example?

https://docs.google.com/document/d/1iRadskQuicRKT8A08Tn9k2Ol_2y6mVcf_Pvzkve7_9U/edit?usp=sharing

Message 3 of 3

muir.j
Contributor
Contributor

Thanks for the advice and the example.

 

My code works - however what seems really wrong is the number of calls to the compute method. The number is really high and completely random and makes me think I am doing something really wrong.

For the initial footPrintNode_GeometryOverride.cpp code, with plug==inputSize, it has a seemingly random number of evaluations in Serial/Parallel mode. Loading the same scene, sometimes its 17, other times 31 and makes me thing there is some bug or something else going on.

0 Likes