Initializing the Maya Environment in and for Python
Initializing the Maya Environment in and for Python
Maya runs any Python commands in the userSetup.py file whenever it starts up. You can use this file to set up your working environment or execute commonly used Python commands such as importing the maya.cmds module.
The userSetup.py script is executed during the initialization and setup phase of Maya; therefore, only commands which set up your working environment and have no dependencies on Maya functionality can be successfully run in this script.
- Create a file named userSetup.py in the following folder:
- Windows: <drive>:\Documents and Settings\<username>\My Documents\maya\<Version>\scripts
- Mac OS X: ~/Library/Preferences/Autodesk/maya/<version>/scripts
- Linux: ~/maya/<version>/scripts
- In the userSetup.py file, type the commands you want Maya to run on start up; for example, import maya.cmds as mc.
Python Computer Graphics Kit
http://cgkit.sourceforge.net/gallery.html
Introduction
The Python Computer Graphics Kit is an Open Source software package containing a collection of Python modules, plugins and utilities that are meant to be useful for any domain where you have to deal with 3D data of any kind, be it for visualization, creating photorealistic images, Virtual Reality or even games.Currently, the entire kit consists of the following parts:
- The Python package cgkit that extends Python with 3D-related functionality.
- The Maya plugin sourcepy that integrates the Python interpreter into Maya, and the accompanying Python package maya that makes Maya functionality available in Python.
- A collection of small stand-alone utilities written in Python, MEL or MaxScript.