Connection with custom type MPXData is always dirty, setClean seems to not work

Connection with custom type MPXData is always dirty, setClean seems to not work

Anonymous
Not applicable
543 Views
1 Reply
Message 1 of 2

Connection with custom type MPXData is always dirty, setClean seems to not work

Anonymous
Not applicable

Hi there,

this is about dirty propagation and setClean of connections with a custom datatype.

 

I have two connected nodes A and B.
A's output is connected to B's input.

 

The connection uses a custom datatype (MPxData derived class).

Now I set the output value in A with the datablocks output handle

 

//Custom data type
CustomData* data = new CustomData;
MDataHandle outputHandle = dataBlock.outputValue(outputObject);
outputHandle.set(data);
//tried as well 
//outputHandle.setMPxData(data);
//is it necessary, some peeps say outputHandle.setMPxData(data); is enough
outputHandle.setClean();


In node B I ask for the value with

 

MDataHandle inputHandle = dataBlock.inputValue(inputObject);
MPxData* data = inputHandle.asPluginData();
//Can cast it to my custom type here and use it

 

So my understanding is that the use of inputHandle in node B
should trigger A's compute function only when A's output is dirty
(so any connected inputs in A changed, which are connected to the output with MPXNode::attributeaffects).

 

So as long as no inputs in A change, which would mark the output in A as dirty, the call to inputHandle.asPluginData() in B should not trigger A's compute.

 

My problem is, it triggers all the time. But I don't change any inputs in A.

 

So it looks like the set, setMPxData and setClean calls don't set the output clean.
My output must be dirty all the time.

 

I'm wondering if it is connected to the custom data type.

 

I tried it with setting the output via a MPlug in node A as well:

 

 

MFnDependencyNode nodeFn(myNodeObject);
MPlug outPlug = nodeFn.findPlug(outputObject);
outPlug.setValue(data);
//tried outPlug.setMPxData(data) as well

 

and getting the input in node B with plugs as well

 

 

MFnDependencyNode nodeFn(myNodeObject);
MPlug inputPlug = nodeFn.findPlug(inputObject);
MObject plugValue;
inputPlug .getValue(plugValue);

 

So this should trigger A's compute all the time afaik, right?

 

I'm pretty confused with Maya's layers of engineering and many different ways to do the same thing,
so totally can be, I miss something.

 

Help would be appreciated, anybody experienced this?

 

 

Best,
Kai

0 Likes
Accepted solutions (1)
544 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

My own mistake,
did set the inputs to not cached, than it evaluates all the time, no surprise!

Less confused now,
Kai

0 Likes