Wednesday 2 March 2011

AE Node Templates

So it turns out the fancy formatting in the Maya attribute editor (shader ramps, colour choosers, file browsers, etc) are actually defined in MEL templates, found in the Maya/Scripts/AETemplates folder. The following is a quick example of how these are written.

Today's problem:


My attributes are showing up, but I'd like them to appear a little more intuitive.


Today's solution:
Granted the node isn't particularly dense so far: even lights seem to have hundreds of attributes. My assumption going into node scripting was that the layout of attributes would be coded along with the rest of the node: in the Python/C++ plugin. I had not read anything to suggest otherwise, and it was only after asking around a forum that I was directed to the Attribute Editor Templates.

If you're familiar with MEL the following will be pretty easy for you. Hell, if you're writing a custom node for Maya, this should be trivial. Here's my template until I develop the node further:

The following is saved as AEADANodeTemplate.mel, the format being AE<node_name>Template.mel. Still looking for a good html syntax highlighter.

  1. global proc AEADANodeTemplate( string $nodeName )
  2. {
  3.     editorTemplate -beginScrollLayout;
  4.     //File Attributes
  5.     editorTemplate -beginLayout "File Attributes" -collapse 0;
  6.         editorTemplate -addControl "input";
  7.     editorTemplate -endLayout;
  8.    
  9.     //Amplitude
  10.     editorTemplate -beginLayout "Amplitude" -collapse 0;
  11.         editorTemplate -addControl "amplitudeL";
  12.         editorTemplate -addControl "amplitudeR";
  13.     editorTemplate -endLayout;
  14.     AEdependNodeTemplate $nodeName;
  15.     editorTemplate -addExtraControls;
  16.     editorTemplate -endScrollLayout;
  17. }


Starting to look a bit more like a real Maya node!

No comments:

Post a Comment