Building scripts can be complicated, and piecing together a rollout for a scripted utility can be especially time-consuming and frustrating when done by hand. To help create such custom rollouts, Max includes the Visual MAXScript Editor. Using this editor, you can drag and drop rollout elements and automatically create a code skeleton for certain events.
Working with textual commands can be time-consuming. In order for the script to work, you need to enter the commands exactly. This can be especially tricky when you're trying to lay out the controls for a rollout. Max includes a tool called the Visual MAXScript Editor that speeds up the creation of rollouts.
To access the Visual MAXScript window, shown in Figure 49.17, select it from the MAXScript menu. Another way to access this window is to select Edit New Rollout or Edit Rollout (F2) in the MAXScript Editor window.
Figure 49.17: The Visual MAXScript window makes building rollouts easy.
Layouts for a rollout created in the Visual MAXScript window can be saved as files with the .VMS extension using the File menu. If you access the window from a MAXScript Editor window, then the Save menu automatically updates the editor window.
The window includes two major panes. The left pane is where the various rollout elements are assembled, and the right pane holds the Value and Event Handlers tabbed panels. The Value panel lists all the properties and their associated values for the selected element. You can change the property values by clicking on them and entering a new value. For example, if you select a Button element in the left panel, then the properties for that control are presented in the Value panel. If you click the Caption Property, its value becomes highlighted; you can type a new caption, and the new caption appears on the button.
The Event Handlers panel lists all the available events that can be associated with the selected element. Clicking the check box to the left of these events can enable the events. For a button element, you can enable the pressed event. With this event enabled, the code includes a function where you can define what happens when this event is fired.
At the top of the interface are some menu options and a main toolbar. The File menu also lets you create a new layout (Ctrl+N), save layouts to a file (Ctrl+S), and open saved layouts (Ctrl+O). The Edit menu allows you to cut (Ctrl+X), copy (Ctrl+C), and paste (Ctrl+V) form elements. You can find these same features as buttons on the top toolbar.
The Layout menu includes options for aligning elements left (Ctrl+left arrow), right (Ctrl+right arrow), top (Ctrl+up arrow), bottom (Ctrl+down arrow), vertical center (F9), and horizontal center (Shift+F9); to space elements evenly across (Alt+right arrow) or down (Alt+up arrow); make elements the same size by width, height, or both; center vertically (Ctrl+F9) or horizontally (Ctrl+Shift+F9) in the dialog box; and flip. You can use the Layout Guide Settings menu command to specify grid snapping and spacing. Grids are enabled using the Toggle Grid/Snap button on the right end of the main toolbar.
You can also access these commands using a right-click pop-up menu when clicking on the left pane.
The toolbar along the bottom of the window contains the form elements that you can drop on the form. These buttons and elements include those shown in Table 49.2.
Button | Element | What It Does |
---|---|---|
| Bitmap | Lets you add bitmap images to a rollout |
| Button | Adds a simple button |
| Map Button | Adds a mapping button that opens the Material/Map Browser |
| Material Button | Adds a material button that also opens the Material/Map Browser |
| Pick Button | Adds a button that lets you pick an object in a viewport |
| Check Button | Adds a button that can be toggled on and off |
| Color Picker | Adds a color swatch that opens the Color Picker dialog box when clicked |
| Combo Box | Adds a list with several items |
| Drop Down List | Adds a list with one item displayed |
| List Box | Adds a list with several items displayed |
| Edit Box | Adds a text field that can be modified |
| Label | Adds a text label |
| Group Box | Adds a grouping outline to surround several controls |
| Check Box | Adds a check box control that can be toggled on or off |
| Radio Buttons | Adds a set of buttons where only one can be selected |
| Spinner | Adds an up and down set of arrows that can modify a value field |
| Progress Bar | Adds a bar that highlights from left to right as a function is completed |
| Slider | Adds a slider control that can move from a minimum to a maximum value |
| Timer | Adds a timer that counts time intervals |
| ActiveX Control | Adds a generic ActiveX control created by a separate vendor |
| Custom | Adds a custom control that can be defined as needed |
At the bottom right of the window are two text fields that display the coordinates of the current mouse cursor position and the size of the rollout. The default size of the rollout is 162 × 300, which is the size needed to fit perfectly in the Command Panel.