I'm relatively new to node writing and Maya's Python 2.0 API and am creating a custom node to do some computation using a pre-determined number of input points. For our purposes, we'll say 7 points.
I've successfully added the Compound Array attribute to my node using the following code in my Node Class's initialize method:
cAttr = OpenMaya.MFnCompoundAttribute()
node.test = cAttr.create('test','t')
xv = OpenMaya.MFnUnitAttribute()
node.testX = xv.create('testX','tx',OpenMaya.MFnUnitAttribute.kDistance)
xv.storable = True
xv.writable = True
cAttr.addChild(node.testX)
xv = OpenMaya.MFnUnitAttribute()
node.testY = xv.create('testY','ty',OpenMaya.MFnUnitAttribute.kDistance)
xv.storable = True
xv.writable = True
cAttr.addChild(node.testY)
xv = OpenMaya.MFnUnitAttribute()
node.testZ = xv.create('testZ','tz',OpenMaya.MFnUnitAttribute.kDistance)
xv.storable = True
xv.writable = True
cAttr.addChild(node.testZ)
cAttr.array = True
node.addAttribute(node.test)
Now that I have this, how can I specify that I want the node.test (cAttr) array to have 7 elements?
Thanks so much!