My last 3DS Max post about CG Source Floor Generator script generated another question: How to create a toolbar button for any script?
Instead of mulltiple clicks: Maxscript–>Run Script–> and choosing .ms; mcr files from the folder it’s more convenient to create UI button to run specific script directly. And it’s easy!!!
- Open the script Maxscript–>Open,
- Highlight all of the code (Ctrl-A) then
- Click drag it to a UI bar you want it to appear on.
This procedure will make a generic button at that spot in the UI that will activate the highlighted code whenever you click on it. Right clicking on the button allows you to modify it’s appearance. You can choose any icon from a list of max toolbar icon or create your own icons.
How to create your own max icon?
You need to create 24×24 pixel icon image and 16×15 pixel icon image (width x height) with a specific names as shown below and save them as Bitmap image (*.BMP)
It’s advisable to also create alpha channel images for these icons in the same size and format. White color for non transparent pixels.
[Icon’s Name] + _24i.bmp
[Icon’s Alpha Name] + _24a.bmp
[Icon’s Name] + _16i.bmp
[Icon’s Alpha Name] + _16a.bmp
New icon need to be copied to the folder specified in Additional Icons system path Customize–>Configure System Paths…
In Windows 7 it is:
C:\Users\user_name\AppData\Local\Autodesk\3dsMaxDesign\2013 – 64bit\ENU\usericons
CG FloorGenerator Icons – here you can download icons created by me for Floor Generator and Unique Material ID scripts.
And a video tutorial by Daniel Dye explaining how to create custom max icons:
And tutorial by Rohit Arora.
Buttons and Toolbar: TIPS
- To create a copy of a button press, ctrl and drag the button that you want to copy. It will create a copy of the button. You can also copy buttons from one toolbar to another using the same trick. It will work only if option Lock UI Layout (ALT + 0) under Customize menu is turned off.
- To delete a button, press ALT and drag the button you want to delete. It will work only if option Lock UI Layout (ALT + 0) under Customize menu is turned off.
- To dock your toolbar, just right click on it then Dock and choose the desire dock type (Top, Bottom, Left or Right).
- If you want to delete your toolbar, just go to Customize > Customize User Interface… Now under Toolbars tab, just select the toolbar that you want to delete and click on Delete… button.
Excellent explanation, very simple and useful. Thank you very much