MFnIntArrayData -> ERROR -> Argument is a NULL pointer


#1

Hi community,

I am trying to access an array inside my deformer node. Until now I only tried to access single values but now it s an array and I m bumping into a problem.


 // previous code to get to h_triangleVertices ...
 MDataHandle h_triangleVertices = h_vertexInfluences.outputValue().child(a_triangleVertices);
 MObject o_triangleVertices = h_triangleVertices.data();
 MFnIntArrayData d_triangleVertices(o_triangleVertices, &status);
 CHECK_MSTATUS_AND_RETURN_IT(status);
 

this status returns me an error : Argument is a NULL pointer

So I presume that “o_triangleVertices” is NULL but I can’t figure out why, I looked at some other examples and it sems that I am doing it the right way.

any idea ?


#2

If you are looking at the handle for an array entry point out of a block you might want to switch MArrayDataHandle.
Other than that code and post are a little bit hard to decipher exactly what problem you are having.


#3

If I change to MArrayDataHandle I don’t have access to .data() so I can use MFnIntArrayData
But basicallly I m going through my coumpound attribute and my last child is an array of 3 ints.

But maybe there is an other way to access an array directly with an other method ?
I simply want to convert this array attribute to an intArray


#4

It looks like ‘o_triangleVertices’ is an attribute array which you have to access with ‘MArrayDataHandle’. Then you go to the specific index, get the MDataHandle and then look for the three values :

double3& vertexData = handle.[asDouble3](http://forums.cgsociety.org/)();

#5

This is working, I totally forgot that I could set it this way as it’s an int3… stupid me.