image-20240916-141805.pngimage-20240916-141809.png

Scene and Container scripts can be created, saved and used again in other Scenes or on other Containers. To do this scripts can be saved as a plug-in.

Script-based plug-ins that you create are saved as .vsl files at <viz data folder>\ScriptPlugins. Usually this will be %ProgramData%\vizrt\VizEngine\ScriptPlugins on Windows machines.

Scripts plug-ins can be used in the same way as Scene or Container plug-ins.

To Name Your Script

To identify your plug-in for commands or for example as an actor in the stage, you can give your plug-in a unique name.

For container scripts this can be done by entering the name at the top of the script user interface.

For scene scripts the same setting can be found under 'Scene' → 'Scene Script' from the settings selection bar.

To Create a Script-based Plug-in

  1. Create a script.

  2. Click Compile and Run.

  3. If the script compiles successfully the Add as Plugin button gets enabled.

  4. Click the Add as Plugin button.

  5. Enter a name for the Script plug-in.

  6. Click OK.

As an alternative, you can drag the script and drop it onto the Plugins Panel. The script is stored automatically in the <viz data folder>\ScriptPlugins folder.

This also adds some description code at the beginning of the .vsl file.

sub OnInitPlugin()
    RegisterPlugin("Script") 'Name of plugin
RegisterPluginDisplayName("Script") 'Name used for icon label and tooltip
   RegisterPluginFolder("ScriptPlugins") 'Name of plugin folder
    RegisterPluginType(PLUGIN_TYPE_FUNCTION) 'Type of plugin, will be PLUGIN_TYPE_FUNCTION or PLUGIN_TYPE_SCENE for container or scene script
end sub

Tip: Script plug-ins are ordinary text files.

If you want to change the folder they appear in, edit the .vsl file and change the foldername in RegisterPluginFolder("ScriptPlugins").
If you want to change the icon label and tooltip, edit the .vsl file and change the name in RegisterPluginDisplayName("Script").

To Retrieve the Original Code

To get the original code of a Script-based plug-in, double click it in the Plugins view. The script editor opens in read-only mode. You can not edit and save the plug-in again.

To Edit a Script-based Plug-in

Once your script has been saved as a plug-in, it can not be modified afterwards. However, you can create a new script and drag and drop the plug-in into the script editor.

The stored plug-in code is loaded into the script editor. If you save it, you need to give it a new name.

See Also