Hello everyone, i am writing a plugin using maya api2 , im pretty fresh with api in general but i stumbled upon an issue for which i can’t find any real answer to it.
How do you deal with array’s attributes ?
For instance,
i have an attribute
MFnNumericAttribute , which is called “params” , this is an array attribute, and all seems fine to here.
When i run the node and connect stuff to it in maya , it creates extra inputs as it should, im able to query and do stuff with it.
Now , i have also another MFnNumericAttribute , which is called “outTranslate”, this is also an array attribute, but has only outputs.
my initialize looks like something like this :
====================================
nAttr = om.MFnNumericAttribute()
cls.params = nAttr.create(“params”, “p”, om.MFnNumericData.kDouble, 0.0)
nAttr.array = True
cls.outTranslate = nAttr.create(“outTranslate”, “ot”, om.MFnNumericData.k3Double, 0.0)
nAttr.array = Truecls.addAttribute(cls.params)
cls.addAttribute(cls.outTranslate)cls.attributeAffects(cls.params, cls.outTranslate)
====================================
Now , how do i make so that , when i connect something into my input params array attribute , it also update the array attributes for outTranslate ? so that the two arrays are in sync and each input index is paired to the output index ?
Do i need to do this inside the compute() function ? if so, how ?
Do i need to do this using a maya script as im connecting stuff to it on creation ? ( from outside the node?)
im a little unclear if im missing something out, i was hoping that attributeAffects would actually also connect the array number out automatically being both arrays…but doesn’t look like it…(so naive of me…) .
Any example or explanation would be great, even if in cpp, or api1, i would just like to understand what to do, since i assume, it would be something fairly common on a node? .