View Full Version : About "class MFnCompoundAttribute"~

Jeep Wang
03 March 2004, 05:23 AM
Is there any example about "class MFnCompoundAttribute" in MAYA API plugin example? Or someone can give me one,please!
I want to create a connectable MVectorArray attribute in my node,but i don't know which MFnAttribute to use.

Thanks for any help!:thumbsup:

03 March 2004, 09:21 AM
1. Just look at any of the shader examples. They all use compound attributes for things like colours, normals etc.

2. You have to careful here about exactly what it is that you want. Do you want
(a) a single plug of type MVectorArray?
Or do you want
(b) an array of plugs of type MVector?

If it's (a), you just need to create a typed attribute of type kVectorArrayData. In the compute cycle you then initialize a MFnVectorArrayData which will allow you to manipulate the underlying vector array. Be careful here, iirc getting the vector array from the MFn actually copies the entire array for you, so you have to set it back again (i could be wrong here, take a close look at the docs).

If it's (b) you need to create an array attribute of type kVectorData. The method for working with these isn't particularly straightforward from my recollection, but it's well-documented.

Incidentally, you might want to subscribe to the maya-dev mailing list at -- that's the best place to ask Maya API questions.

Jeep Wang
03 March 2004, 05:08 AM
Thanks very much! You are a good man,so I prefer to ask you. :applause: :thumbsup:

CGTalk Moderation
01 January 2006, 06:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.