Programming a Command
Hello World command, Transform commands
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.
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