

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Professor: Kesson; Class: Programming Concepts for Visual Effects; Subject: Visual Effects; University: Savannah College of Art and Design; Term: Unknown 1989;
Typology: Study notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!
API Guide
The Maya Python API is not an exact copy of the C++ Maya API. We have made changes to the Python bindings for integration purposes.
We have removed the MString and MStringArray classes from the Maya Python API. Python already has a very robust string implementation which makes ours unnecessary.
We have removed the MStatus class. Python exceptions must be used instead of MStatus. See previous examples.
The Maya API makes use of void pointers in several places including messages. In the Maya Python API, any Python object can be passed in place of a void pointer.
When creating a proxy class in a creator() function or any other function that returns the class to Maya, you must call OpenMayaMPx.asMPxPtr() on the new object. This call transfers ownership of the object to Maya. If this call is not made, then Python retains ownership and can dereference the object and destroy it even though Maya may have a pointer to it.
In C++, it is possible to use the argument parameter of MPxCommand::doIt() to find which arguments have been entered. In Python, this does not work. Instead, you must use the MSyntax and MArgParser classes to support arguments within a scripted MPxCommand.
It is possible to mix Maya Python API calls along with Maya command calls in the same script. Undoing the operations of such a script will not be correct if the Maya Python API calls modify the model and do not properly support undo using the MPxCommand class.
When comparing these interfaces to the shared libraries we ship for the C++ Maya API, the only difference is a new OpenMayaMPx module. This module contains the bindings for any proxy or MPx class we provide.
The Maya API C++ include files are used to generate the bindings for the Maya Python API. These files are not required when programming with the Maya Python API but are useful to see
what is included or excluded in the bindings, since not all items in the C++ API are scriptable.