Convert Maya Scripts

Alex Telford created a script that will convert Maya scripts into something that can be used in Blender. This has been something that Alex has been working on for over a year – creating an API that will allow Maya Python scripts to work inside of Blender.

If you use both applications, you can actually write one script that will work in both. The script is designed so the cmds module can bring some of the functionality from Autodesk Maya python scripts to Blender (via maya.cmds). Alex originally created the script so that he could make his scripts work in both the Maya and Blender Blender environment by simply changing the import line.

Check out the GitHub repository for the Maya Python Script To Blender Script Converter.

[via blender nation]

Description:

This module is designed to bahave ‘like’ maya.cmds, but due to the nature of Blender’s object oriented and context sensitive workflow these functions will return objects.

You can use the asString and asObject functions to convert between strings and node classes. asString will return a string or list of strings depending on the input.

For example:

if inMaya():
selection = ls(sl=1, l=1)
elif inBlender():
selection = asString(ls(sl=1))
These functions can take string and object inputs, but you will get better results when sticking to blender objects.