Load C++ Plugins from a Python Project at MotionBuilder Startup.
- Motionbuilder : 2020 or above
- OS : Windows
-
Open a terminal as an administrator.
-
Run the following command, replacing the path with your MotionBuilder installation directory:
path/to/MotionBuilder<version>/bin/x64/mobupy.exe -m pip install mbpluginloader
Note: Only works with MotionBuilder 2022 and later.
This method is mainly intended for developers who want to bundle mbpluginloader directly within their own projects or tools (i.e., as a third-party library).
-
Go to the GitHub Releases page.
-
Download the source code
.zip
file for the latest release. -
Extract the archive. You will find a
mbpluginloader
directory inside. -
Copy the
mbpluginloader
directory into your own project's source tree. -
You can now import it in your project using
from mbpluginloader import ...
.Project directory ├── your modules ├── ... └── mbpluginloader <- downloaded from Git Release
Loads a C++ plugin (.dll
) from a specified file path or all plugins within a directory.
- path_or_dir (
str
): The absolute or relative path to a single.dll
file or a directory containing.dll
files.
Prints a formatted log message to the MotionBuilder console.
- level (
str
): The log level (e.g., "Info", "Error"). - format_string (
str
): A message template containing{}
placeholders. - *args: Values to be inserted into the placeholders in
format_string
.
-
Visual Studio Build Tools & "Desktop development with C++" workload
- MSVC v143 - VS 2022 C++ x64/x86 build tool : MotionBuilder 2024 ~
- MSVC v142 - VS 2019 C++ x64/x86 build tool : MotionBuilder 2022, 2023
- MSVC v141 - VS 2017 C++ x64/x86 build tool : MotionBuilder 2020
-
Open a terminal as an administrator.
Set the Visual Studio environment variables using
vcvarsall.bat
, which is typically located at:C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/Build
.path/to/vcvarsall.bat x64 [-vcvars_ver=<version>]
Use
-vcvars_ver=14.29
for VS2019 or-vcvars_ver=14.16
for VS2017. See the Microsoft documentation for more details.
-
Clone this repository.
git clone https://github.com/Ndgt/MBPyPluginLoader.git cd MBPyPluginLoader
-
Edit the user-specific variables in
CMakeLists.txt
according to your environment.# === Environment-specific user configuration === set(PRODUCT_VERSION 2026) set(MOBU_ROOT "C:/Program Files/Autodesk/MotionBuilder ${PRODUCT_VERSION}")
-
Build.
cd src cmake -S . -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release cmake --build build
-
FBSystem().Version
returns float version value formatted asxx000.0
For example, in MotionBuilder 2024, this returns
24000.0
.
- This module uses Boost.Python to call the
FBSystem::LibraryLoad()
function from the C++ SDK, which is not exposed in the Python SDK.