Dev:2.5/Source/Installation/EnvironmentVariables

提供: wiki
移動先: 案内検索

Future versions of Blender will rely internally and externally on some environment variables to configure the location of certain files. The reason is that this way scripts or the user can configure things before launch, and child process can inherit the settings and thus reference the same data. Note: 2.50 still uses <=2.49 system.

Typical EnvVars

The common set of envvars follow the rule of starting with BLENDER_ and having _ as separator for other words.

BLENDER_VERSION (and BLENDER_VERSION_PREV)

The program will set this variable to a three digit number on startup. Eg, 258. Some other envvars will depend on it. The _PREV one will be 0 if the program is unable to figure which version was used before, otherwise it will be also three digits. _PREV does not mean previous version avaliable but previous used version, so will have a higher value than the other when the user launches an older program, or the same value if launching again the same binary.

None can be overriden by setting before launch (they will be ignored and set to the right values).

BLENDER_SHARE

This variable will point to the directory where Blender should be able to find all the system configuration files. In case of being a "unpack and run", it will be set to the main directory created by uncompressing. Normal installs would probably use /usr/share/blender as value.

It can be overriden by setting it before launch.

BLENDER_TEMP

It stores the directory in which temporary files will be created, including quit.blend. It should be a safe location, to avoid other users causing problems. Blender will try to reuse the saved path from previous launches, if it can, so quit.blend should be avaliable.

This one can be set before launch.

BLENDER_USER_* and BLENDER_SYSTEM_*

The core of the system that lets differentiate user path, where things can be saved, from other paths that are used for read only shared data. Currently the possible variables are BASE, DATAFILES, PYTHON and PLUGINS (as in BLENDER_USER_BASE or BLENDER_SYSTEM_PLUGINS). All should refer BLENDER_VERSION to allow running multiple versions in parallel.

BLENDER_SYSTEM_* can store multiple directory names, separated by : (or ; in MSWindows). When looking for a file, the program will split the components and use the first match. This can be useful to point to previous versions that are still compatible or to store information in multiple places.

BASE will store the files named startup.blend (old .B.blend and .B25.blend), enviroment, bookmarks (old .Bfs), file-history (old .Blog).

DATAFILES has the icons, themes and data library files.

PY will contain all the python related directories and files, including the ui/ and io/ directories.

PLUGINS will store the sequencer/ and texture/ directories where plugins will be found.

They can be set before launch, or in the environment files.

environment file

User file is ~/.blender/${BLENDER_VERSION}/environment. System defaults will be read from ${BLENDER_SHARE}/${BLENDER_VERSION}/environment. The user settings have preference over the system ones, and envvar set before launch have preference over both (except in the noted exceptions).

The file allows comments, those lines that start with '#'. Other lines will contain envvar and value pairs, separated by '='. Anything before the symbol will be considered the envvar name, and anything after will be in the value, whitespace included. If an envvar appears more than once, the first occurrence will be the one used, and if not already set before launching.

While reading each line, Blender will replace any string that looks like '${FOO}' (or '%FOO%' in MSWindows) with the value contained in the envvar 'FOO'. If there is no such envvar, the string is left as is.

Example

 # This is a comment line and the next are valid Unix paths.
 # Notice the last envvar has two paths, separated by :
 #  and using a non Blender envvar
 BLENDER_USER_BASE=${HOME}/.blender/${BLENDER_VERSION}
 BLENDER_SYSTEM_BASE=${BLENDER_SHARE}/${BLENDER_VERSION}
 BLENDER_USER_DATAFILES=${HOME}/.blender/${BLENDER_VERSION}/datafiles
 BLENDER_SYSTEM_DATAFILES=${BLENDER_SHARE}/${BLENDER_VERSION}/datafiles
 BLENDER_USER_PY=${HOME}/.blender/${BLENDER_VERSION}/py
 BLENDER_SYSTEM_PY=${BLENDER_SHARE}/${BLENDER_VERSION}/py
 BLENDER_USER_PLUGINS=${HOME}/.blender/${BLENDER_VERSION}/plugins
 BLENDER_SYSTEM_PLUGINS=${BLENDER_SHARE}/${BLENDER_VERSION}/plugins:${MOVIE_PROJECT}/plugins