Custom Buttons in Maya 6.0
This is my favorite feature of Maya, well one of em anyway. I am all about the User Interfaces in programs, especially 3D. You spend days in there and a good interface makes you or breaks you. Here's how to create a custom button in Maya and attach a MEL script to the button. In our example, we will make a simple cone and place it on the floor in Maya. Open Maya and view your script editor under Window > General Editors > Script Editor. In the lower part of the editor window type this into the text box.
polyCone;
scale 1 .1 1;
This is MEL script for creating a simple cone in Maya. You run this code to see it work by hitting Ctrl + Enter. A new cone will appear on your main stage. Now the super easy part. To create a menu tray button. First choose the shelf you want this button added to. I used custom but any will do. With the custom shelf open, in the script editor, under File, choose the "Save selected to Shelf" option. It will let you name the selection and a new button with a mel icon will appear in the designated shelf. This button stays even after quiting Maya. You can delete this button by editing your Shelves. Get here by going under Window > Settings/Preferences > Shelves.
In the shelf editor, you can also make your own icons for these buttons. A standard color 32x32 pixel bitmap image can be created in your image program and set as the button's icon. Place your custom bitmap in "C:/Program Files/Alias/Maya6.0/icons" and you can choose it from the list in the shelf editor. Make sure the icon stays there or you will get a blank button in Maya.
|