Maya Api c++ - MfnGenericAttribute issue

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?

Problem resolved

Finally the answer was in the documentation …

In the case of the array types, the MDataHandle.data() 
method can be used to retrieve the MObject for the 
attribute and to initialize the MFnNumericData function set.

So for getting the vector value from the MFnGenericAttribute i do like this:

MObject dataObj = inputV_Handle.inputValue().data();
MFnNumericData numData(dataObj);
float x, y, z;
numData.getData3Float(x, y, z);

And for setting the value onto an output GenericAttribute, the same way:

MFnNumericData numData;
MObject dataObj = numData.create(MFnNumericData::k3Float);
numData.setData((float)x, (float)y, (float)z);
outputM_ElementHandle.set(dataObj);

An now eveything working fine