CompoundAttribute and setArray

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  01 January 2009
CompoundAttribute and setArray

Hi
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);
	strAttr.setStorable(true);

	MFnNumericAttribute numAttr;
	dig = numAttr.create("dig", "d", MFnNumericData::kDouble, 1.0, &stat);
	numAttr.setStorable(true);
	
	MFnCompoundAttribute cmpAttr;
	grp = cmpAttr.create("grp", "g", &stat);
	cmpAttr.setArray(true);
	cmpAttr.addChild(str);
	cmpAttr.addChild(dig);

	addAttribute(grp);
	............
}

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()	
{
	............
	//cmpAttr.setArray(true);
	............
}

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 January 2009
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:

myMayaTest1.grp[x].str

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 January 2009
I dont have AEtemplate.
If problem in AEtemplate, why this error doesnt occur in maya 2008? Sources are identical.
 
  01 January 2009
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).

Last edited by Keilun : 01 January 2009 at 06:16 PM.
 
  01 January 2009
I compile this for macosx-maya2008. AEtemplate dont exist. Nothing changed. Gray attributes and map button. How can I ungray it with AEtemplate?

Last edited by atap3d : 01 January 2009 at 06:15 PM.
 
  01 January 2009
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 06:00 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.