PDA

View Full Version : Maya C++ API - channelbox: button-like attribute?


dewlorr
02-16-2009, 05:38 PM
Hello,

I have a plugin which has several attributes. I want user to be able to tweak the attributes, but I don't want the changes to get applied until he has pressed some kind of 'Apply' button.
(The plugin is doing some heavy calculations, so each time you make a slightest change, the plugin has to recompute the modificiations. Which is not desired.)

I am looking for a way to create a button in the channelbox, where the attributes of my node are at the moment. Is it possible at all to do such a thing? According to the docs it seems there is no attribute type that matches a button GUI element, but on the other side, if I take a look at a normal box, pCubeShape1 tab in the channelbox, under the 'Displacement Map' rollout there is clearly a 'Calculate Bounding Box Scale' button.

Do you happen to know how to do this?

thanks,
dew

goleafsgo
02-16-2009, 06:04 PM
I think you mean the "Attribute Editor" instead of "Channelbox". Attribute editor UI are created in "attribute editor templates". For poly meshes look in the file "AEmeshTemplate.mel", and for your specific example of the "Calculate Bounding Box Scale" look in "AEgeometryShapeTemplate.mel".

Depending on your experience with mel you might find those files a little confusing, so feel free to take a look around and post more questions. (If you feel like messing around with them make sure you make backup copies first)

dewlorr
02-19-2009, 02:09 PM
goleafsgo,
thank you very much for your swift reply.

Working with templates is indeed simple. Once I understood how they work, it was cakewalk to use them. But it took me some time to read through the bits and pieces, and check and compare the (not so few) mel scripts and templates in the SDK, in order to find that simple truth.

Just for the sake of completeness, in case somebody else needs the same info I was looking for, here is the bottom line:
++ your AETemplate (in my case for the modifier node) has to be named AE<your_node_name*>Template.mel
++ Its location has to be in Maya's scripts look up path (correct me if I am wrong here, in my case this was Programs\Autodesk\Maya2009\scripts\)

* - be careful here, the your_node_name is the same name that you register your node via plugin.registerNode().

goleafsgo
02-19-2009, 02:20 PM
goleafsgo,
++ Its location has to be in Maya's scripts look up path (correct me if I am wrong here, in my case this was Programs\Autodesk\Maya2009\scripts\)

No problem, glad you worked it out.

FYI you can query what Maya is using for its scripts path like this:

getenv MAYA_SCRIPT_PATH

Robert Bateman
02-19-2009, 02:45 PM
(correct me if I am wrong here, in my case this was Programs\Autodesk\Maya2009\scripts\)

ok! you're better off using :

My Documents/maya/scripts/

CGTalk Moderation
02-19-2009, 02:45 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.