Hi,
I am creating a custom MpxNode for maya in c++. And i 've an issue when using the MfNGenericAttribute.
The problem is that i can’t return vector value. It’s work fine with floating value but i don’t know how to access vector value.
I declare the attribute in initialize like that:
inputV = gAttr.create("input_nV", "in_nV");
gAttr.addNumericDataAccept(MFnNumericData::k2Float);
gAttr.addNumericDataAccept(MFnNumericData::k3Float);
gAttr.addNumericDataAccept(MFnNumericData::k2Double);
gAttr.addNumericDataAccept(MFnNumericData::k3Double);
gAttr.addNumericDataAccept(MFnNumericData::kFloat);
gAttr.addNumericDataAccept(MFnNumericData::kDouble);
gAttr.setStorable(true);
gAttr.setKeyable(true);
gAttr.setConnectable(true);
gAttr.setArray(true);
addAttribute(inputV);
Then i access the value from the attribute in the compute like that:
MPlug inputV_Plug = depFn.findPlug("input_nV");
MIntArray inputV_count;
inputV_Plug.getExistingArrayAttributeIndices(inputV_count);
MArrayDataHandle inputV_Handle = data.inputArrayValue(inputV);
//After that i iterate over inputV_count.length()
for (int k = 0; k < inputV_count.length(); ++k)
{
inputV_Handle.jumpToArrayElement(k);
MPlug updateV = inputV_Plug.elementByPhysicalIndex(k);
MFloatVector tempV =inputV_Handle.inputValue().asFloatVector();
}
When i get floating i do like this and it’s working fine (for the last line)
float tempV = inputV_Handle.inputValue().asGenericFloat();
I have no idea what it’s wrong in my process.
Because if in the init i replace the MfNGenericAttribute by a MFnNumericAttribute it’s working fine. But i would like to avoid to have two parameter it’s why i’am trying to use generic attribute.
Someone have an idea on how to use generic in this kind of situation?