Output Connection Wont Update!

@mfiorilli
Tue, 11 Aug 2009 21:44:09 +0000

@mfiorilli wrote:

Hi there,

I've been searching for 24 hours now and still can't make this working
Here's my problem:

I have this simple attribute:

CODE
outContraction = numericAttr.create("contractionOutput", "cu", MFnNumericData::kFloat, 1, &status);
MCheckStatus(status,"ERROR create contractionOutput");
numericAttr.setStorable(true);
numericAttr.setConnectable(true);
numericAttr.setArray(true); // Set this to be an array!
numericAttr.setUsesArrayDataBuilder(true); // Set this to be true also!
//numericAttr.setHidden(true);
status = addAttribute (outContraction);
//status = attributeAffects( outContraction, outputGeom ); (I've been playing with attributeAffects inside and out. It won't help !)

In the compute function, I'm filling in the number of items in array and modifying them.

FILL:

CODE
MArrayDataHandle outContractionArrayData = data.outputArrayValue( outContraction, &status );
MArrayDataBuilder outContractionArrayBuilder = outContractionArrayData.builder();

for (int i=0;i<restMPointVertexArray.length();i++){ // restMPointVertexArray.length() = number of vertex in the mesh
MDataHandle outContraction = outContractionArrayBuilder.addElement(i);
}
outContractionArrayData.set( outContractionArrayBuilder );

MODIFY: (simply adds 9 everywhere ! )
This code is in a loop that iterate over all vertex where i = current vertex
CODE
MArrayDataHandle outContractionArrayData = data.outputArrayValue ( outContraction, &status );
outContractionArrayData.jumpToElement ( i );
MDataHandle contractionOutput = outContractionArrayData.outputValue (&status);
contractionOutput.setFloat( 9 );

contractionWeightData.set( contractionWeightBuilder );

I can clearly see the data being updated in the attribute editor but if I connect this data to something else in maya, the connection will NEVER update ! I'll have to disconnect and reconnect it again to see it update

All the attributes change to 9 but the connection wont update. If I change them by hand, the connection will update.

Thank you !