Overview

Usage: workspace

Brings up an interface for carrying out various tasks in a workspace.

Config File Example

Giant Studios Process Tool Configuration

v3.0.0

CONSTANTS {

  const1 const1value

}

STAGE {

  NAME: Project

  DESCRIPTION: Operations that can be performed on projects.

  DIRECTORY {

    PATH: $GIANT_DATA_DIR/capture

    FILES_VAR: files

    FILE_VAR: file

  }

  OPERATION {

    NAME: Identify

    HANDLER: identify $file &

  }

  OPERATION {

    NAME: New Refine

    HANDLER: newrefine $file &

  }

  OPERATION {

    NAME: Process

    HANDLER: process_project $file

  }

  OPERATION {

    NAME: Extract Charmap Projects

    HANDLER: mktmf $file

  }

  OPERATION {

    NAME: Batch charmap

    HANDLER: charmap_take $file

  }

}

STAGE {

  NAME: Extract Charmap Projects

  OPTIONS {

    LIST {

      NAME: Unextracted Processed Projects

      ITEMS_SCRIPT: [listprjs -unextracted -processed]

      MULTI_SELECT: false

      VARIABLE: $file

    }

  }

  OPERATION {

    NAME: Process

    HANDLER: mktmf $file

  }

}

CONSTANTS Example


There can only be one Constants section which can not be within other sections.

 

CONSTANTS {

  output_to_log_file 1

  log_file_path $GIANT_DATA_DIR/default/workspace.log
}

 

This section defines name value pairs. These will be accessible from scripts.

 

TCL_SCRIPT Example

There can only be one TCL_SCRIPT section which can not be within other sections.

 

TCL_SCRIPT {

  proc print_val { val } {

    puts $val
 }
}

 

The contents of this section will be executed as a Tcl script upon loading the workspace.dat file. User Tcl scripts defined in controls will have access to Tcl procedures defined in this section.

 

DIRECTORY Control Examples


Directory sections can only appear in STAGE sections.

DIRECTORY {

  FILE_DESCRIPTION: Animation

  PATH: $GIANT_DATA_DIR/anim

  FILTER: *.anm

  FILES_VAR: dir1_files

  FILE_VAR: dir1_file

}

 

DIRECTORY {

  FILE_DESCRIPTION: Animation

  PATH {

    DEFAULT: $GIANT_DATA_DIR/anim

    VARIABLE: dir1_path

  }

  FILTER {

    DEFAULT: *.anm

    VARIABLE: dir1_filter

  }

  FILES_VAR: dir1_files

  FILE_VAR: dir1_file

}

 

DIRECTORY {

  PATH: $GIANT_DATA_DIR/anim

  SCRIPT: [tcl commands returning a list of files with paths relative to PATH]

  FILTER: *.anm

  FILES_VAR: dir1_files

  FILE_VAR: dir1_file

}

 

TAGS

FILE_DESCRIPTION

Optional

Default Value: none

Used to give more meaningful error messages in the workspace tool.

 

PATH

Required.

Used to specify what directory to use when searching for files.  If SCRIPT is not specified, all files in the directory will be used.

 

SUB_DIRECTORIES

Optional.

Default Value: false

If true, will display the directory and its sub directories in a tree.

 

SCRIPT

Optional.

Default Value: none

The script is used to filter the current files that are currently appearing in the directory control by some other criteria besides the FILTER. For example if only the files that contain a certain keyword in it's contents should be displayed in the directory control then the SCRIPT section can be used to only return those files. Note that the files returned from the SCRIPT should be relative to the PATH. The SCRIPT is only executed once when the directory control is refreshed, not once per sub directory. An example workspace.dat file that uses SCRIPT is at the end of this document.

 

FILTER

Optional.

Default Value: *

Used to limit the list of files that are displayed in the list.

 

FILTER_VAR

 

Optional.

 

Allows scripts to access the current value of FILTER.

 

FILES_VAR

Optional.

Default Value: files if its the first DIRECTORY, files2 if it is the second DIRECTORY, etc.  Contains the currently selected files.

FILE_VAR

Optional.

Default Value: files if it is the first DIRECTORY, file2 if it is the second DIRECTORY, etc.  Contains the currently selected file.  If there are multiple selected files, this variable has a value of <empty string>.

 

SUB_DIRS_VAR

Optional.

Default Value: None

Contains the currently selected sub-directories.

SUB_DIR_VAR

Optional.

Default Value: None

Contains the currently selected sub-directory.  If there are multiple selected sub-directories, this variable has a value of <empty string>.

OPTIONS Examples

 

When Options are embedded within a STAGE section, they are displayed in the main stage form. When Options are embedded within an OPERATION section, the option will appear in a dialog that is displayed when the user presses the operation button.

Note that multiple Option objects can appear within an OPTIONS section.

 

TOGGLE Option

OPTIONS {

  TOGGLE {

  NAME: Y to Z Up

  VARIABLE: y2zup

  }

}

OPTIONS {

  TOGGLE {

    NAME: Y to Z Up

    VARIABLE: y2zup

    TOGGLED_VARIABLE: y2zup_toggled

    TRUE_VALUE: -y2zup

    FALSE_VALUE:

    DEFAULT: true

  }

}

 

TAGS

NAME

Required.

The label that is shown next to the toggle.

VARIABLE

Required.

The variable that is used to set and retrieve the current value of the option.

 

TOGGLED_VARIABLE

Optional.

Default Value: None

The variable that is used to set and retrieve the current toggled state of the option.  Synonymous to VARIABLE if TRUE_VALUE and FALSE_VALUE have their default values.

 

TRUE_VALUE

Optional.

Default Value: true

The VARIABLE will be set to this value when the toggle button is set.

 

FALSE_VALUE

Optional.

Default Value: false

The VARIABLE will be set to this value when the toggle button is unset.

 

DEFAULT

Optional.

Default Value:  false

This is the initial state of the toggle.  If true, the toggle will default to set and have a value of TRUE_VALUE, otherwise the toggle will default to unset and have a value of

FALSE_VALUE.

Variables used in the value of this tag will be replaced with the variable's value. Variables that do not contain boolean values will be treated as false. Note that this is not treated as a script.

 

Example:

DEFAULT: $bool_var1

FILE_SELECT Option

OPTIONS {

  FILE_SELECT {

    NAME: Optional File

    VARIABLE: opfile1

    DEFAULT_VALUE: /files/something.txt

  }

}

 

TAGS

NAME

Required.

The label displayed next to the file selector.

VARIABLE

Required.

The variable used to set and get the value of the option.

 

DEFAULT_VALUE

Optional.

Default Value: none

The initial value of the option.

Variables used in the value of this tag will be replaced with the variable's value.  Note that this is not treated as a script.

 

Example:

  DEFAULT_VALUE: $file_path_var

DEFAULT_VALUE_SCRIPT

Optional.

Default Value: none

The initial value of the option.

The script provided will be executed and its result will be stored in the value of the option.

Example:

  DEFAULT_VALUE_SCRIPT: tagfile -getfile MODEL $anim_file

MUST_EXIST

Optional.

Default Value: True

If false, the user can specify a file name that does not exist.

TEXT_FIELD Option

OPTIONS {

  TEXT_FIELD {

    NAME: Text Field Option

    VARIABLE: textfieldop1

    DEFAULT_VALUE: some string of text

  }

}

 

TAGS

NAME

Required.

The label that will be displayed next to the option.

 

VARIABLE

Required.

The variable used to set and get the value of the option.

 

DEFAULT_VALUE

Optional.

Default Value: none

The initial value of the option.

Variables used in the value of this tag will be replaced with the variable's value. Note that this is not treated as a script.

 

Example:

  DEFAULT_VALUE: $text_var1

DEFAULT_VALUE_SCRIPT

Optional.

Default Value: none

A script that will generate the default value for the text field.

 

Example:

  DEFAULT_VALUE_SCRIPT: `basename $file1`

LIST Option

OPTIONS {

  LIST {

    NAME: Select Color

    ITEMS {

      color1 Yellow

      color2 Light Grey

      color3 Dark Purple

    }

    DEFAULT_VALUE: color2

    VARIABLE: optcolor

  }

  LIST {

    NAME: Number of Sides

    ITEMS {

      3

      4

      5

    }

    DEFAULT_VALUE: 3

    VARIABLE: optsides

  }

  LIST {

    NAME: Additional Attributes

    MULTI_SELECT: true

    ITEMS_SCRIPT: [return { {attr1 {Transparent}} {attr2 {Backface Removal}} {attr3 {Wire Frame}} }]

    DEFAULT_VALUE_SCRIPT: [return {attr1 attr3}]

    VARIABLE: optattr

    SELECT_REQUIRED: false

    REFRESH_INTERVAL: 5.5

  }

  LIST {

    NAME: Additional Attributes

    MULTI_SELECT: true

    ITEMS_SCRIPT {

      LANGUAGE: shell

      CODE {

        echo "attr1 Transparent"

        echo "attr2 Backface Removal"

        echo "attr3 Wire Frame"

      }

    }

    DEFAULT_VALUE_SCRIPT: [return {attr1 attr3}]

    VARIABLE: optattr

    SELECT_REQUIRED: false

  }

}

 

TAGS

NAME

Required.

The label that is placed over the list option.

MULTI_SELECT

Optional.

Default Value: false

If false, only one item can be selected in the list at a time.

 

ITEMS

Optional.

Default Value: false

Specifies a list of <id> <text> pairs where the <id> is an identifier of the item and <text> is the text that will appear in the list for the item.  If <text> is not specified, <id> will be used as tie text for the item.

 

ITEMS_SCRIPT

Optional.

Default Value: none

Specifies a script to be used to generate the items of the list.

 

DEFAULT_VALUE

Optional.

Default Value: none

The ids of the items to be the iniital value of the option.  These items will be automatically selected in the list.  If MULTI_SELECT is true, only one id may be specified.

 

DEFAULT_VALUE_SCRIPT

Optional.

Default Value: none

Specifies a script to be used to generate the default value of the list.

 

SELECT_REQUIRED

Optional.

Default Value: true

If true, the user will be given an error message if there is no selection in the list before the operation is performed.

 

REFRESH_INTERVAL

Optional.

Default Value: none

The ITEMS_SCRIPT will be reapplied every <value> seconds.

 

VARIABLE

Required.

Default Value: none

The variable that contains the current value of the option.  The current value will be the ids of the currently selected items.

OPERATION Examples

OPERATION {

  NAME Print Selection

  HANDLER: [puts $dir1_files]

}

 

OPERATION {

  NAME: Remove Files

  HANDLER: rm $force_remove $dir1_files

  CONFIRM: TRUE

  OPTIONS {

    TOGGLE {

      NAME: Force

      VARIABLE: force_remove

      TRUE_VALUE: -f

      FALSE_VALUE:

      DEFAULT_VALUE: false

    }

  }

}

 

TAGS

NAME

Required.

The label placed in the operation button.

HANDLER

Required.

The command to execute when the operation button is pressed.  If the handler is enclosed in brackets the command will be executed as Tcl, otherwise a system call will be made with the command.  Using a directory FILE_VAR variable in the handler will result in the directory having one item selected before the option button becomes enabled.  Using a directory FILES_VARS variable in the handler will require that at least one item be selected before the option button becomes enabled.

 

CONFIRM

Optional.

Default Value: false

If true, the user will be prompted to confirm the operation before it is performed.

 

OPTIONS

Optional.

Default Value: none

If specified, upon pressing the operation button a sub-dialog will be displayed allowing the user to set options for the operation.  See the OPTIONS section examples.

Scripting

Tcl and Shell scripting is supported within the configuration file.  The tag used for scripts varies based on the control or option.  For example, The List Option has two scriptable tags:  ITEMS_SCRIPT and DEFAULT_VALUE_SCRIPT.  The format of a script can take several forms.

 

The "colon-style tag" form of scripting is as follows:

 

SCRIPT: [puts "hello"]

A tcl script is delimited with [].

SCRIPT: cat $HOME/myfile.txt

A shell script has no delimiters.

Multi-line scripts can be written by ending each previous line with a \ character.

 

SCRIPT: [\

  puts "hello"\

  puts "second line"\

]

A multi-line Tcl script.

SCRIPT: \

  cat $HOME/myfile.txt\

  echo "second line"

A multi-line shell script.

The "scoped-style tag" form of scripting is more verbose, but offers more flexibility when writing longer scripts:

 

SCRIPT {

  LANGUAGE: tcl

  CODE {

    puts "hello"

    puts "second line"

  }

}

Note that in this form, no [] delimiters are needed for tcl code since the script language is specified explicitly.

 

SCRIPT {

  LANGUAGE: shell

  CODE {

    cat $HOME/myfile.txt

    echo "second line"

  }

}

Note that the TCL_SCRIPT section is a special case, and does not hold to these formats.

DIRECTORY SCRIPT Example:

This example workspace.dat displays the prj files in a directory control but filters them by using SCRIPT to only display the unprocessed projects. Unprocessed projects in this case means project files that have no MOTION: <value> entry in them. Determining whether this is the case is done by using the tagfile command line utility. Finally, an operation is added to process the selected project file, with options that matches the process_project utility options.

Giant Studios Process Tool Configuration

v2.0.0

STAGE {

  NAME: Unprocessed Projects

  DIRECTORY {

    SUB_DIRECTORIES: true

    PATH {

      DEFAULT: $GIANT_DATA_DIR/capture

      VARIABLE: path

    }

    FILTER {

      DEFAULT: *.prj

      VARIABLE: filter

    }

    SCRIPT {

      LANGUAGE: shell

      CODE {

        prj_files=`find $path -name "$filter" -print`

        for prj_file in $prj_files; do

          tf_result=`tagfile -getfile MOTION $prj_file` 2>/dev/null

          if [ $? -ne 0 ]; then

            echo "Error determining processed status of: $prj_file" >&2

          elif [ "$tf_result" = "" ]; then

            relative_path=${prj_file#$path/}

            echo $relative_path

          fi

        done

      }

    }

    FILE_VAR: file

  }

  OPERATION {

    NAME: Process

    HANDLER {

      LANGUAGE: shell

      CODE {

        start_opt=””

        end_opt=””

        if [ "$start" != "" ]; then

          start_opt="-start $start"

        fi

        if [ "$end" != "" ]; then

          end_opt="-end $end"

        fi

        process_project $no_track $no_subj_ids $start_opt $end_opt $file

      }

    }

    OPTIONS {

      TOGGLE {

        NAME: No Track

        VARIABLE: no_track

        DEFAULT: false

        TRUE_VALUE: -notrack

        FALSE_VALUE:

      }

      TOGGLE {

        NAME: No Subject IDs

        VARIABLE: no_subj_ids

        DEFAULT: false

        TRUE_VALUE: -nosubjectids

        FALSE_VALUE:

      }

      TEXT_FIELD {

        NAME: Start

        DEFAULT:

        VARIABLE: start

      }

      TEXT_FIELD {

        NAME: End

        DEFAULT:

        VARIABLE: end

      }

    }

  }

}

Copyright 2014-2017 Lightstorm Entertainment Inc.

Copyright 2007-2014 Giant Studios

All Rights Reserved.