Initialization

Initialization

Introduction

RenderMan for Maya and the other applications that comprise the plugin use a sequence of startup files to initialize preferences, including the loading of 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 multitude of different setups. Namely, this allows a site to specify different preferences based on group, project, user, machine, et cetera, and to share these preferences among all users of the system. By searching for and sourcing the same filename that appears in different paths one can control which settings are administrator-configurable and which can be changed based on individual user's 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.


The Initialization Files

RenderMan for Maya relies on several different files to ensure proper configuration:

RenderMan_for_Maya.ini

This is the primary initialization file, containing the fundamental settings.

RMS.ini

This initialization file is essential for establishing shared initialization states between the various tools included with RenderMan Studio, but it also sets the "asset strategy" for RfM, defining the directory structure for RenderMan data, shaders, textures, and outputs.

RMSWorkspace.ini

This ini file can be used to define the user workspace and to set specific preferences.

There are, additionally, two optional initialization files that are used to establish asset management policies:

RMSProduction.ini

This ini file is used to define RMSPROD and can also be used to set preferences at the RMSPROD-level. For more information, consult the Asset Management documentation.

RMSSharing.ini

RMSSharing.ini both defines the value of RMSPROJ_SHARING and can be used to express RMS preferences at the RMSPROJ_SHARING level.

RenderMan Studio throws a few more files into the equation:

RAT.ini

The RAT.ini file is used to set certain shared preferences that are not handled by the RfM and RfM Pro ini files, including, most importantly, licensing preferences.

Slim.ini

The Slim.ini controls Slim-specific preferences.

it.ini

The it.ini sets your it-specific preferences.

TOR.ini

The TOR.ini is used for preferences that are shared between tools.

rendermn.ini [sic]

The rendermn.ini file provides the configuration defaults for the renderer.
  • Important

    All of the settings in these files are site-configurable, but we highly recommend that, rather than editing the file in your installation directory ($RMSTREE/etc), you create a duplicate file containing your site-specific overrides and place it in a separate directory, referenced via an $RMS_SCRIPT_PATHS environment variable. Valid commands are documented below; please consult the individual .ini files for examples of the default settings.

    All RenderMan_for_Maya.ini files are loaded, followed by all RMS.ini files, and finally all appname.ini files.


Initialization Commands

These commands are used in the initialization files to determine and define state, to set, get, or lock preferences, and to lock or load extensions. Note that any legal Tcl code can be used within the initialization files.

General Commands:

  • RATGetDir dir - returns the path of a subdirectory: 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 settings 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
  • GetPref name {value {}} - gets value of named pref with option default value
  • LoadExtension type filename - loads the extension defined in filename into the current application
  • LockExtension - locks out any addition calls to LoadExtension
  • SetVar name value - sets a given/user-defined variable to a given/ user-defined value, for example, in the RMSWorkspace.ini file, for site-specific variables.
  • GetVar name - gets the value of a given variable.
  • VarExists name - confirms or denies the existence of a given variable.
  • LogMsg level msg - logs a message at given level: level {COPIOUS, INFO, NOTICE, WARNING, ERROR}

An Example ini File

Samples of the shipping .ini files are included here in the documentation, for your perusal (via the Table of Contents at left). Brief sections of a slim.ini file are illustrated below to provide more specific details pertaining to setting up .ini files.

  • Load the "tcl" extension "SlimExpression.tcl" into SLIM; uses the RATGetDir command to get the location of "SlimExpression.tcl":
LoadExtension tcl [file join [RATGetDir etc] SlimExpression.tcl]
  • Check the system environment variable SLIM_RUNMODE to determine user specific settings of preferences for ShaderCompiler:
if {[GetEnv SLIM_RUNMODE artist] == "developer"}
    SetPref ShaderCompiler "shader -I%I %f"
} else {
    SetPref ShaderCompiler "shader -I%I -nolint %f"
  • Set the pref ExpertMenus to 0 (this setting will be overridden by any subsequent call to SetPref ExpertMenus:
SetPref ExpertMenus 0
  • Set and lock the value of ROカラー to #8080a0. This will be the value of ROカラー upon start of the application:
LockPref ROカラー #8080a0

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.