When you connect to the input and change value or when it gets changed because it got connected, then the input attribute is marked dirty. Your 4 outputs get also marked dirty, because of the attributeAffects(input,output1...4) initialization.
So keep in mind, that all the five attributes are marked dirty at this moment.
Now Maya does some checking and asks itself "which nodes do I need to update?" Probably only one output is connected to something which actually controls something visible in the scene, something which affects the rendered image. It gets to one of your outputs and says "ok, I need this one, is it dirty? Yes, so we have to call the compute method because it knows how to get that attribute clean" The compute gets called (and keep in mind that this is because something on the screen needs to be redrawn, which does not neccesarily occur when your input attribute changes its value), the compute gets called and requests an evaluation of the input attribute, since this has been marked dirty as well.
Oh, no, the input attribute was not dirty, my mistake, the input attribute got set clean as soon as the connection was made, or as soon as the value got changed. It is clean since the value it contains is a valid one. So, after the connection only the outputs are dirty.
The compute method does compute your new output value, and returns to Maya. But you have to keep in mind, that the compute method got called because one of the outputs was requested to update. It got called only for one output, not for all four.
Imagine your compute method would do a computation which lasts 1 hour, each output. If maya only updates the value it needs for the rendering, you save 3 hours of work. That is the idea behind it. Therefore you should connect your other 3 outputs to something which affects the rendering or the viewport.
Or you can set up callbacks which do a getValue on the 3 plugs on each refresh, that could pull the data out of them and request a computation for those plugs.
=========== a couple of hours later =======
well, I'm stuck in a similar situation.
i've got code like
CODE
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MStatus CCollisionLinkShape::compute(const MPlug &plug, MDataBlock &data)
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
{
print::p("CCollision - Link - Shape -- compute(%s)", plug.name().asChar());
MStatus status;
if( plug == m_moPull ) {
data.inputValue(m_moCurrentState).asBool();
//...
data.outputValue(m_moPull).setClean();
}
else if( plug == m_moCurrentState ) {
data.inputValue(m_moInputMesh1);
data.inputValue(m_moInputMesh2);
data.inputValue(m_moInputMatrix1);
data.inputValue(m_moInputMatrix2);
//...
and when m_moPull gets called to update, m_moCurrentState does not update (I thought it should since m_moPull is requesting the value in the data.inputValue(m_moCurrentState).asBool(); call.