I am in the process of writing my first Python plug-in for Maya.
The plug in is a simple utility node.
I am able to get the node to load in but i do not like the way it looks in the attribute editor.
I feel like there must be a way to change this but i am at a loss for what API classes to use/how to go about it.
More importantly i would like to know what is really going on with regard to the visual presentation of a node in the attribute editor.
I can’t help you here other than to say that the Attribute Editor is largely driven by a pile of MEL spaghetti if you want to poke at it. All the scripts have “AE” in the name…
you will need to create your own Attribute Editor Template MEL file. Every node needs one if you want to control the formatting of the attributes in the AE.
The MEL file needs to follow a naming convention:
AEmyUtilityNodeTemplate.mel
Inside that file there needs to be a global proc with the same name.
global proc AEmyUtilityNodeTemplate(string $nodename)
{
… do formatting here…
}
As long as this file is on your MAYA_SCRIPT_PATH, maya will automatically pick it up.
I’ve just written my first AETemplate recently, so I understand the frustration of there not being many resources available…
Chad’s is a nice example of something that is really simple to do, given basic attributes. If you need more customization (or just want to control every single aspect of the layout), you’ll want to use the -callCustom flag. When using the “callCustom” flag, you need to pass in the name of the proc that will create the UI elements the first time, the name of the proc that will update the UI elements when the selection changes (or something else happens), and the attribute name.
In my case, I had a compound array attribute, and I absolutely hated the way Maya handled them in the AE. So I went ahead and wrote my own that I felt was cleaner and more intuitive when displaying mesh connections and component lists.