Viz Artist

Version 3.9.0 | Published December 13, 2017 ©

Script Editor

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

images/download/attachments/27789960/ScriptEditorMain.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/27789960/gettingstarted-scripting_events_icon1.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/27789960/ScriptEditorMain.jpg

  • images/download/attachments/27789960/gettingstarted-scripting_ok_icon.png Shows that all parts of the script entered are correct. If there is an error, it will show where the error is.

  • images/download/attachments/27789960/gettingstarted-scripting_compile_icon.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/27789960/gettingstarted-scripting_cancel_icon.png Ignores the last source code changes and compiles previous version.

  • images/download/attachments/27789960/gettingstarted-scripting_ln_icon.png Go to the line number entered in the field.

  • images/download/attachments/27789960/ScriptFind.jpg Enter free text search. The up icon ( images/download/attachments/27789960/gettingstarted-scripting_up_icon.png ) searches above the cursor location. The down icon ( images/download/attachments/27789960/gettingstarted-scripting_down_icon.png ) searches below the cursor location.

  • images/download/attachments/27789960/ScriptSearchDown.jpg Search down.

  • images/download/attachments/27789960/ScriptSearchUp.jpg Search up.

  • images/download/attachments/27789960/ScriptSearchScene.jpg Search in all scripts used in this scene.
    images/download/attachments/27789960/gettingstarted-scripting_functions_icon1.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/27789960/gettingstarted-scripting_functions_icon.png
  • images/download/attachments/27789960/gettingstarted-scripting_events_icon1.png Shows a list of built-in events. Select one to add it to the script:

    images/download/attachments/27789960/ScriptFunctions.jpg
  • images/download/attachments/27789960/gettingstarted-scripting_doc_info_icon.png Open the script documentation.

  • images/download/attachments/27789960/gettingstarted-scripting_dock_panel_icon.png Click the arrow buttons to open or close 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/27789960/ScriptEditorContextMenu.jpg

  • Find Search String: Search 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/27789960/ScriptEditorFind.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/attachments/27789960/viz_icons_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 Properties).

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

  4. Click images/download/attachments/27789960/gettingstarted-scripting_compile_icon.png .

    images/download/attachments/27789960/gettingstarted-scripting_script_editor_container.png
  5. Drag the images/download/attachments/27789960/gettingstarted-scripting_script_ok.png icon to Container plug-ins -> Scriptplug-ins folder.

    Note: The created plug-in is saved in <viz data folder>/Scriptplug-ins 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 -> Scriptplug-ins

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

    Example: Replaced text (4).

    images/download/attachments/27789960/gettingstarted-scripting_script_plugin_editor_anno.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 Properties).

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

  3. Click images/download/attachments/27789960/gettingstarted-scripting_compile_icon.png .

  4. Drag the images/download/attachments/27789960/gettingstarted-scripting_script_ok.png icon to Scene plug-ins -> Scriptplug-ins folder.

    Note: The created plug-in is saved in <viz data folder>/Scriptplug-ins 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 -> Scriptplug-ins

  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.