• 1/3

Cross Product Scripting: Towards a Common Python API

Posted by Christopher Diggins, 3 January 2012 10:30 am

Other the last few months I have been exploring the feasability of cross-product scripting: running the same Python script in multiple Autodesk DCC tools. I am doing this by wrapping the Python APIs for various products (e.g. 3ds Max, Maya, MotionBuilder, and FBX) with a common set of classes so that I can write scripts that run in multiple products.

I am hoping to hear from my readers to tell me how useful it would be for them if there was a single Python API that they could use for common scripting tasks across products, in addition to the existing native scripting API. 

I believe there is value to at least some studios. For example Blur invested a signficant amount of effort in developing a common Python API for controlling 3ds Max and Softimage (see http://code.google.com/p/blur-dev/). Over the long term there would be an advantage for people hiring technical talent if much of the scripting knowledge and libraries developed by technical artists and tool developers could be transferred across products. Today learning MAXScript does almost nothing for you if you want to try and write scripts for Maya.

During my experimentation I developed a prototype of a common API for traversing the scene graph and extracting mesh and transform data. I even have a common interface for creating geometric objects. This API was used to create the WebGL server described in my previous blog.

What I hope to learn from my readers is how far I would need to go to develop an API that would have real-world value, beyond being a toy for creating fun demos. I also need help understanding what kinds of APIs would be the most important for cross-product scripting.

For example would you most want a common API to:

  • Get and set arbitrary node and object meta-data (e.g. user properties, blind data, custom attributes)
  • Trigger and query menu items and user actions.
  • Query the scene graph: type of object, name.
  • Create new geometric objects
  • Manipulate the mesh
  • Character rigging

I'm also interested in hearing what products you most would like to be able to run the same script in. 

I look forward to reading your suggestions and comments, thanks!
 

 

7 Comments

jpepper

Posted 4 January 2012 10:14 am

It's certainly an interesting topic. One of the problems for most artist's is the fact that they've chosen their DCC app and learned its native scripting languages MEL or Maxscript etc...

So now this new thing called Python is suppose to talk to anything however, no one knows how to do it with their chosen DCC app and the time they invested in learning all the ins & outs.

So if there is something you are able to create or make this easier that would be an amazing thing.

Here's a few common things that would be great:

1: Basic File commands
Open
Merge
Save

This way you could have different apps using the same directory File Structures and would be able to open up their App files in the same locations from one UI depending on which DCC app they are using.

2. Camera info

3. Object Transforms

4. Caching - Autodesk's XML format

I'm sure this would open up a lot of uses an interests


Christopher Diggins

Posted 4 January 2012 1:24 pm

Thanks jpepper and and KiboOst. This is great feedback.

Christopher Diggins

Posted 15 January 2012 6:17 am

@stig atle: I hear you loud and clear. This is very useful feedback, and 3ds Max -> inventor interop is an area that I am interested in seeing developed over the next while.

@Nysuatro: can you go into more detail about the MotionBuilder <-> 3ds Max interoperability you need? Thanks!

RockstarMatt

Posted 11 June 2012 8:48 am

I'm coming to this a bit late, but I'd love ot have more interop between Max and Motionbuilder. We have a pretty sophisticated set of tools within Max via maxscript and then a load of other things inside Motionbuilder via the Motionbuilder Python integration, however we've had to do a fair amount of things which basically do the same things.

I'd love to be able to get access to standard things such as querying transforms, building joints chains, setting transforms, building custom attributes etc etc that would work in a consistent fashion in both packages. Basically the bread and butter of rigging.

agrant3d

Posted 15 January 2013 3:17 am

It's a year later but I thought I should comment because I've used the scaffolding of your autodesk lib in the WebGL post to start building out the cross-platform api at our studio.

We've got modelers working in 3DS Max, Rigging being done in Maya, and mocap animation being edited in MotionBuilder.

We really want animators to be able to work in Maya as well, so I'm building a scene manager whose UI is PyQt, and all the interactions with the application are through the autodesk lib. Initial design is being done in MotionBuilder, where animation work is currently being done. I don't have plans for including 3DS Max in this yet, because it's not Qt and doesn't include python, but other than that nothing should prevent this.

It would be really helpful if Maya and MotionBuilder both came with PyQt or PySide pre-installed. I had to mess with the MotionBuilder install (replace the Qt dlls with dlls PyQt is built with) in order for Maya and MotionBuilder to use the same binaries.

The FBX Python sdk is problematic because it is compiled with a specific version of SIP, so the precompiled version with our build of PyQt. Is there a plan to release source for this?

Thanks!

Christopher Diggins

Posted 15 January 2013 5:37 pm

Hi Andrew, thanks for sharing your story and your suggestions. There are no plans to release the FBX source, but I can poke some individuals. :-)

agrant3d

Posted 25 January 2013 7:05 pm

Hey Christopher,
While a common API for Autodesk products is a great idea, another thing that would greatly help when building out a cross-application toolset would be a common way to register plug-ins, modules, python paths, etc.

I think Maya has the cleanest interface between the packages that I'm familiar with and would be the model that I would want to replicate across all the products.

It would be super awesome if you could say, define a SomeModule.txt in My Documents/Autodesk/Studio/Modules and be able to define additional paths for all the products there.

Thanks!
-Andrew

Add Your Comment

You must be logged in to post a comment.

Please only report comments that are spam or abusive.