-1

I have written a custom MPXnode that is only used to store data, in 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);

enter image description here The command couldn't find the corresponding plug I thought, and I also tried the.child(0) method.What did I do wrong?

Hisen
  • 1
  • 3

1 Answers1

0

For anyone else who has this problem: dAPlug.elementByLogicalIndex(0).child(0).elementByLogicalIndex(0).setValue(2);

Hisen
  • 1
  • 3
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 04 '22 at 19:11