MotionBuilder provides scripting capabilities based on the Python programming language. By creating and executing scripts, you can automate repetitive tasks.
This document lists the classes and methods available for scripting MotionBuilder using the Python programming language. In this version, we have exposed a subset of the existing Open Reality SDK to Python using an almost identical class hierarchy with some Python specific enhancements and some Python additions (see pyfbsdk_additions.py).
The Open Reality SDK is mainly used to create new interactive tools, custom devices, import/export filters, shaders, and other specialized objects. Since scripting targets different tasks (such as automation, setup, and batch work), the necessary classes to perform some scripting jobs may not yet be available.
No additional software is required to use scripting: MotionBuilder includes a minimal Python environment. If you have already installed Python version 2.6.1, it is automatically available to scripts run within MotionBuilder.
The Python module is an exposed subset of the Open Reality SDK and uses an almost identical class hierarchy. This introduces the following side effects:
The Python module has the following additional restrictions:
In order to use custom Python module, some setup may prove necessary. The simplest setup only requires copying your modules in the folder [APPLICATION]/bin/[platform]/python/lib for regular .py modules. Binary modules, such as .pyd for Windows should be placed in the folder [APPLICATION]/bin/[platform]/python/lib/plat-win.
Should a different layout be prefered, it will be necessary to use or modify the environment variables PYTHONPATH and PATH. Please refer to the Python documentation for more information.
It is possible to determine if an object is of a certain class type using the function Is(int pTypeId) declared in FBPlug. The parameter pTypeId is a FBClassName_TypeInfo() function defined in each class of the Open Reality SDK exposed in Python. Simply replace ClassName with the appropriate class name to get the function for a type of object.
For example:
cube.Is(FBComponent_TypeInfo()) would return True
FBSystem().Is(FBModel_TypeInfo()) would return False
If a class constructor has one or more default parameters, you must explicitly specify them when calling the constructor.
In future releases, we will expand the scope of both the Open Reality SDK and the Python scripting features to answer your requests and requirements.
Your comments and feedback are very much appreciated and will guide further development of both the Open Reality SDK and scripting.
Thank you.
The Open Reality distribution consists of the following: