LC #42 Pipers Alley

View Full Version : CompoundAttribute and setArray

01-16-2009, 11:24 AM
I'm trying to write maya node
I have a very simple code

MStatus myMayaTest::initialize()
MFnTypedAttribute strAttr;
str = strAttr.create("str", "s", MFnData::kString, &stat);

MFnNumericAttribute numAttr;
dig = numAttr.create("dig", "d", MFnNumericData::kDouble, 1.0, &stat);

MFnCompoundAttribute cmpAttr;
grp = cmpAttr.create("grp", "g", &stat);


after a successful compilation and creation node in Maya 2009, the attribute-editor looks like this

after clicking "Add New Item" button Maya reported error

I try to comment string cmpAttr.setArray(true); and compile source.

MStatus myMayaTest::initialize()

my node looks like this

it is impossible to enter anything in "dig"

I checked it in Leopard and Windows

after a successful compilation and creation node in Maya 2008, the attribute-editor looks like this

the "Add New Item" button successfully pressed, but the new attributes is gray. it is impossible to enter anything. And what is the "map" button?

Please help me to make a correct Array of CompoundAttribute with an opportunity to enter the parameters

01-16-2009, 03:28 PM
Can we see your AEtemplate?

The first error of "Found no attribute match for: myMayaTest1.str" is pointing to some problems in your AEtemplate. In particular, str is a child of grp. So when you want to reference it, you now need to address it as:


where x is the index of the compound attribute that you would like to query. I'm not sure why the UI elements are greyed out, but I'd guess we'd know more once we saw your AEtemplate code.

01-16-2009, 06:05 PM
I dont have AEtemplate.
If problem in AEtemplate, why this error doesnt occur in maya 2008? Sources are identical.

01-16-2009, 06:12 PM
How exactly are the "map" buttons being generated in your 2008 build? Those don't look default to me. At least I cannot recall those as default controls for compound array attr.

If you really don't have an AEtemplate, then that would point to a bug perhaps in the default AEtemplate code in 2009.

In any case, I would recommend creating your own AEtemplate to define the UI as you see fit. The default AEtemplate code will rarely give you the UI that you want (eg. the "dig" attribute probably won't expand properly unless you define your own UI template).

01-21-2009, 06:09 PM
I compile this for macosx-maya2008. AEtemplate dont exist. Nothing changed. Gray attributes and map button. How can I ungray it with AEtemplate?

CGTalk Moderation
01-21-2009, 06:09 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.