Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 04-03-2006, 11:52 PM   #1
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default undeclared variable

I´m currently reading The MEL Companion. very good lecture! but -

is it possible, since the book was published in 2003 that some of the scripting language has changed? cause not even one of the examples.mel work correctly with maya 7.


global proc generateGrass()

{
//Creation of Poly Cone
string $blades[] = `polyCone -r .04 -h 1 -sx 3 -sy 10 -sz 0 -ax 0 1 0 -tx 1 -ch 0`;

//bring the bottom of the cone to groundlevel
setAttr ($blades[0] + ".translateY") 0.5 ;

}

// till here it´s working ------------

// harden the edges of cone
polySoftEdge
-angle 30
-constructionHistory off
( $blades[0] + ".e[0:59]" )
;


line 22.19: "$blades" is an undeclared variable. //



why is $blades[] in the second place a undeclared variable? and if there is a reasonable say syntax error or something, why is this provided by the book in exactly such way?

would be happy if someone could help me out.
__________________
everything starts and ends in the right place at the right time.
Falott is offline   Reply With Quote
Old 05-03-2006, 12:30 AM   #2
skywola
Registered User
 
skywola's Avatar
 
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Misplaced bracket - - BTW, I dislike the way most MEL coders position their brackets . . . . This is how I do it . .

global proc generateGrass() {
//Creation of Poly Cone
string $blades[] = `polyCone -r .04 -h 1 -sx 3 -sy 10 -sz 0 -ax 0 1 0 -tx 1 -ch 0`;

//bring the bottom of the cone to groundlevel
setAttr ($blades[0] + ".translateY") 0.5 ;

// harden the edges of cone
polySoftEdge
-angle 30
-constructionHistory off
( $blades[0] + ".e[0:59]" );
}
__________________
"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
skywola is offline   Reply With Quote
Old 05-03-2006, 12:35 AM   #3
skywola
Registered User
 
skywola's Avatar
 
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have seen some pretty sorry examples of what people call MEL tutorials . . . . some of the clowns that write these obviously never even bother to test their code. Kind of like when you were in school and you find out that the answer in the math book is wrong . . . very frustrating, and certainly not helpful.

There is really not a lot of variation of MEL from one version of Maya to the next. If there is, it is usually only added functionality, and added functionality should not cause problems, unless you run code meant for Maya 7 in Maya 5, then you might run in to some issues.
__________________
"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
skywola is offline   Reply With Quote
Old 05-03-2006, 09:36 AM   #4
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default

of course, last code was not part of the statement anymore. but i fear this error was done by me, cause the tutorial adds code gradually and I oversaw the curly bracket.

anyways, thx a lot really!

and for the bracket placing. it´s funny you mention this, cause I moved them around in every place to find a good position for the eye. I´ll use your method from now on.

kind regards!
__________________
everything starts and ends in the right place at the right time.
Falott is offline   Reply With Quote

A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.