Share

Module description files

Modules provide a way to distribute multiple versions of a plug-in and load a different version depending on operating system and MotionBuilder version.

The module description file must have the .mod extension.

By default, MotionBuilder expects the module directory to have the python and plugins subdirectories. These directories are not read recursively. However, you can edit the module file to specify new and multiple locations for these directories, and have them be read recursively.

Each entry in the module description file specifies conditions for loading the plugin and Python script, the location of the module files, the paths to the plug-ins and Python scripts, and modifications to environment variables.

You can comment out lines in the module description file by adding a # to the beginning of the line.

Instruction for loading the module

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 MotionBuilder version.

+ MOBUVERSION:<version> PLATFORM:<platform> BUILDVERSION:<BuildVersion> <ModuleName> <ModuleVersion> <ModulePath>

Entry Description Notes
MOBUVERSION Optional

Specifies a base version of MotionBuilder.
Can be any base version of MotionBuilder, for example 2023.

If this condition is omitted, the entry applies to all versions of MotionBuilder.
PLATFORM Optional

Specifies an operating system.
Can be x64 or linux64.

If this condition is omitted, the entry applies to all operating systems.
BUILDVERSION Optional

Refers to a specific build version or series of build versions. The build version can be found by running motionbuilder.exe -buildInfo on Windows or ./motionbuilder -buildInfo on Linux.
Only applies if MOBUVERSION is specified.

Adding a + to the end of the build version indicates that the module should be loaded if you are running this build version or any later build version associated with the MOBUVERSION.

Adding a - to the end of the build version indicates that the module should be loaded if you are running this build version or any earlier build version associated with the MOBUVERSION.

Omitting the - and + means that the module should be loaded only if this exact build version is running.

If this condition is omitted, the entry applies to all build versions associated with the specified MotionBuilder version.
ModuleName Required

The name of the module.
The module name cannot contain spaces.
ModuleVersion Required

The version of the module.
Can be up to three period-separated numbers. Any trailing strings included will be ignored but will be returned when queried through the API.
ModulePath Required

The module location.
Can be either an absolute path or a path relative to the module file.
Note:

  • 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, MotionBuilder will only take into account the entry with the highest version number. Entries with lower version numbers will be ignored.

Module folder structure

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.

By default, C++ plug-ins are located in the plugins directory and the Python scripts are located in the python directory. If files in a different directory need to be loaded, or if the directories need to be read recursively, this will need to be specified in the entry.

The location of the C++ plug-ins will be added to the C++ plug-ins search paths. The location of the Python scripts will be added to the Python script search paths, and will be appended to sys.path, and the Python scripts found in this path will be loaded.

Override the default location of a folder using:

<folder to override>: <new location for this folder>

For example, to specify a new location for the Python scripts folder, add the line:

python: ..\ModuleFiles\2023\python

To read the directory recursively, add [r] in front of the directory:

[r] python: ..\ModuleFiles\2023\python

You can also set the entry to load files from multiple directories. Separate the directories with a semicolon for Windows and a colon for Linux.

For example, on Windows:

+ MOBUVERSION:2023 PLATFORM:x64 CustomModule 1.2 ..\CustomModule
python: ModuleFiles\2023\python;ExtraFiles\2023\python

For example, on Linux:

+ MOBUVERSION:2023 PLATFORM:linux64 CustomModule 1.2 ../CustomModule
python: ModuleFiles/2023/python:ExtraFiles/2023/python

To add location of Python scripts to the Python script search paths and to the Python sys.path without executing the Python scripts themselves, use the python_sys_path: line instead of the python: line.

Note:

  • There must be a space between python: and the first path, which is also the case for plugins: and python_sys_path: lines.
  • Hidden subdirectories will be ignored even when recursive search is on.

Environment variables

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:

+ MOBUVERSION:2023 PLATFORM:x64 CustomModule 1.2 ..\CustomModule
python: ModuleFiles\2023\python;ExtraFiles\2023\python
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:

+ MOBUVERSION:2023 PLATFORM:x64 CustomModule 1.2 ..\CustomModule
python: ModuleFiles\2023\python;ExtraFiles\2023\python
PYTHONPATH+:=python

Similarly, you can prepend paths to a variable using the *= and *:= operators.

Was this information helpful?