MEL - PowerPoint PPT Presentation

About This Presentation
Title:

MEL

Description:

Shelf button: highlight, cmd-click, drag. Script file: File- source script. CIS682. Attributes ... float $vert[]; int $vertexCount[] = `polyEvaluate -v myObj` ... – PowerPoint PPT presentation

Number of Views:159
Avg rating:3.0/5.0
Slides: 11
Provided by: RickP150
Learn more at: https://cse.osu.edu
Category:
Tags: mel | vert

less

Transcript and Presenter's Notes

Title: MEL


1
MEL
  • Scripting Overview

2
MEL commands
  • Maya help -gt MEL command reference
  • MEL command line
  • Script editor
  • Icon
  • Window-gtGeneral Editors-gtScript editor

3
Script editor
  • Type in commands
  • Shelf button highlight, cmd-click, drag
  • Script file File-gtsource script

4
Attributes
sphere listAttr nurbsSphere1 getAttr
nurbsSphere1.tx setAttr nurbsSphere1.translateY
10 aliasAttr up nurbsSphere1.ty setAttr
nurbsSphere1.up
5
Simple Example
  • For (j0 jlt10j)
  • sphere
  • move r 0 j 0

6
Example
// arrayOfSpheres.mel // shows simple nested
'for' loops to create objects for (i0 ilt10
i) for (j0 jlt10 j)
sphere move -r i j 0
7
Example
// simpleKeyframes.mel // shows // setting
object attributes (x and y translation in this
case) // how to set the special currentTime
variable // setting keyframes // the animation
can then be played back sphere -name ball
currentTime 0 SetKey currentTime 50
setAttr ball.translateX 10 SetKey
currentTime 100 setAttr ball.translateY 10
SetKey currentTime 150 setAttr
ball.translateX 0 SetKey currentTime 200
setAttr ball.translateY 0 SetKey
8
Example
// from www.robthebloke.org/mel/DATA_mesh.html
polyCube -name myObj mesh "myObj" float
vert int vertexCount polyEvaluate -v
myObj print ("number of vertices "
vertexCount0 "\n") for(i0iltvertexCoun
t0i) // get world space vertex
coords vert xform -ws -q -t
mesh.vti // mesh.vtxi ltlt
vert0, vert1, vert2 gtgt print(
vert0 " " vert1 " " vert2 "\n"
)
9
Animation expressions
  • expression -s "nurbsSphere1.tx sin(time)"

Manipulate time slider (or hit play) to move
object
Window-gtAnimation Editors-gtExpression Editor
Maya-gtHelp Search on MEL Differences between
expression and MEL syntax
10
Animation expressions
// http//www.fundza.com/melquickref2/expression1
// NOTE spherè returns 2 strings. thats why
obj is an array // and why obj0 is used in
the expression string exp "" string
obj int i for (i0ilt3i) obj
sphere move (rand(-3,3)) (rand(-3,3))
(rand(-3,3)) exp "select -r " obj0
"\n" "move -moveY (rand(0,2))\n" exp
"select -clear\n" expression -s exp -ae
1 playbackOptions -min 1 -max 30 play
Write a Comment
User Comments (0)
About PowerShow.com