Page 1240 - Kitab3DsMax
P. 1240

Part XII: MAXScript and Plug-Ins
                                             To create a custom rollout using the Visual MAXScript Editor, follow these steps:
                                                 1. Open the BuildCube.max file from the Chap 49 directory on the DVD.
                                                     This file includes a simple sphere object.

                                                 2. Choose MAXScript ➪ New Script to open the MAXScript Editor window. In the editor window,
                                                    enter the following:
                                                    utility buildCube “Build Cube” ( )

                                                     This line creates a utility named buildCube. The rollout name is Build Cube. Make sure to include
                                                    a space in between the parentheses.
                                                 3. Choose Tools ➪ New Rollout from the window menu (or press the F2 key). The Visual MAXScript
                                                    window opens. The properties for this rollout are displayed in the Properties panel. Drag the
                                                    lower-right, black square handle to resize the rollout form.
                                                 4. Click the spinner button on the bottom toolbar, and drag in the rollout form to create a spinner ele-
                                                    ment. In the Properties panel, set the name to SideNum, set the caption value to No. of Side
                                                    Objects, select the type, and set the range to [1,100,5]. The range values set the lower, upper, and
                                                    default values for the spinner. Then drag the element handles to resize the element to fit in the form.
                                                 5. Click the spinner button again, and drag in the rollout form to create another spinner element. In the
                                                    Properties panel, set the name to length, set the caption value to Side Length, select the type, and set
                                                    the range to [1,1000,50]. Then drag the element handles to resize the element to fit in the form.
                                                 6. Click the button icon on the bottom toolbar, and drag in the rollout form to create a button
                                                    below the spinners. In the Properties panel, set the name to createCube and the caption value to
                                                    Create Cube. Then drag the element handles to resize the button so the text fits on the button.
                                                    Open the Event Handlers panel, and select the Pressed check box.
                                                 7. Drag over the top of both the spinners to select them both, and choose Layout ➪ Align ➪ Right (or
                                                    press Ctrl+right arrow) to align the spinners. Figure 49.20 shows how the rollout layout looks.
                                                      FIGURE 49.20
                                                    The rollout laid out in the Visual MAXScript window



























                                      1192
   1235   1236   1237   1238   1239   1240   1241   1242   1243   1244   1245