MArrayDataHandle, MArrayDataBuilder, first array element not set

I have got a problem with node’s array output. I use MArrayDataHandle and MArrayDataBuilder to create data output. It seems like all works except data with index [0], other data is correct.

I do it with this piece of code:

arrayDataHandle = om.MArrayDataHandle( data.outputArrayValue( vfk_node.oRotate ) )

outputArrayBuilder = om.MArrayDataBuilder( data, vfk_node.oRotate, 0 )

elementHandle = om.MDataHandle( outputArrayBuilder.addLast() )
elementHandle.set3Float( 1.0, 2.0, 3.0 )

elementHandle = om.MDataHandle( outputArrayBuilder.addLast() )
elementHandle.set3Float( 4.0, 5.0, 6.0 )

elementHandle = om.MDataHandle( outputArrayBuilder.addLast() )
elementHandle.set3Float( 7.0, 8.0, 9.0 )

arrayDataHandle.set( outputArrayBuilder )

The outputs of oRotate are:
[0] 0, 0, 0
[1] 229.183, 286.479, 343.775
[2] 401.07, 458.366, 515.662

Looks like outputs are multiplied by degrees/radians conversion ratio, I can deal with that later, but output [0] is not set at all.
Am I missing something?

I have the same problem :unamused:

You get the expected result.
You have added elements to indices one through three inclusive.
In this case, you did not add an element to index zero.

OpenMaya.MArrayDataBuilder Class Reference

def OpenMaya.MArrayDataBuilder.addLast()

addLast()MDataHandle

Adds a new element to the end of the array.
The index of the element will be the current highest index + 1.
Returns The handle for the new element

If you wish to use .addLast(), then first assign a value to the array’s zero element using OpenMaya.MArrayDataBuilder.addElement(0)

def OpenMaya.MArrayDataBuilder.addElement()

addElement(index)MDataHandle

Adds a new element to the array at the given index.

  • index (int) - the index at which we wish to add the new element

Returns The handle for the new element