Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

can't get child plug of CompoundAttribute in custom node

can't get child plug of CompoundAttribute in custom node

568278785
Explorer Explorer
506 Views
2 Replies
Message 1 of 3

can't get child plug of CompoundAttribute in custom node

568278785
Explorer
Explorer

I have written a custom MPXnode that is only used to store data,

the Initialize() section of mpxnode: 

 

MFnCompoundAttribute compAttr;     
MFnNumericAttribute numericAttr;
arrayCacheObj = numericAttr.create("doubleArrayC", "dAC", MFnNumericData::kDouble, 0.0);
numericAttr.setStorable(true);

numericAttr.setWritable(true);

numericAttr.setKeyable(true);

numericAttr.setReadable(true);

numericAttr.setArray(true);
arrayCacheCompObj = compAttr.create("doubleArray", "dA");
compAttr.setArray(true);
compAttr.addChild(arrayCacheObj);
addAttribute(arrayCacheCompObj);

 I try to get child plug in my mpxcommand and set value:

MFnDependencyNode arrayCacheNodeFn(arrayCacheNode);
MPlug dAPlug = arrayCacheNodeFn.findPlug("doubleArray", true);
dAPlug.elementByLogicalIndex(0).elementByLogicalIndex(0).setValue(2);

did't work,what i missing?

Thanks for your help.

Accepted solutions (1)
507 Views
2 Replies
Replies (2)
Message 2 of 3

jmreinhart
Advisor
Advisor
Accepted solution
dAPlug.elementByLogicalIndex(0).child(0).elementByLogicalIndex(0).setValue(2);
Message 3 of 3

568278785
Explorer
Explorer

Thank you,it's the answer!