Creating an Array of CompoundAttributes

39 views
Skip to first unread message

Dilen Shah

unread,
Jan 14, 2014, 4:41:42 AM1/14/14
to python_in...@googlegroups.com
Hey guy,

How can i create an array of compound attributes? I am trying to create a node that has many input matrix and i extract and translation, rotation and scale values from each matrix.

I want to create compoundAttribute like this: [[(matrix1TX, matrix1TY, matrix1TZ), (matrix1RX, matrix1RY, matrix1RZ), (matrix1SX, matrix1SY, matrix1SZ)][(matrix2TX, matrix2TY, matrix2TZ), (matrix2RX, matrix2RY, matrix2RZ), (matrix2SX, matrix2SY, matrix2SZ)]] and so on and so forth.

D.

Dilen Shah

unread,
Jan 15, 2014, 4:40:14 AM1/15/14
to python_in...@googlegroups.com

Found the solution here it is for anyone else who needs it or will need it in future:
initialize()
cAttr = OpenMaya.MFnCompoundAttribute()
cAttr.create("compoundArray", "cArray")
cAttr.setArray(True)
cAttr.setUsesArrayDataBuilder(True) // gives the main functionality for the array of compound array

compute()
inputArray = dataBlock.inputArrayValue(cArray) 
outBuild = inputArray.builder()
for i in range(0, n):
     outBuild.addElement(i)

inputArray.set(outBuild)

Reply all
Reply to author
Forward
0 new messages