Managing Scripted Operator Presets

 
 
 

When you first create a scripted operator, it is a runtime-defined operator. This means that its data is stored in the scene in which it was created and you cannot easily use it in other scenes or even on other elements in the same scene.

However, you can reuse your scripted operator by saving it as a preset and then applying it on other elements. There are two parts to a scripted operator preset: the preset file itself and an associated SPDL file. When you apply a preset scripted operator, the scene contains a reference to the preset file instead of the actual data itself.

Note

You can only edit the original scripted operator. You cannot edit the operator on any of the applied preset instances. If you try to edit an applied preset instance, you are prompted to confirm that you want to convert it to a runtime-defined operator.

For this reason, it's a good idea to keep the original operator around (perhaps in its own scene) so that you don't lose track of where it is. If you ever need to make changes, you can reopen the original operator, modify it, and save the preset again.

NoteTo reuse an operator with multiple scenes and objects, self-installing custom operators are better than preset-based operators. Self-installing custom operators are described in more detail in Custom Operators [SDK Guide]. There is a wizard for creating new self-installing custom operators, and some tips for converting a runtime-defined operator to a self-installing one.

SPDL Files and the Registry

To work with scripted operator presets, the SPDL file must be registered on the system. The SPDL file is automatically registered in a couple of cases:

  • The SPDL file is registered on your local machine when you save a scripted operator preset.

  • The SPDL file is registered at startup if it is found in the workgroup path.

In all other cases, you must register the SPDL file manually to apply a preset or open a scene with an applied preset on another computer. You can copy and register a SPDL file manually, or you can create an add-on package.

For more information, see Building and Deploying Customizations [SDK Guide].

Saving Presets of Scripted Operators

Saving a preset of a scripted operator creates both a preset and an associated SPDL file, and automatically registers the SPDL file on the computer.

To save a preset of a scripted operator

  1. In the scripted operator editor, choose File Save.

  2. In the browser that opens, specify a file name and location for the preset file. The default directory is the \Autodesk\Softimage_2013\Data\DSPresets\Operators subfolder of your user application data directory.

    A SPDL file with the same name is created and automatically registered in the \Autodesk\Softimage_2013\Application\spdl subfolder of your user application data directory.

Applying Presets of Scripted Operators

If the associated SPDL file is registered on your computer, you can apply a preset of a scripted operator.

To apply a preset of a scripted operator

You can load a preset of a scripted operator using the ApplyOp command in a script, in the script editor window, or directly from the command box in the lower left corner of the main window.

For example, to apply a preset called Clip to the currently selected object, type:

ApplyOp "Clip"

To apply the preset to a specific object called MyObject, type:

ApplyOp "Clip", "MyObject"

When you connect to parameters, you only need to specify the object. Connections are automatically made to the right parameters. However, you can specify parameters if you want to connect to different ones.

If there are multiple connections, use a comma-delimited string for the connection list. Connections must be listed in a particular order. Output connections are listed first, in the order in which they are listed in the scripted operator editor. If an output connection is repeated in the editor, only its first occurrence should appear in the connection list.

The input connections are listed after the output connections, also in the order they appear in the editor. Again, if an input connection is repeated in the editor, only its first occurrence should appear in the connection list.

Similarly, if an input connection is the same as an output connection, only the occurrence of the output connection should be listed. For example, the following connection list would correspond to the connections shown in the illustration:

ApplyOp "Clip", "OutObj1,OutObj2,InObj"

Editing Presets

You cannot directly edit a scripted operator that has been applied as a preset. If you right-click on a preset-based scripted operator in the explorer and choose Edit Scripted Operator, Softimage prompts you to convert the operator to a runtime-designed one. This stores the data directly in the scene and breaks the reference to the preset on disk. You can still use the File menu commands to save the scripted operator as a new preset.

You can always edit the scripted operator from which you originally saved the preset (if you still have the scene). However, this does not automatically update the preset file on disk. Instead, you must save the operator as a preset again.

You cannot resave a scripted operator preset if it is in use by any element in the open scene. If you previously opened a scene with an applied preset operator, you may need to restart Softimage before you can overwrite the preset on disk.