3D Modelling & Animation Picture... 3D Modelling & Animation Programming Maya Picture...
Agenda MEL Expressions and Scripting Referencing MEL Scripts Python Scripting The Maya C++ API
MEL Expressions Expression Editor Create MEL Expressions using the expression editor Windows - Animation Editors - Expression Editor Set animation times on objects transformations/ rotations/ scaling Expression Editor
Maya Embedded Language Syntax very similar to the C language syntax Supports usual types, conditional statements and control structures Variables declared before use prefixed with the $ symbol string $message = “Hello World”; print ($message + “ from Maya”) Supports arrays string $names[] // an array of names Does not support structured types or arrays of arrays (tables) string $name[] string $meshPosition[] $meshPostion[2] = $name not supported
Maya Embedded Language Has many functions to manipulate strings which can overcome limitations having no support for structured types or tables - see Maya MEL API from Help Suppotrs procedures to encapsulate functionality for resuse global proc makeSphere() { sphere; move 0 0 1; };
Maya Embedded Language Procedures can take arguments and return values global proc string[] generatePopulation(int $popSize, int $length){ /* generates and returns an initial population of binary string values of length $length and population size $popSize */
Maya Embedded Language Maya has a script editor for entering MEL statements Very basic scripting support - Maya 8.5 introduced script line numbering! No syntax highlighting or auto indent etc. MEL Script Editor
Maya Embedded Language output 2. Evaluate Expression (Press Enter on Numeric Keypad) 1. Define Expression
Access Script editor here or here MEL output result here and here Enter MEL commands here
Cutter - MEL (Java) Based Editor Java based editor called Cutter Provides enhanced editing environment syntax highlighting indent etc. Easier access to MEL command reference from Maya Also support for Renderman (Pixar) see www.fundza.com
MEL Editor (Cutter) GUI see www.fundza.com
see www.fundza.com
Accessing MEL Scripts Maya must access procedures via the usersetup.mel file found here: C:\Documents and Settings\username\My Documents\maya\8.5\scripts\userSetup.mel
procedures listed in userSetup.mel
Use MEL to Customize the Maya GUI and Create new Interface Components
Python Scripting Python open-source object oriented language Interfaces with development frameworks such as .NET Enter Python expressions using the text interface choose the Python tab
Maya C++ API Maya supports the development of plug-ins written in C++ Creates dynamic link libraries for extending Maya via additional plug-ins for various utilities and tools May also has a MIDI API Versions of Maya come with a Visual Studio Project Wizard that can be installed in Visual Studio to facilitate the creation of Maya dynamic link library plug-ins (.mll) e.g the 3D Studio mesh import plug-in is 3ds.mll (Maya Link Library) (see the readme in the zip file) Maya 8.5 has a project wizard for Visual Studio 8 (Visual Studio 2005) Reminder:These products are free to CEMS students via the Microsoft Software Alliance
Further Reading David Gould has written two books on MAYA programming see www.davidgould.com Some excellent MEL tutorials and other resources at www.robthebloke.org