Hello World! – A.k.a “Let us begin”

Here is my first posting for this experiment – “the blog”.

For the last two weeks I have been mucking around with Python scripting within MotionBuilder. It has been an uphill battle. With the limited resources out there all I can really do is hack away at bits and pieces of code and decipher them into snippets that I then can use to build the Animation tools that I desire within MotionBuilder.
So this first posting will be the above introduction along with the very first thing everyone needs to know when trying to Python script within MotionBuilder – “pyfbsdk”

Alex Forsythe defines “pyfbsdk” as a module that grants you access to MotionBuilder’s API.

An API is defined as “Application program interface (API) is a set of routines, protocols, and tools for building software applications. An API specifies how software components should interact. Additionally, APIs are used when programming graphical user interface (GUI) components.”

So, let’s begin this experiment to learn Python scripting, create Animation Tools within MotionBuilder and wrap our heads around all that is “pyfbsdk”.

First thing we need to do is import everything from the “pyfbsdk” (see line #1 of the code below). We use a “*” (wildcard) to import everything.

Now on our third line we use the “print” command and follow it with “Let’s begin!”. You can change the text from “Let’s begin!” to “My First MotionBuilder Python Script!”, whatever liese between the quotation marks will be the message printed.

from pyfbsdk import *

print "Let's begin!"

So, where does this all go? Well within the Python Editor window. 🙂 In MotionBuilder goto your top menu bar and under the “Window” drop down choose “Python Editor”.

The Python Editor is made up of two main sections, the “Console Area” and the “Work Area”:

You can click here to see more about what makes up the MotionBuilder Python Editor.

If you copy and paste the code:

from pyfbsdk import *

print "Let's begin!"

Into the Work Area of the Python Editor and hit F5 you should see results within the Console Area.:)

Ta da! My first post here and your first script.

My other posts will be going over much larger things and not as in depth as this one. From here on in I will assume you know the basics of MotionBuilder and I will only focus on the Python Scripting elements within MotionBuilder to help speed up work flow and provide some information (as I learn it).

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.