Dashboard_avatar
Jan 05, 2010
Post id: 301150 Report Item


I have been trying to find a solution for this for quite a long time now, but couldn`t succeed, so here is it:

My MPxTransform should be able to display ( AE ) the result of some calculations, when I change a input value.
No downstream node should be involved, so no data pulling happens.

In general, this should be possible.
The input attribute has the "mustCallValidateAndSetValue" activated, so the "validateAndSetValue" method is called, when the attribute value is changed by the user.
But for the calculation I need the current values of other input connections.

As there is no dataBlock provided in the "valiIdateAndSetValue" method, I had to create my own with "MPxNode::forceCache". But, this dataBlock does not have current values, but the ones from the last evaluation ( bug? ).
The problem is the same when using "MPlug::getValue".
Moreover, my memory told me, that, when trying to get a attribute value with "MPlug::getValue", the "compute" method is called ( so that I can use the provided -working- dataBlock in the "compute" method to get the other current input attribute values ). But this does not work here either, "compute" is not called...


So, may have anyone an idea of how i can force Maya to spit out the current values of several attributes in the "MPxTransform::validateAndSetValue"?

Dashboard_avatar
Feb 06, 2010
Post id: 301577 Report Item

If I understand correctly, you are writing your onw transform node and you want to access native attrs in you node and do some calculation with those values as well as with other custom attrs with incoming connections, right? If so, that is kind of what I am trying to do.

How is it going?

If the MPxTransformNode is a derivative of the MPxNode class, couldn't you override the compute function which does have access to the dataBlock? Then I'm assuming you can use the MDataHandles to retrieve values.

At least that is what I am trying to do with my custom locator.

Read my post. I am having a similar problem:
http://www.creativecrash.com/forums/api/topics/custom-locator-with-compute-function---2

Dashboard_avatar
Feb 08, 2010
Post id: 301609 Report Item


You got to read the docs for MPxTransform.
If you want input transform attributes ( or others ), you must set them with the ::mustCallValidateAndSet.
Then, if you change the value directly, the ::validateAndSetValue method is called, not the ::compute.

Point is that you have access to the current value only for the attribute the MDataHandle is provided for.
You CAN use the ::forceCache, but this is only good for output data. Input data are not current, but from the evaluation before ( at least this is what I can see...).

Dashboard_avatar
Feb 08, 2010
Post id: 301619 Report Item

Oh I see. I've never written an MPxTransform.

Write a Post

You must be logged in to Post

Login at the top of this page, or click here to create an account.

Related Marketplace Items

  • Abrams1

  • Opn-pri-1

  • Matt2

  • Thumb-bed-05-def

  • Scandocoffeetable01

  • Svalentine1

  • Falcon01

  • 05