Chapter 1: An Introduction to the Maya Embedded Language


click to expand

Overview

The Maya Embedded Language, or MEL, is an important part of what makes Maya so powerful. Yet, many artists working within Maya ”out of ignorance, fear of the unknown, or a mistrust of programming ”do not exploit it.

MEL is not just another aspect of Maya, it is the very foundation of the Maya application itself. While many of the core pieces of the software are hard coded," you will be surprised, if not stunned, to discover the amount of functionality Maya provides with scripting. While this provides a lot of cross-platform stability (one of the reasons why Maya can appear on so many platforms), it also allows for an incredible amount of control for the MEL-savvy user . Whether customizing the workspace, modifying the tools that already exist, or creating new tools, an artist versed in MEL is ready to fully exploit the true power of Maya.

By now, you re probably wondering, if MEL is so great, why doesn t everyone know it? Good question, and no easy answer. Earlier we proposed that it was possibly out of ignorance. Well, if you purchased this book and read this far, that excuse is no longer valid.

The other two possibilities ”a mistrust of programming and fear of the unknown ”go hand in hand. Artists really only mistrust programming because it represents a whole other world. A world filled with words like variable , conditional statements , and vector cross-product do nothing for your average artist. You might as well be speaking another language ”oh wait, you are.

Therein lies one of the keys to learning MEL. They are called programming languages for a reason. They have their own vocabulary and rules of grammar. It is simply a matter of learning those rules.

Many scripters, when asked by an eager young artist, How can I learn MEL? respond with, Look at the scripts that are out there and see how they were done. That is ridiculous. You wouldn t hand somebody who wanted to learn French a copy of Les Miserables in the original French and expect him or her to just catch on, would you? Of course not. And the documentation provided with Maya does little more than provide syntax definition and rules for those already versed in programming. Again, not much use to an artist.

That s where this book comes in. The first section, cleverly entitled Part I, covers the syntax, vocabulary, and the structure of MEL ”it s grammar, if you will. It also covers some basic math concepts such as types of numbers and simple math equations. Finally, we cover concepts of building and constructing any program, which is applicable because scripts are, in fact, computer programs. The second section, with the also clever but somewhat predictable title of Part II, covers the construction of some scripts that detail some of the ways you can use MEL.

This book makes some assumptions about, you, the reader. First, we assume that you have a fundamental knowledge of working in 3D and the Maya program. We don t explain what XYZ co-ordinates are, what the Hypergraph is, or other basic operating knowledge. In addition, although you might not have an extensive knowledge and understanding of mathematics, you should have some willingness to learn the basics of working with numbers, because this is essentially a programming book, and all programming is built on manipulating numbers. Other than that, everything else is explained in language that is hopefully as clear as it is entertaining.

In Chapter 2, A Primer on Mathematics, we explain what the different types of numbers are, how they re used, and some of the basic concepts needed for working with 3D math. It is not a comprehensive text on 3D math (that subject could fill an entire book, and, in fact, there are many quality books on 3D math out there); however, we give you enough to get by.

That is the essential philosophy of this book. The author is not a programmer by training, he is an artist. This book was written with the artist in mind. A basic tenet of art is that if it looks right, it is right. This book s philosophy is the same. While fast tools are good, and efficient tools are good, usually it s better if they work. Many useful MEL tools can be done with the programming version of duct tape. Cheating, digital smoke and mirrors, and programming duct tape are a basic part of putting together tools fast. And, of course, you can do things the right way. And by the end of this book, you ll have hopefully learned both. MEL is about problem solving. It, and you, really shouldn t care how you achieve the result, as long as that result is what you want. We refer to this as guerilla scripting. It s a philosophy and approach that many programmers are aghast at publicly , but actually adhere to it in practice. And it s a concept familiar to artists everywhere.

So, dive in. It s best not to skip any sections, because although we have tried to explain things as simply as possible, any type of programming can be confusing. Occasionally, because two concepts are interdependent, one topic won t make sense until you read the entire section. We avoided this wherever possible, and where we couldn t, we made sure to notify you so you know it s coming.




The MEL Companion
The MEL Companion: Maya Scripting for 3D Artists (Charles River Media Graphics)
ISBN: 1584502754
EAN: 2147483647
Year: 2003
Pages: 101

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net