writing compound attributes

26 views
Skip to first unread message

fruit...@gmail.com

unread,
Feb 21, 2018, 11:05:25 PM2/21/18
to Python Programming for Autodesk Maya
hi !

I'm writing a node with compound attributes, and, as always, I'm struggling with syntax !
I want my attributes to have this hierarchy :
element
|__element[0]
|__ element[0].position
|__element[0].positionX
|__element[0].positionY
|__element[0].positionZ
|__ element[0].rotation
|__ ...
|_ element[1]
|__ etc...

(Position is an MFnNumericAttribute.createPoint() and orientation is an array, and my attributes are outputs)

So the declaration is done correctly, but when I need to write them with the databuilder, it's getting a bit more tricky :

hElement = data.outputArrayValue(Node.aElement)
bElement = hElement.builder()
and finally
for i in xrange(num_elements):
bElement.addElement(i).setFloatVector(0, 1, 0)

Obviously, I'm doing something wrong, because my node always returns 0,0,0.
I think I'm actually pointing to the parent, but don't know how to access to the child, from there.
Any idea ?

Thanks

(I'm using the python api2.0 for this one)

fruit...@gmail.com

unread,
Feb 23, 2018, 5:17:22 PM2/23/18
to Python Programming for Autodesk Maya
quick update in case someone else has the problem..
I just realized I was missing MArrayDataBuilder.addArrayElement() with the api2.0 not because it's been replaced by something else, but just because it's not implemented yet in 2017. Supposed to be available in 2018 (according to the documentation), but in fact, it's not... so I'm back to old api1.. again ^^
Reply all
Reply to author
Forward
0 new messages