Your Ad Here

Running Custom Commands

You can run a custom command in any of the following ways:

• By clicking a button or selecting a menu item in a custom toolbar. See Adding Custom Commands to Custom Toolbars.

• By pressing a key on the keyboard. See Mapping Custom Commands to Keys.

• Automatically whenever you select something in a 3D view or whenever you change frames. See Running Commands Automatically.

• By using the command in scripts and other commands.

When you run a custom command, the command gets logged to the history, together with any parameter values.

If the command contains only actions that can be undone (for example, if it does not contain commands like DeleteAll), then you can undo the result of your custom command by choosing Edit > Undo from the main menu.

 

To add custom commands to the built-in menus, see the SDK Guides.

Adding Custom Commands to Custom Toolbars

You can add custom commands to custom toolbars in the same way as any native command—see Adding Commands to Toolbars.

• If you are using the Customize Toolbar window, set Command Categories to Custom.

• If you are using the explorer, activate the Custom filter on the Filters menu.

 

If you have already created a command for a script and you drag the script instead of the command onto a second toolbar, you are creating a second command and must provide a unique command name for scripting. This means that different commands are logged when you click on the different buttons.

Mapping Custom Commands to Keys

You can map a custom command to a key on your keyboard in the same way as any native command. The complete procedure is described in Creating and Modifying Key Maps. In the Keyboard Mapping window, select Custom Script Commands from the Group list.

Running Commands Automatically

You can run custom commands or any native XSI command automatically in either of the following ways:

• Whenever an object is selected.

• Whenever you change frames.

• You can also bind scripts and commands to events so that they are triggered automatically in response to specific actions and states. For more information, see Events.

To run a script file automatically, you must first create a custom command based on the script.

To run scripts automatically when an object is selected in a geometry view

1. Choose File > Preferences from the main menu.

The Preferences window opens.

2. Expand the Tools folder and click Selection.

3. Enter the command name and any parameters in the Selection Change Command box. For example, in VBScript syntax:

   LogMessage GetValue("SelectionList")

This setting is stored in your preferences and used with all scenes.

 

The Selection Change Command is run only when you select something in a 3D view. It is not run when selecting elements in the explorer or schematic views.

To run scripts automatically when the current frame changes

You can select a script or native XSI command to run automatically after the current frame is changed and the scene is updated. This lets you use scripts to simulate “persistent” effects.

1. Choose Playback > Playback Options from the Playback panel below the timeline.

The Play Control property editor opens.

2. Click the Update tab. In the On-Frame-Change Script Command box, enter the command name and any parameters. This setting is stored with the scene.

 

The On-Frame-Change Script Command setting is saved with the scene. If you set it to a custom command, make sure the custom command is available on all systems used to open the scene.



SOFTIMAGE|XSI v.6.01     

Return to Softimage XSI Index


Your Ad Here