A taste of PyMobu

I mentioned before that I have been slowly working on an extension to MotionBuilder’s python classes that make things easier and add more functionality. I been playing with different ways to implement these features and I think I found the best way that makes it very easy to attach without reinventing the whole pyfbsdk module. Thanks to a python guru at work that gave me the idea, I can now attach my own classes to MotionBuilder’s native ones so your code does not have to change, but can immediately begin to take advantage of the new functionality.

Below is a sample of the direction I am taking. I am still putting together all the pieces and finishing up a few other areas before I release my prototype code. I am dubbing the name PyMobu as the project name. So that will be the name until I can think of something better.

One of my bigger complaints in MotionBuilder python is the complete lack of vector and matrix mathematics that are essential in 3D programming. So my sample is to enhance the FBVector3d class to add in all useful operations with 3 dimensional vectors:

(note: I omitted some code to keep it short and not take up the whole page, so some functions are missing)

The last 3 lines above is what actually adds my custom class as a base class to the FBVector3d class so you still just work with FBVector3d objects but now have the benefit of additional methods. The code was taken and adjusted from the python euclid module.

This is the idea around most of my code. This makes it a lot easier to work with inside MotionBuilder without actually having to create new instances of my classes.

More updates and news on the way. Feel free to contact me with questions or comments on the direction I am taking this.

About the author: Scott

Leave a Reply

Your email address will not be published.Email address is required.