sales@scenomics.com +1 650 396 9674

Create New Application

NOTE: This exercise assumes you have completed the previous exercise.

In this exercise, you'll learn how to create a custom Scenome application named Octopus.

Start The Shell Application

  1. Start the Shell app. (Start » Programs » Scenomics » Shell) or (Windows® key and then type 'Shell' to find the app icon.)

    The application displays a splash screen and then the application desktop appears. The main menu is composed of three items that contain commands relevant to the current context (which is an empty document). The interface changes when you create a new file or load a file from disk.

    This is a picture of the desktop.

Get The Script Dictionary Path

  1. Examine the main menu and select File » Get Application Script Path from the listed options.

    The application displays a dialog that allows you to search for application scripts.

    This is a picture of the app script search box.
  2. Type app_service_dictionary_util.ssl in the text entry.

    Copy Text To Clipboard

    app_service_dictionary_util.ssl

    The script entry appears in the dialog.

  3. Left click the entry named app_service_dictionary_util.ssl and click OK or hit ENTER when you are finished.

    The application copies the path to this script to the Windows® clipboard.

Open The Dictionary Script

  1. Start a text editor of your choice and select the option to open a file from disk.

    We don't recommend using Window® Notepad for text editing. Although it will work, it doesn't support very many levels of undo. For this reason, we recommend Notepad++ at minimum. Sublime Text®, Visual Studio®, or Visual Studio Code® are far superior. You can mark Scenome Scripting Language .SSL files as C++ for great syntax highlighting too.

  2. Select CTRL + V to paste the dictionary file path (into the place in the dialog where you specify the file to open) and open the file.
  3. Open the file.

    The script appears in the text editor. We're only showing part of the script below.

    ///////////////////////////////////////////////////////////////////////////////
    //
    // $author           Scenomics LLC
    // $description      Implements functions that generate data dictionaries.
    //
    // Copyright 2004-2021 Scenomics LLC. All Rights Reserved.
    //
    ///////////////////////////////////////////////////////////////////////////////
    
    library LibDict;
    
    import library "app_service_assert_util.ssl";
    import library "app_service_main_util.ssl";
    //import library "type_str_list_util.ssl";
    import library "type_service_enumeration_util.ssl";
    
    ////////////////////////////////////////////////////////////////////////////
    // function
    ////////////////////////////////////////////////////////////////////////////
    
    function int GetNodeLinkDataCaptureTypes( TypeInfoArray p_aoValues )
    {
       p_aoValues.Add( NodeDataCaptureFilter );
    
       return p_aoValues.GetCount();
    }
    
    ////////////////////////////////////////////////////////////////////////////
    // function
    ////////////////////////////////////////////////////////////////////////////
    
    function int GetVariableNodeDataCaptureTypes( TypeInfoArray p_aoValues )
    {
       p_aoValues.Add( VariableNodeDataCaptureNode );
    
       return p_aoValues.GetCount();
    }
    
    ...
    

Modify 'GetDataClasses' Function

  1. Use the text editor search feature to find the function GetDatabaseClasses.

    Copy Text To Clipboard

    GetDatabaseClasses

    Note that this is one of three functions that are used to map shell classes such as v0_shader or v1_shader to specific application folders and .scenomeapp files. These shell-to-class mappings are used by Scenome.exe to load the correct UI shell when files are opened.

  2. Replace the entire GetDatabaseClasses function with the following.

    There are two new lines at the end of the function body that add entries for v0_octopus and v1_octopus.

    Copy Text To Clipboard

    ////////////////////////////////////////////////////////////////////////////
    // function
    ////////////////////////////////////////////////////////////////////////////
    
    function int GetDatabaseClasses( StrList p_slValues )
    {
       // Alphabetical order. Must match count of GetApplicationFolders().
       p_slValues.Add( "v0_avalanche" );
       p_slValues.Add( "v1_avalanche" );
       p_slValues.Add( "v0_compute" );
       p_slValues.Add( "v1_compute" );
       p_slValues.Add( "v0_graph" );
       p_slValues.Add( "v0_help" );
       p_slValues.Add( "v1_help" );
       p_slValues.Add( "v0_image" );
       p_slValues.Add( "v1_image" );
       p_slValues.Add( "v0_installer" );
       p_slValues.Add( "v1_installer" );
       p_slValues.Add( "v0_material" );
       p_slValues.Add( "v1_material" );
       p_slValues.Add( "v0_outline" );
       p_slValues.Add( "v1_outline" );
       p_slValues.Add( "v0_render" );
       p_slValues.Add( "v1_render" );
       p_slValues.Add( "v0_scene" );
       p_slValues.Add( "v1_scene" );
       p_slValues.Add( "v0_shader" );
       p_slValues.Add( "v1_shader" );
       p_slValues.Add( "v0_shell" );
       p_slValues.Add( "v1_shell" );
       p_slValues.Add( "v0_terrain" );
       p_slValues.Add( "v1_terrain" );
       p_slValues.Add( "v0_octopus" );
       p_slValues.Add( "v1_octopus" );
    
       return p_slValues.GetCount();
    }
    
  3. Use the text editor to save the changes.

Modify 'GetApplicationFolders' Function

  1. Use the text editor search feature to find the function GetApplicationFolders.

    Copy Text To Clipboard

    GetApplicationFolders

    Note that this is one of three functions that are used to map shell classes such as v0_shader or v1_shader to specific application folders and .scenomeapp files.

  2. Replace the entire GetApplicationFolders function with the following.

    There are two new lines at the end of the function body that add entries for the Octopus app folder we'll create.

    Copy Text To Clipboard

    ////////////////////////////////////////////////////////////////////////////
    // function
    ////////////////////////////////////////////////////////////////////////////
    
    function int GetApplicationFolders( StrList p_slValues )
    {
       // Alphabetical order. Must match count of GetDatabaseClasses().
       p_slValues.Add( "Avalanche" );
       p_slValues.Add( "Avalanche" );
       p_slValues.Add( "Compute" );
       p_slValues.Add( "Compute" );
       p_slValues.Add( "Graph" );
       p_slValues.Add( "Help");
       p_slValues.Add( "Help");
       p_slValues.Add( "Image" );
       p_slValues.Add( "Image" );
       p_slValues.Add( "Installer" );
       p_slValues.Add( "Installer" );
       p_slValues.Add( "Material" );
       p_slValues.Add( "Material" );
       p_slValues.Add( "Outline" );
       p_slValues.Add( "Outline" );
       p_slValues.Add( "Render" );
       p_slValues.Add( "Render" );
       p_slValues.Add( "Scene" );
       p_slValues.Add( "Scene" );
       p_slValues.Add( "Shader" );
       p_slValues.Add( "Shader" );
       p_slValues.Add( "Shell" );
       p_slValues.Add( "Shell" );
       p_slValues.Add( "Terrain" );
       p_slValues.Add( "Terrain" );
       p_slValues.Add( "Octopus" );
       p_slValues.Add( "Octopus" );
    
       return p_slValues.GetCount();
    }
    
  3. Use the text editor to save the changes.

Modify 'GetApplicationNames' Function

  1. Use the text editor search feature to find the function GetApplicationNames.

    Copy Text To Clipboard

    GetApplicationNames

    Note that this is one of three functions that are used to map shell classes such as v0_shader or v1_shader to specific application folders and .scenomeapp files.

  2. Replace the entire GetApplicationNames function with the following.

    There are two new lines at the end of the function body that add entries for the .scenomeapp app shell containers we'll create.

    Copy Text To Clipboard

    ////////////////////////////////////////////////////////////////////////////
    // function
    ////////////////////////////////////////////////////////////////////////////
    
    function int GetApplicationNames( StrList p_slValues )
    {
       // Alphabetical order. Must match count of GetDatabaseClasses().
       p_slValues.Add( "Avalanche.scenomeapp" );
       p_slValues.Add( "Avalanche_v1.scenomeapp" );
       p_slValues.Add( "Compute.scenomeapp" );
       p_slValues.Add( "Compute_v1.scenomeapp" );
       p_slValues.Add( "Graph.scenomeapp" );
       p_slValues.Add( "Help.scenomeapp" );
       p_slValues.Add( "Help_v1.scenomeapp" );
       p_slValues.Add( "Image.scenomeapp" );
       p_slValues.Add( "Image_v1.scenomeapp" );
       p_slValues.Add( "Installer.scenomeapp" );
       p_slValues.Add( "Installer_v1.scenomeapp" );
       p_slValues.Add( "Material.scenomeapp" );
       p_slValues.Add( "Material_v1.scenomeapp" );
       p_slValues.Add( "Outline.scenomeapp" );
       p_slValues.Add( "Outline_v1.scenomeapp" );
       p_slValues.Add( "Render.scenomeapp" );
       p_slValues.Add( "Render_v1.scenomeapp" );
       p_slValues.Add( "Scene.scenomeapp" );
       p_slValues.Add( "Scene_v1.scenomeapp" );
       p_slValues.Add( "Shader.scenomeapp" );
       p_slValues.Add( "Shader_v1.scenomeapp" );
       p_slValues.Add( "Shell.scenomeapp" );
       p_slValues.Add( "Shell_v1.scenomeapp" );
       p_slValues.Add( "Terrain.scenomeapp" );
       p_slValues.Add( "Terrain_v1.scenomeapp" );
       p_slValues.Add( "Octopus.scenomeapp" );
       p_slValues.Add( "Octopus_v1.scenomeapp" );
    
       return p_slValues.GetCount();
    }
    

    We've now successfully registered the new application shell classes, folders, and shell containers. While we could store application registration in configuration files on disk, we don't create applications very often. For that reason, it's easier to use code rather than configuration files.

  3. Use the text editor to save the changes.
  4. Leave the file open in the text editor.

Compile Scripts

  1. Return to the running Shell application.
  2. Select Desktop » Refresh Scripts from the main menu. ( ALT + D + R )

    The application displays script compiler messages in the output window:

    Start loading scripts
    Done loading scripts; 153 loaded in 13.29 ms; avg 0.09
    

    If there are any script compiler errors, go back to the previous exercise and follow the instructions again. Here is an example of what error messages might look like:

    Start loading scripts
    D:\release6\scripts\app_shell_util.ssl(1770) : syntax error: missing ')' before 'e'
    Done loading scripts; 153 loaded in 1.02 ms; avg 0.01
    

Create New Application

  1. Select File » New » Application from the main menu.

    The software displays a wizard that allows you to specify the parameters of your new application. You specify a small amount of initial information and the Shell app does the rest of the work involved in scaffolding your application.

    This is a picture of the new project dialog.
  2. Use your company name if applicable, or type something like Octopus Software, Inc. in the field named Company.
  3. Type your name (or something like Jane Snow or John Snow or Octopus) in the field named Author.
  4. Type Octopus in the field named Name.

    The name must be Octopus, including the capital O. Remember, above, we registered the term Octopus for the app name, the app containing folder, and the app shell containers.

  5. Hit ENTER or click OK when you are finished.

    The application creates a new shell document and the main menu options change. You can see the hierarchy on the left, the empty worksheet in the middle, and the property sheet on the right.

    This is a picture of the workspace.

    There are messages in the output window. Your paths will use a different directory, but the filenames will be the same and you will see the same number of files.

    --- <Executing Command 'AppApplicationCreateDocument'>
    
    Creating app shell documents:
    D:\Release6\Content\Applications\Octopus\Octopus Settings.box
    D:\Release6\Content\Applications\Octopus\octopus settings.box.dep
    D:\Release6\Content\Applications\Octopus\octopus settings.box.ref
    D:\Release6\Content\Applications\Octopus\Octopus.box
    D:\Release6\Content\Applications\Octopus\octopus.box.dep
    D:\Release6\Content\Applications\Octopus\octopus.box.ref
    D:\Release6\Content\Applications\Octopus\Octopus.scenomeapp
    D:\Release6\Content\Applications\Octopus\octopus.scenomeapp.ref
    D:\Release6\Content\Applications\Octopus\octopus_default.box
    D:\Release6\Content\Applications\Octopus\octopus_default.box.dep
    D:\Release6\Content\Applications\Octopus\octopus_default.box.ref
    D:\Release6\Content\Applications\Octopus\octopus_icon.ico
    D:\Release6\Content\Applications\Octopus\octopus_icon.ico.ref
    D:\Release6\Content\Applications\Octopus\octopus_splash_screen.bmp
    D:\Release6\Content\Applications\Octopus\octopus_splash_screen.bmp.ref
    D:\Release6\Content\Applications\Octopus\Octopus_v1.scenomeapp
    D:\Release6\Content\Applications\Octopus\octopus_v1.scenomeapp.ref
    D:\Release6\Content\Applications\Octopus\v0_scripts.xml
    D:\Release6\Content\Applications\Octopus\v0_scripts.xml.ref
    D:\Release6\Content\Applications\Octopus\v0_octopus.xml
    D:\Release6\Content\Applications\Octopus\v0_octopus.xml.ref
    D:\Release6\Content\Applications\Octopus\v1_scripts.xml
    D:\Release6\Content\Applications\Octopus\v1_scripts.xml.ref
    D:\Release6\Content\Applications\Octopus\v1_octopus.xml
    D:\Release6\Content\Applications\Octopus\v1_octopus.xml.ref
    
    Creating app script documents:
    D:\release6\scripts\app_octopus_create_document_scripts.ssl
    D:\release6\scripts\app_octopus_create_document_util.ssl
    D:\release6\scripts\app_octopus_scripts.ssl
    D:\release6\scripts\app_octopus_util.ssl
    
    New shell successfully created!

    We'll implement initial features in the four app script documents shown above, but first let's take a look at the document itself.

Examine The Document

  1. Expand nodes in the hierarchy until you can see the following: This is a picture of the hierarchy.

    Examine the hierarchy and find the <IncludeConfigNode> named Includes. This contains content included from other documents. In this case, you can see three <FileNode> objects representing external data sources related to commands, nodes, and modes. Each <FileNode> contains a <NodeLink> node connected to resources used by this document.

    The <ApplicationConfigNode> named Interface contains two <AppScaffoldNode> objects named Octopus that define the UI shells used by the application. Each shell is indicated by v0 and v1. In this case the application has two primary states: there is a simple UI for when the application starts, but a document is not open (v0), and a more complex UI with more options for when a document is open (v1).

    For now we won't go into the shell layouts in too much detail. Generally you won't have to make many changes to this document until you need to add menu options or change command menus.

  2. Select File » Save from the main menu.

Modify Icon and Splash Screen Resources

  1. Examine the hierarchy and right click over the first <AppScaffoldNode> named Octopus. This is a picture of the hierarchy.
  2. Select Open Folder... from the listed options.

    The software opens the folder that contains the application shell resources.

    This is a picture of the folder that contains the Octopus app.
  3. Right click on the following link and select Save Link As (or use a similar command) to save the new application splash screen to your downloads folder:

    Right click here to download the new application splash screen.

  4. Use CTRL + C and CTRL + V to copy the new application splash screen from your download folder to the application resources folder we just opened.

    Say Yes when Windows asks you if you wish to overwrite the existing file.

  5. Right click on the following link and select Save Link As (or use a similar command) to save the new application icon to your downloads folder:

    Right click here to download the new application icon.

  6. Use CTRL + C and CTRL + V to copy the new application icon from your download folder to the application resources folder we just opened.

    Say Yes when Windows asks you if you wish to overwrite the existing file.

Build The Application

  1. Examine the main menu and select Graph » Build All from the listed options.

    The software builds the application and displays build information in the output window. You'll temporarily see a Windows Command Shell appear when the External-AppPackage.exe runs.

    --- <Building Project 'D:\Release6\Content\Applications\Octopus\Octopus.box'> ---
    
    Wrote the interface definition to disk at the following location: D:\release6\content\applications\octopus\v0_octopus.xml
    Wrote the interface definition to disk at the following location: D:\release6\content\applications\octopus\v1_octopus.xml
    
    Saved the interface definition and wrote build script entry for the following application: 'Octopus'
    
    Saved the interface definition and wrote build script entry for the following application: 'Octopus'
    Ran the build script at the following location: D:\Release6\Content\Applications\Octopus\app_build.bat ( via shell execute ).
    Start loading scripts
    Done loading scripts; 0 loaded in 2.75 ms; avg inf
    

Run The Application

  1. Examine the hierarchy right click over the <ApplicationConfigNode> named Interface. This a picture of the hierarchy.
  2. Select Run Application from the listed options.

    The software displays the splash screen and the application starts.

    This a picture of the Octopus app.

    We successfully created a new application shell. It has a custom splash screen and icons, along with a basic main menu and commands.

Test The New Document Command

  1. Select Desktop » Clear Output from the main menu.
  2. Select File » New » New Document from the main menu.

    The command displays a message at the bottom of the output window.

    Executed document create command.
    

    The new application shell is complete. The create command doesn't do anything useful yet, but it does work correctly. In the next exercise, we'll modify the create command to create a new document.

  3. Leave the Shell and Octopus applications running and proceed to the next exercise.