Due to a miscommunication between Elsevier Press and the Python Software Foundation, the first printing of this title used an unauthorized modification of the trademarked Python logo. We apologize to the PSF for this, and they have been understanding of our in-press status; in the 2nd and subsequent printing of this title, we shall use a cover design that has been approved as non-dilutive by the Python Software Foundation.

Help make the world a better place and make a secure donation to the Python Software Foundation today!

 

Chapter 10

Programming a Command

Author

Adam Mechtley

Project

Hello World command, Transform commands

Example Files

AR_HelloWorldCmd.py
AR_TransformCmd1.py
AR_TransformCmd2.py
AR_TransformCmd3.py

Synopsis

This chapter revisits Maya’s command engine and explains it in more detail, including its undo/redo mechanism. Readers walk through the basic parts of a command and learn how to write their own simple commands that parse arguments. The project centers around two versions of a transform command. The first version implements only query mode and prints information about a transform node in either world- or local-space. The second version implements undo/redo and create and edit modes for the same command.

Resources

Essential Mathematics for Games and Interactive Applications
Complete Maya Programming Vol. 2

Other Notes

For the sake of simplicity, Chapter 10 does not discuss unit types (MAngle, MDistance, etc.), though they are mentioned briefly in Chapter 12. For a more flexible, production-ready alternative to this chapter’s example, see AR_TransformCmd3.py.

Errata for the First Edition

None


Leave a Reply

Your email address will not be published. Required fields are marked *