Writing Python Programs in Maya
Develop functions for a texture processing framework
This chapter introduces the fundamentals of creating Python programs by focusing on the development of functions. It presents a number of properties of functions including arguments and return values. The chapter also makes comparisons with MEL to introduce keywords and concepts for iteration, conditional statements, and exception handling when working with Maya commands. Readers will develop a basic texture processing framework throughout the chapter, which they could customize to use in their own work.
Errata for the First Edition
On p. 105, the
process_diffuse() function contains a line reading
shaders = maya.cmds.listConnections('%s.outColor'%'file1', destination=True,), which should instead read
shaders = maya.cmds.listConnections('%s.outColor'%'file_node', destination=True).