Python in 3D Studio Max, Maya and Blender - examples
I've recently created 3 scripts that create (almost) the same scene in 3 different applications (Maya, Max and Blender). They are intended to serve as a source of code snippets for future projects and examples of how to do stuff in those applications - something like Blender's cookbook.
Maybe someone will find it useful. It has a lot of comments, so it can come in handy to someone that is also learning Python API's for those applications. Also, if there are some errors in code or something was done in a wrong way, please let me know, I'd like to improve it.
The code is on GitHub:
Scripts use Python API to create similar scene in: Autodesk 3D Studio Max, Autodesk Maya and Blender.
Every script has a number of support functions and seven major functions:
- prepare_scene(path) - The function sets the basic parameters of the scene: time range, tangent type of keyframes and render settings.
- import_and_animate_basic_meshes(path) - This function imports some objects and animates them. It was created to show how to import objects and present one way of creating keyframes of animation.
- create_shark_and_cloud() - Creates meshes from vertex and face data. Similar functions can be used in importer plugin. create_chest() - Function creates an object with a use ofrecorded macros, if such function is avaible in software. Macros are a very simple way of creating basic scripts.
- create_and_animate_trees() - Function uses the create_palm() support function to create and animate some palm trees. It was created to show how to create basic geometry objects, use instances and use modificators.
- change_hierarchy_and_animate() - Function modifies the hierarchy of scen and creates some final animations, that ware not possible to create earlier. It also creates cameras and lights.
- create_and_assign_materials() - Function creates and applies materials to the objects. It was created to show how to handle materials.
All scripts have simple GUIs
How to use:
Download the content of the "common" directory. Script will ask for path to those files before running
Read the Readme.md file inside directory wit a script for choosen software and fallow the instructions. Every software has a different way of running scripts