Viz Artist User Guide

Version 3.14 | Published October 30, 2020 ©

Script Editor

This section contains details how to open, create, search and show scripts in the Script Editor.

images/download/attachments/50614504/script_em.jpg
Viz Artist can be scripted on two levels, using Scene Scripts or Container Scripts. The events available for Scene and Container scripts differ, and can be accessed by clicking the images/download/attachments/50614504/gs_script_event_ico.png drop-down button in the script editor.

Before adding scripts and code, the designer needs to think about where the logic should reside. If there are functions acting like an interface to the scene, it is a good idea to add this logic as a scene script. Also, if functions or variables are used throughout several other scripts within the scene, the scene script is the proper location for those. On the other hand, if the script code is container specific or planned for a container prototype-instance(s) approach, the script code should be hosted in a container script.

This section contains the following topics:

Script Editor Properties

The Scene Script Editor and the Container Script Editor have the same properties and functionality, but a script created in one can not be placed in the others folder. This section gives details on Script Editor properties and context menu.

images/download/attachments/50614504/script_em.jpg

  • images/download/attachments/50614504/gs_script_ok_ico.png : Shows that all parts of the script entered are correct. If there is an error, it shows where the error is.

  • images/download/attachments/50614504/gs_script_compile_ico.png : Checks the code entered and translates it into byte code, so the script can be run. If there is an error, a message is shown in the text above.

  • images/download/attachments/50614504/gs_script_cancel_ico.png : Ignores the last source code changes and compiles previous version.

  • images/download/attachments/50614504/gs_script_ln_ico.png : Goes to the line number entered in the field.

  • images/download/attachments/50614504/script_find.jpg : Enters free text search. The up icon ( images/download/attachments/50614504/gs_su_ico.png ) searches above the cursor location. The down icon ( images/download/attachments/50614504/gs_script_down_ico.png ) searches below the cursor location.

  • images/download/attachments/50614504/script_sd.jpg : Searches down.

  • images/download/attachments/50614504/script_sup.jpg : Searches up.

  • images/download/attachments/50614504/script_ss.jpg : Searches in all scripts used in this scene.
    images/download/attachments/50614504/gs_script_func_ico.png : Shows a list of used functions in the script (both built-in and self defined ones). Select a function in the list and go there in the script editor.

    images/download/attachments/50614504/gs_script_funct_ico.png
  • images/download/attachments/50614504/gs_script_event_ico.png : Shows a list of built-in events. Select one to add it to the script:

    images/download/attachments/50614504/script_sf.jpg
  • images/download/attachments/50614504/gs_script_di_ico.png : Opens the script documentation.

  • images/download/attachments/50614504/gs_script_dp_ico.png : Opens or closes a script editor floating window.

    Tip: The floating window can be scaled to any size.

Script Editor Context Menu

Right-click in the Script Editor to open the Script Editor context menu:

images/download/attachments/50614504/script_secm.jpg

  • Find Search String: Searches for text entered in the Find input box.

  • Find Selected (F4): Searches for highlighted text.

  • Find Selected in Scene (F7) : Searches for highlighted text in all scripts in the scene.

  • Increase Indent (Tab): Increases the indent of the selected text.

  • Decrease Indent (SHIFT+TAB): Decreases the indent of the selected text.

  • Comment: Comments the selected text.

  • Uncomment: Uncomments the selected text.

  • Font Size: Sets the font size.

  • Bold: Sets the font to bold.

Script Editor Search

This function allows you to search for highlighted elements in the actual container script, but it can also search in scripts on all containers in your scene.

images/download/attachments/50614504/script_sef.jpg

Tip: You can also search in scripts from the Scene Tree Menu.

Script Editor Procedures

This section details common script Editor procedures.

To Create a Container Script Plug-in

images/download/thumbnails/50614504/ico_script.png

  1. Add the Script plug-in to the target Container.

    Note: This plug-in is located in: Built Ins -> Container plug-ins -> Global

  2. Click on the Script plug-in icon.

  3. In the Script Editor type in the new script (see also Script Editor).

    Note: Also, copy and paste a script from another source, if required.

  4. Click images/download/attachments/50614504/gs_script_compile_ico.png .

    images/download/attachments/50614504/gs_script_sec.png
  5. Drag the images/download/attachments/50614504/gs_script_ok.png icon to Container plug-ins > Scriptplugins folder.

    Note: The created plug-in is saved in <viz data folder>/Scriptplugins as <plug-in_name>.vsl.

To Show Container Script Plug-ins in the Script Editor

  1. Add the Script plug-in to the target Container.

    Note: This plug-in is located in: Built Ins -> Container plug-ins -> Global

  2. Drag and drop a created Script plug-in (1 (see Script Plug-ins)) icon to the Script Editor (2).

    Note: These plug-ins are located in: Built Ins -> Container plug-ins -> Scriptplugins

  3. Click Replace or Add to End (3).

    Example: Replaced text (4).

    images/download/attachments/50614504/gs_script_spea.png

To Create a Scene Script Plug-in

  1. Click Scene Settings > Script.

  2. In the Script Editor type in the new script (see also Script Editor).

    Note: Also, copy and paste a script from another source, if required.

  3. Click images/download/attachments/50614504/gs_script_compile_ico.png .

  4. Drag the images/download/attachments/50614504/gs_script_ok.png icon to Scene plug-ins > Scriptplugins folder.

    Note: The created plug-in is saved in <viz data folder>/Scriptplugins as <plug-in_name>.vsl.

To Show Scene Script Plug-ins in the Script Editor

  1. Click Scene Settings > Script.

  2. Drag and drop a created Scene Script plug-in (see Script Plug-ins) icon to the Script Editor.

    Note: These plug-ins are located in: Built Ins -> Scene plug-ins -> Scriptplugins

  3. Click Replace or Add to End.

Note: You can also do an advanced search from the Scene Tree Menu to search for terms across all scripts used in the scene.