For viewport display ( openGL ) of some data I want my node to do calculations without a output trigger.
Obviously, we have 3 ways of generally getting a custom node to do something.
1. valid for all MPxNodes:
Then we need a downstream node which asks for information.
That way, the "::compute" is called
2. valid only for MPxTransform
Set a input attribute with "::mustCallValidateAndSetValue"
Then we do not need another node to request for data update.
By simply changing the input attribute, the "::validateAndSetValue" is called and we can do the calculation there ( if the attribute is the child of another attribute, the "::compute" is called insted ).
3. valid for all MPxNodes
Set a input attribute with "::setInternal".
The behaviour here is different under different conditions.
a. The input attribute is not connected to a upstream attribute.
Then, when the value of the attribute is changed directly, the "::setInternalValueInContext" is immediately called and we can do calculations there.
b. The input attribute is connected to a upstream attribute.
Then, when the upstream attribute is changed, nothing happens to our attribute ( its just set to "dirty" ).
So, the bahaviour is not consistent here. I have no idea why this is so.
If the developers of Maya don`t want a "normal" node to do anything when there`s no downstream request, then why can we do calculations in the case of 3.a.?
As the title says, I need the node to do calculations for ( instant ) viewport display of some data.
I know I can create a "fake" downstream node, which starts evaluation and asks my node for computation. And I know that I could create callbacks for the attributes. But thats a really bad workaround. I don`t want one more node in my scene just for the purpose of constantly asking the main node for evaluation and I don`t want 15 callbacks permanently running for monitoring changes in the attributes.
I know the "philosophy" behind the DG evaluation ( do only computation when it must be done ). But that doesn`t take into account the case where I want a immediate openGL update of my data.
So, does anyone know other ways we could get a custom MPxNode to do calculations without a downstream request?