PDA

View Full Version : API: please help! MDataBlock method 'isClean' usage question


tredeger
10-08-2006, 09:20 PM
Hello geniuses:

I have a node with an attr that will have multiple output plugs, constrainTrans[0], constrainTrans[1], ... , constrainTrans[n].

When the compute function is called to clean one of these plugs, say
constrainTrans[j], I need to determine within the function call whether or not another specific plug is clean or dirty, say constrainTrans[k]. How do I do this?

The MDataHandle class doesn't seem to have a method for querying the dirty state.

MDataBlock has an 'isClean' method, but I don't know if it's usage supports passing a plug with and element index or whether it's just meant to take the entire attribute. Can anyone please advise?

In otherwords, if 'data' is the data block:

I think this is correct usage:
data.isClean (constrainTrans, &returnStatus);

But is this legal as well:
data.isClean (constrainTrans[k], &returnStatus);

If this doesn't work, is there some other approach to this problem that I can try? Thanks a tone for any help at all, I'm in a terrible bind.

Starrider
10-09-2006, 07:26 PM
hey!
i had a very similar problem a few days ago. a multi-plug in affects a multi-plug out - like in[0] -> out[0] .... in[n] -> out[n].

my way:

1. remove the attributeAffects(in, out);

2. overwrite the setDependentsDirty-method

MStatus myNode::setDependentsDirty(const MPlug &plugBeingDirtied, MPlugArray &affectedPlugs)
{
if ( plugBeingDirtied.attribute() != inAttrib )
{
return MS::kSuccess;
}

int nPlugIndex = plug.logicalIndex();

// ... get the dataHandle to the corresponding outAttrib here;

affectedPlugs.append(plugToOutAttrib); // this can be like "out[12]"

return MS::kSuccess;
}

3. in the compute function:

...
if(plug == out)
{
int nPlugIndex = plug.logicalIndex();
// ... update the corresponding data for this plug
}

that's it.
hopefully it helps!

tredeger
10-09-2006, 07:52 PM
Thanks starrider. I'm already doing all that stuff. My issue is that I have several plugs on that multi getting dirty at once and during compute I want to control the order in which they are cleaned. So I need to be able to check, within compute, whether any specific plug (other than the dirty plug that triggered the compute call) is also dirty.

setDependentsDirty gives us great control over when changes actually end up setting the plugs dirty, but once they are dirty, I need a way of actually checking which one are dirty and which are clean from inside compute. Thanks again for any help.

cheers,
j

CGTalk Moderation
10-09-2006, 07:52 PM
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.