[Tutorial] Python Scripting in MotionBuilder


Howdy, folks! My name’s Alex Forsythe, and I’d like to announce a tutorial series that I’ve been working on for several months now:

Python Scripting in MotionBuilder

This is a free series of videos (with accompanying notes on my website) that offers an orientation to MotionBuilder’s Python SDK. I’ve been working with MotionBuilder for about a year and a half, both in Python and C++, and I originally found the transition from Maya to MotionBuilder a bit challenging. Most everybody knows Maya, with its wonderful documentation and plentiful tutorial content, but scripting in MotionBuilder seems to be regarded as something of a black art.

So, in an attempt to add to the small but growing canon of user-created learning materials for MotionBuilder, I decided to try my hand at producing a series of tutorials. In a nutshell, these are the things I wish I’d known about MotionBuilder when I first started. The target audience (other than “me two years ago”) is probably someone who’s used MotionBuilder as an end user and who’s comfortable writing scripts for Maya or 3ds Max, but who might consider him- or herself somewhere on the incredibly fuzzy line between TA/TD and scripter/programmer. I’m definitely expecting some competence with Python from the start, but I hope the videos are approachable and varied enough that you’ll be able to get something out of them regardless of your prior skill level.

If you’re remotely interested, pick a chapter that piques your curiosity and give it a look. I’ve tried to keep things snappy and concise as much as possible – there’s no hemming and hawing, and you won’t be left screaming at me to hurry up and finish typing already. Each video is obsessively planned and meticulously edited, there are animated diagrams to reinforce the concepts being discussed, and captions are available to compensate for my thick American accent.

01 - pyfbsdk and Hello, Cubes (YouTube) | 7:41
Topics: Python Editor; pyfbsdk; the search path; FBModel basics; script files; the asset browser.
[li]Part One introduces the scripting environment within MotionBuilder and demonstrates how to write and execute a simple script using pyfbsdk, MotionBuilder’s Python API module.
02 - RTFM: Documentation and dir (YouTube) | 6:33
Topics: SDK Documentation, samples; FBProperty semantics; Enumerations; Python introspection: dir, help.
[li]Part Two is an attempt to teach a man to fish, as it were, by pointing out some of the resources that can be used to decipher the occult mysteries of the MotionBuilder API.
03 - Components and the Scene (YouTube) | 7:51
Topics: Core class hierarchy: FBPlug, FBComponent, FBProperty, FBBox, FBModel; selection, names and namespaces, property lists.
[li]Part Three dives into the major concepts necessary to understand how the scene is put together, and the common functionality inherent in all scene objects.
04 - Accessing Components: FBScene (YouTube) | 7:07
Topics: pyfbsdk free functions: FBFindModelByLabelName, FBFindObjectsByName, FBGetSelectedModels; FBScene: Component lists; Recursive traversal of model hierarchies.
[li]Part Four describes how to obtain references to objects in the scene, first using the global functions of pyfbsdk, and then with the help of the FBScene class.
05 - FBTime and Playback Control (YouTube) | 4:27
Topics: FBTime, frames and time modes; FBPlayerControl: playback position, transport controls, framerate; FBTimeSpan, playback range.
[li]Part Five describes the utility classes related to time and animation playback, including FBTime, FBTimeSpan, and FBPlayerControl.
06 - Animation Overview: FBAnimationNode (YouTube) | 5:39
Topics: Recorded animation: FBFCurveKey, FBFCurve; Animatable properties; FBAnimationNode, hierarchies for property and component nodes; FBTake, animation layers.
[li]Part Six is a rundown of the major classes involved in animation which attempts to explain how properties, animation nodes, and FCurves fit together.
07 - Dealing with Keyframe Data: FBFCurve (YouTube) | 8:59
Topics: FBFCurve: adding, removing, and manipulating keyframes; linear, constant, and cubic interpolation; FBTangentMode; derivative and weight; serializing and reconstructing FCurves.
[li]Part Seven is an in-depth look at how to manipulate FCurves, including adding, removing, and modifying keyframes.
08 - Decomposition and Library Code (YouTube) | 8:14
Topics: Decomposition, code reuse; abstraction; helper functions and utility code; library modules, namespaces and importing; external IDEs.
[li]Part Eight describes how to create a library to contain common utility functions, and why we’d want to have such a thing in the first place.
There are several more topics that would have to be covered before I could call this series a finished, complete package, but I can’t make any promises at the moment. I was hoping to have an entire series wrapped up and ready to release all at once, but it’s about time I gave it a rest, and 56 minutes of video seemed like a good enough milestone for now.

In any event, I’d be pleased to hear your feedback on these tutorials, and feel free to post any corrections, suggestions, or questions here.


Wow! Great work, seems like a nice resource for MB-Python beginners! I do think it’s great that you mention FBCurves and AnimationNodes since you really cant use the trick of grabbing animation over time by going frame-by-frame. Its also a good insight to the FBX-format that motionbuilder use.

I have seen Jason Parks’ DVD and book(not latest version though) about the subject and this works as a pretty good summary to what he talks about. I like that you also talk about library/structuring code aswell.

I imagine you have plans to talk about UI creation in python? This is one of the things in the sdk I feel is the most non-intuitive at the moment, so if you have any tricks about this, it would be appreciated.

Also, the sound keys being hammered on the mechanical keyboards makes it even better :slight_smile:


[QUOTE=tistatos;20387]Wow! Great work, seems like a nice resource for MB-Python beginners! I do think it’s great that you mention FBCurves and AnimationNodes since you really cant use the trick of grabbing animation over time by going frame-by-frame. Its also a good insight to the FBX-format that motionbuilder use.

Agreed. :D: Very nice work. The illustrations are well worth the effort. Thanks!


A lot of this work would recycle nicely into a GDC talk - the submissions for 2014 will open in mid summer…


These are great tutorials, I love the presentation. Thanks for sharing!


This is great, thank you so much for sharing! I might steal some ideas for my 3dsmax series!


I keep going back to these tuts for reference. Incredibly helpful.
Thanks a bunch!!