Python Scripting for MotionBuilder 2011 - Reference Guide
(pyfbsdk)
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
comes with a minimal Python environment. If you have already
installed Python version 2.6.4, 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 limitations of the C++ Open Reality SDK also applies to
code written in Python.
The Python module has the following additional restrictions:
- The only way C++ code can run Python code is by using FBApplication::ExecuteScript to
call already-created Python modules. For more information, see the
FBApplication
Class Reference in the ORSDK help.
- Python classes from the SDK cannot serve as parent for a client
class, as it will not be possible to overload inherited virtual
methods.
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. With time, both the SDK and Python will
provide complete access to MotionBuilder's feature set.
Your comments and feedback are very much appreciated and will
guide further development of both the Open Reality SDK and
scripting.
Thank you.
- Warning:
- This Python documentation has been automatically generated
directly from the Open Reality C++ SDK documentation. Any errors,
omissions or inconsistencies should be reported to ensure that it
will be corrected in subsequent versions.
The Open Reality distribution consists of the following:
- Python Scripting Reference Guide (pyfbsdk)
- Python Scripting Sample Scripts
Generated on Tue Feb 9
19:33:56 2010 for Python Reference Guide by
1.5.3