API: instant data update without downstream request

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  09 September 2010
API: instant data update without downstream request

Hi guys!

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:
Use "attributeAffects"/"setDependentsDirty"
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?

  09 September 2010
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 07:23 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.