Sunday, January 20, 2013

Introduction

This afternoon, I read the Introduction: Welcome to Maya Python for about 2 hours. Actually, I usually pass the introduction part when reading a book. But after I read this introduction, I found it is quite useful, at least for me.

It firstly explains why we need Python: using Maya's built-in scripting languages to avoid repeating works.Secondly, it compares Python versus MEL to indicate Python is much better than MEL. Thirdly, it explains the syntax of the code examples in this book, including white-space, line breaks, semicolon, quotation marks, comments. Finally, it gives two short code examples. They have same result, but one is wrote by Python and another one is MEL.

 This two pictures are the code and result by using Python version of this script.It only need to run 0.81 seconds in my computer.
 This two are the MEL version of this script. It made me surprised because Maya stopped responding after executing the MEL script. But finally, it shows the result in stead of crush (thank god!). The execution time is 57.52 seconds.
This is the distorted sphere in Maya viewport after I executed (Ctrl+enter) the two scripts. 

Then, the book point out that no artist would want to use a script that takes a few minutes to execute. It would make the tool very difficult for artists to experiment with and most likely it would be abandoned. In the end, the author says you should be able to create scripts that are more complicated than even the example from this chapter by the end of this book, which makes me excited to get started leaning how to use Python in Maya, even I cannot read that code example right now.

No comments:

Post a Comment