Initialization


Introduction
Initialization files
Initialization commands
Sample ini File
Alfred.ini
Scheme Files


Introduction

All RAT application use a sequence of startup files to initialize preferences and Tcl based extensions. The primary reason behind having a sequence of multiple startup files is to help establish a set of program specific parameters that are configurable among a magnitude of different setups. Namely this allows a site to specify different preferences based on group, project, user, machine etc., and to share these among all users of the system. By searching for and sourcing the same filename that appears in different paths one can control what settings are administrator configurable and what can be changed based on individual user needs. This idea is further refined by the inclusion of the LockPref and LockExtension commands. Using these guarantees that certain program settings can always be counted on at the beginning of program execution.
top

Initialization Files

There are three primary initialization files used by RAT applications that are searched for within various search paths. These files are:

Applications look for the above files in these directories:

All RAT.ini files are loaded, followed by all TOR.ini, and finally all appname.ini files. More specifically (in programmer-friendly lingo..) the startup sequence looks like:

USERPREFS = ~/.pixarPrefs/RAT[Version]
load $RATTREE/etc/RAT.ini
foreach dir in $RAT_SCRIPT_PATHS {
    load $dir/RAT.ini
}
load $USERPREFS/RAT.ini

if {application == MTOR or Slim} {
    load $RATTREE/etc/TOR.ini
    foreach dir in $RAT_SCRIPT_PATHS {
        load $dir/TOR.ini
    }
    load $USERPREFS/TOR.ini
}

load $RATTREE/etc/appname.ini
foreach dir in $RAT_SCRIPT_PATHS {
    load$dir/appname.ini
}
load $USERPREFS/appname.ini
load $USERPREFS/appname.prefs
top


Initialization Commands


general commands:

RATGetDir dir - returns the path of a rat subdir.  dir{lib, etc, resource, home} 
GetHostName - get host machine name
GetUserName - get current users name
GetAppName - get name of currently running application
GetVersion - get program version
GetPlatform - return platform name
GetEnv var {default {}} - returns setting of system environment variable.  takes an optional 2nd argument specifying default value.

initialization commands:

SetPref name value - Sets application preference name with value
LockPref name value - Sets application pref with value and locks out any additional attempts to change its value
LoadExtension type filename - loads the extension defined in filename into the current application
GetPref name {value {}} - gets value of named pref with option default value
LockExtension - locks out any addition calls to LoadExtension
LogMsg level msg -logs a message at given level - level {COPIOUS, INFO, NOTICE, WARNING, ERROR}

Any legal Tcl code can be used within these initialization file.

top


Sample ini File

Brief sections of the $RATTREE/etc/slim.ini file are illustrated below as examples on setting up .ini files

LoadExtension tcl [file join [RATGetDir etc] SlimExpression.tcl]
   loads the "tcl" extension "SlimExpression.tcl" into SLIM.  uses the RATGetDir command to get the location of "SlimExpression.tcl"

if {[GetEnv SLIM_RUNMODE artist] == "developer"} 
    SetPref ShaderCompiler "shader -I%I %f"
} else {
    SetPref ShaderCompiler "shader -I%I -nolint %f"
}
  checks the system environment variable SLIM_RUNMODE to determine user specific settings of preferences for ShaderCompiler

SetPref ExpertMenus 0
     sets the pref ExpertMenus to 0 (this setting will be overridden by any subsequent call to SetPref ExpertMenus

LockPref ROColor #8080a0
     set and lock the value of ROColor to #8080a0.  This will be the value of ROColor upon start of the application

During the initialization process, the same preference can be set multiple times (possibly using different values). As long as the preference is not set with LockPref, then the value of the preference will be that of the last call to SetPref. If the preference is set with LockPref somewhere within the hierarchy of files, all modifications after that setting will be ignored.

top


Alfred.ini

Settings in alfred.ini should be reviewed by a system administrator, especially with regard to site security. The default values here have been chosen to be generally useful, although most multi-user sites will want to name, and initialize, an alfred maitre-d host.

The notes accompanying each configuration variable are intended to be self-explanatory, but they do assume a familiarity with the basic alfred concepts and vocabulary.

In addition to the alfred.ini file, the alfred.schedule file contains the (crucial!) remote server definitions. See the notes on scheduling and remote servers for detailed information.

See the Alfred Site Administration Notes for information on installing and configuring some of the more esoteric alfred features such as:

For a discussion of overall installation issues, including the license manager, see the RenderMan Toolkit installation notes.


Scheme Files

Similar to .ini files.  Scheme files are used by RAT to define the look of the apps and to define mouse and keyboard events.  Scheme files are sourced in the same manner and use the same search paths as .ini files.

RAT.scheme - all RAT applications load this
$appname.scheme - only $appname loads this

Event commands: define and manipulate virtual events

Event define <event> <value>- Define a new virtual event.
Event lookup <event>- Lookup a previously defined event.
Event set <event> <binding>- Replace all bindings to an event with a new binding.
Event add <event> <binding>- Add a new binding to an event.  This will append the binding to the end of the list of all. bindings previously defined for this event. 

Options commands: define and manipulate window options

Option define <option> <value>- Define a new window option.
Option lookup <option>- Lookup a previously defined window option.
Option add <option> <value>- Add a new value to a window option.