Module description files
Modules provide a way to distribute multiple versions of a plug-in and load a different version depending on operating system, locale, and Maya version.
Each entry in the module description file specifies conditions for loading specific versions of the plug-in and its supporting files, the location of the plug-in and its supporting files, and any required modifications to environment variables.
You can comment out lines in the module description file by adding a #
to the beginning of the line.
While module files should have a .mod
extension, all module files, regardless of extension, are read by Maya.
The first line of every entry of a module description file provides the instructions for loading a specific version of the module for a specific platform and Maya version.
+ MAYAVERSION:<version> PLATFORM:<platform> LOCALE:<locale> <ModuleName> <ModuleVersion> <ModulePath>
Entry | Description | Notes |
---|---|---|
MAYAVERSION |
Optional Specifies a base version of Maya. |
Can be any base version of Maya, for example 2023. If this condition is omitted, the entry applies to all versions of Maya. |
PLATFORM |
Optional Specifies an operating system. |
Can be win64 , mac , or linux . If this condition is omitted, the entry applies to all operating systems. |
LOCALE |
Optional Specifies the system locale. |
Can be en_US , for US English, ja_JP , for Japanese, or zh_CN , for Simplified Chinese. If this condition is omitted, the line applies to any locale. |
ModuleName | Required The name of the module |
|
ModuleVersion | Required The module version. |
|
ModulePath | Required The module location. |
Can be either an absolute path or a path relative to the module file. |
- There must be a space between the leading
+
and the first term of the first line. - The module file will be moved to a location in the module search path when the module is installed. You must take this into consideration when setting the paths to the module directories.
- If there are multiple entries for the same module that are identical except for their version number, Maya will only take into account the entry with the highest version number. Entries with lower version numbers will be ignored.
Each entry specifies the location of the module files associated with the conditions in the first line.
The paths to the files can be specified either as absolute paths or as paths relative to the .mod
file.
The default structure of the module directory can be overwritten if files in a different directory need to be loaded, or if the directories need to be read recursively.
Override the default location of a folder using:
<folder to override>: <new location for this folder>
For example, to specify a new location for Python and MEL scripts, add the line:
scripts: ExtraFiles\2023\scripts
To read the directory recursively, add [r]
in front of the directory:
[r] scripts: ExtraFiles\2023\scripts
Hidden subdirectories will be ignored even when recursive search is on, as will any files or directories with the following extensions:
.so
.mll
.bundle
.py
.dll
.framework
.plugin
.plist
.app
.pkg
.rtfd
.download
.sparsebundle
You can set and modify environment variables as needed when a specific plug-in is loaded.
To set a variable, use the =
operator:
MY_VAR=<value>
To set a path relative to the module directory, use the :=
operator.
For example, the following entry sets the PYTHONPATH
to ..\CustomModule\python
:
+ MAYAVERSION:2023 PLATFORM:win64 CustomModule 1.2 ..\CustomModule
scripts: ExtraFiles\2023\scripts
PYTHONPATH:=python
You can append to the current value of an environment variable using the +=
operator.
For example, the following appends C:\ModuleFiles\python
to the existing PYTHONPATH
:
PYTHONPATH+=C:\ModuleFiles\python
To add a path relative to the module directory, use +:=
.
For example, the following appends the python
directory within CustomModule
to the existing PYTHONPATH
:
+ MAYAVERSION:2023 PLATFORM:x64 CustomModule 1.2 ..\CustomModule
scripts: ExtraFiles\2023\scripts
PYTHONPATH+:=python
Similarly, you can prepend paths to a variable using the *=
and *:=
operators.