Accessing compound plug as part of compound array plug?

Hi,

I am creating a plugin where I want to have the following structure:


inputs
|__input[0]
     |__input[0].translate
         |__input[0].translateX
         |__input[0].translateY
         |__input[0].translateZ

I have the following code I am using to construct the attribute and read in compute. The problem I am facing is that I don’t get anything other than zeros for translate and rotate in my compute.
But if I disconnect my translate input and read values in compute then I get the current values. But if I connect back the values stay the same as last (when it was disconnected).

Any ideas on this issue would be great :slight_smile:


MFnCompoundAttribute cmpAttr;
MFnNumericAttribute numAttr;
MFnUnitAttribute unitAttr;

// compound input array attribute
_caInputs = cmpAttr.create("inputs", "gi", &mstat);
cmpAttr.setArray(true);
cmpAttr.setIndexMatters(false);
cmpAttr.setDisconnectBehavior(MFnAttribute::kDelet  e);

// children of compound element plug
_nInTranslate = numAttr.createPoint("translate", "t", &mstat);
cmpAttr.addChild(_nInTranslate);
_nInRotateX = unitAttr.create("rotateX", "rx", MFnUnitAttribute::kAngle);
_nInRotateY = unitAttr.create("rotateY", "ry", MFnUnitAttribute::kAngle);
_nInRotateZ = unitAttr.create("rotateZ", "rz", MFnUnitAttribute::kAngle);
_nInRotate = numAttr.create("rotate", "r", _nInRotateX, _nInRotateY, _nInRotateZ, &mstat);
cmpAttr.addChild(_nInRotate);
...
// ---- in compute -----

MArrayDataHandle  h_inputs = data.inputArrayValue(_caInputs, &mstat);
h_inputs.jumpToElement(curInd);
h_curInput = h_inputs.inputValue();

MVector trans = h_curInput.child(_nInTranslate).asVector();
MAngle rz = h_curInput.child(_nInRotate).child(_nInRotateZ).as  Angle();

I found my mistake. I had connectionMade method declared in my class which did not call it’s parent class method and hence never got data into the block. This is what I should have done at the end of connectionMade.

return MPxNode::connectionMade( plug, otherPlug, asSrc );