[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.

[HR][/HR]
01 - pyfbsdk and Hello, Cubes ([I]YouTube[/I]) | 7:41
Topics: Python Editor; pyfbsdk; the search path; FBModel basics; script files; the asset browser.
[ul]
[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.
[/li][/ul]
02 - RTFM: Documentation and dir ([I]YouTube[/I]) | 6:33
Topics: SDK Documentation, samples; FBProperty semantics; Enumerations; Python introspection: dir, help.
[ul]
[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.
[/li][/ul]
03 - Components and the Scene ([I]YouTube[/I]) | 7:51
Topics: Core class hierarchy: FBPlug, FBComponent, FBProperty, FBBox, FBModel; selection, names and namespaces, property lists.
[ul]
[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.
[/li][/ul]
04 - Accessing Components: FBScene ([I]YouTube[/I]) | 7:07
Topics: pyfbsdk free functions: FBFindModelByLabelName, FBFindObjectsByName, FBGetSelectedModels; FBScene: Component lists; Recursive traversal of model hierarchies.
[ul]
[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.
[/li][/ul]
05 - FBTime and Playback Control ([I]YouTube[/I]) | 4:27
Topics: FBTime, frames and time modes; FBPlayerControl: playback position, transport controls, framerate; FBTimeSpan, playback range.
[ul]
[li]Part Five describes the utility classes related to time and animation playback, including FBTime, FBTimeSpan, and FBPlayerControl.
[/li][/ul]
06 - Animation Overview: FBAnimationNode ([I]YouTube[/I]) | 5:39
Topics: Recorded animation: FBFCurveKey, FBFCurve; Animatable properties; FBAnimationNode, hierarchies for property and component nodes; FBTake, animation layers.
[ul]
[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.
[/li][/ul]
07 - Dealing with Keyframe Data: FBFCurve ([I]YouTube[/I]) | 8:59
Topics: FBFCurve: adding, removing, and manipulating keyframes; linear, constant, and cubic interpolation; FBTangentMode; derivative and weight; serializing and reconstructing FCurves.
[ul]
[li]Part Seven is an in-depth look at how to manipulate FCurves, including adding, removing, and modifying keyframes.
[/li][/ul]
08 - Decomposition and Library Code ([I]YouTube[/I]) | 8:14
Topics: Decomposition, code reuse; abstraction; helper functions and utility code; library modules, namespaces and importing; external IDEs.
[ul]
[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.
[/li][/ul]
[HR][/HR]
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.

1 Like

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.
[/QUOTE]

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!!