Advanced Usage
 
 
 

The Customize Ribbon feature is intended primarily for reorganizing the ribbon interface to suit your working methods and for adding existing 3ds Max commands from the Action Items list. While this feature provides for adding other types of custom controls such as check boxes and spinners, making these functional requires advanced knowledge and scripting ability, including writing MacroScripts.

That said, to learn more about the inner workings of the ribbon, it can be useful to examine some existing controls and see how they connect to underlying scripts. For example, using the Customize Ribbon dialog, find the UVW Tweak spinner in the bottom-left corner of the Edit panel on the Graphite Modeling Tools tab.

ImportantProceed in this section only if you’re very familiar and comfortable with 3ds Max and computer programming. If you make a mistake, it’s possible to disrupt program functionality. For best insurance, make backup copies of all specified files and work only with the copies.

In the Existing UI list or the Preview Window, click the spinner, and then scroll to the bottom of the Properties list. The Maxscript property is UVWTweakSpinnerCallback. In the \stdplugs\stdscripts folder in the program-install directory, use a text editor to open the file PolyTools.ms. Search in the file for the text “UVWTweakSpinnerCallback” (without quotes). The search should come up with the following:

struct UVWTweakSpinnerCallback
(
  fn OnChanged iValue =
  ( 
    PolyToolsUI.UVWTweakChannel = iValue 
  ),

 	fn getValue = 
  ( 
    PolyToolsUI.UVWTweakChannel 
  )
)

This is the MAXScript code that connects the ribbon spinner with the 3ds Max software. It’s beyond the scope of this help to discuss the exact workings of the script, but you can find further information in the MAXScript Help, available from the Help menu.

Similarly, other ribbon controls invoke a MacroScript via the Command property. For example, using the Customize Ribbon dialog, find the Paint toggle button on the Paint Objects panel on the Object Paint tab. The Command property value is ObjectPaint Paint, which toggles the Paint command for the Object Paint feature. You can find this command in the Action Items list Main UI group PolyTools category. To apply an action to a button, you just drag it from the Action Items list to the Command value in the button properties. The ObjectPaint Paint command, incidentally, is defined in the MacroScript file Macro_PolyTools.mcr, found in the \UI\MacroScripts in the install directory.

So, to define custom functionality for a Button or Toggle Button control, first write a MacroScript for it, place the file in a directory from which 3ds Max automatically loads scripts at startup, and then restart 3ds Max so the command appears in the Action Items list. Next, add the button to the ribbon, find the command in the Action Items list, and drag the action to the Command property in the Properties section.