Script-based Custom Parameter Sets
Script-based custom parameter sets are a convenient way to create custom properties if you are already familiar with a scripting language. With script-based custom parameter sets, you have complete control over the layout of the property editor. You also have control over the logic, for example, you can make use of callbacks to disable or hide certain parameters when other parameters change.
Script-based custom parameter sets are self-installing plug-ins. They can be located in the Application\Plugins subdirectory of the user, workgroup, or factory paths. In addition, they can be located in a path specified by the XSI_PLUGINS environment variable, or included in an add-on. At startup, Softimage loads all the script-based custom parameter sets it finds in these locations. Once loaded, you can apply the property using commands or methods.
The next section describes how to use the Custom Property Set Wizard to create a rough template for a script-based custom parameter set. For a complete description of script-based custom parameter sets and the methods to use, see the SDK Guide.
Creating a Script-based Parameter Set
You can use the Custom Property Set Wizard to quickly create a template for a script-based custom parameter set, including stub functions for callbacks. You can use the script-based property as is, or edit the template in any text editor to further refine the property set.
To create a template for a script-based custom property set
1. Do one of the following:
- To build the parameter set from scratch, select an element on which to apply the custom property and choose Create > Parameter > Custom Property Wizard from the Animate toolbar.
- To base the scripted parameter set on a simple one in your scene, open the simple parameter set in a property editor, then right-click in the light gray header bar of the property editor and choose Migrate to Self-installed.
The CPSet Wizard property editor opens.
2. On the Plug-in Info tab, enter general information about your parameter set.
If you started from an existing, simple parameter set as described above, Model Property already contains its name. You could also have entered its name directly (model.object.name) or clicked the browse button (...) and picked it from an explorer.
3. Use the Add Parameter tab to create each element you want in your parameter set. First select the desired ParamType, then enter the appropriate information, and finally click Add Item.
4. If desired, use the Layout (Optional) tab to define how your parameter set appears in a property editor:
- To add a parameter to the layout, select it under Parameters and click Add.
- To change the order of items, select them under Layout and click Up or Down.
- To group items in tabs or group boxes, enter a name in the Name box and click Add Tab or Add Group. Use Up and Down to move items between the braces to add them to the groupings.
- To put multiple parameters or groups on the same row, click Add Row and then use Up and Down to move items between the braces of the Row item.
- To remove any item, select it under Layout and click Remove.
5. To preview your parameter set, click Generate Property. A script file is created and opened in a text editing window. In addition, the parameter set is applied to the selected object and its property editor is displayed.
6. If desired, return to the CPSet Wizard to refine your parameter set, for example, to add more items or modify the items listed in the Parameters grid, and then generate the property again.
If you close the wizard, you can re-open it by clicking the CPSetWizard node under the Scene_Root in an explorer.
7. Once you are satisfied with the rough template, finish your parameter set by editing the generated script. For example, you can:
- Define the actions performed by callback functions.
- Give a parameter a label that is different than the script name (such as a friendly name with spaces in it).
- Dynamically change the layout based on user options.
- Define combo boxes and other more advanced controls.
- Refine the layout.
- Tweak the appearance of the controls, for example, hide a label, set the number of decimal places in a slider, and so on.
See the SDK Guide for more information about these options.
Once you have modified the script manually, do not regenerate the property. Doing so will overwrite your modifications.
Autodesk Softimage v.7.5