Substance Painter
In this start to finish texturing project within Substance Painter we cover all the techniques you need to texture the robot character.
# 1 02-03-2014 , 04:54 AM
Registered User
Join Date: Mar 2014
Posts: 3

is an undeclared variable

Hello guys,

im new using MEL Script and i cant find the way to solve this problem.
Some body knows why this 2 codes are "undeclared variables"?

What I suppose to do to get them work properly?

Code:
string $objSel[] = `listHistory $obj`;    
string $wireList[] = `ls -typ "wire" $hist`;

# 2 02-03-2014 , 05:30 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
1. The variable $hist in your second line doesn't exist.
2. $objSel does not hold the selected objects, so change the variable name.
3. -type is misspelled in the second line.


Imagination is more important than knowledge.
# 3 02-03-2014 , 06:50 AM
Registered User
Join Date: Mar 2014
Posts: 3
Hi NextDesign,

Even if I run just the first line
Code:
string $objSel[] = `listHistory $obj`;
or
Code:
string $his[] = `listHistory $obj`;
MaYa gives me an error.
// Error: Line 1.35: "$obj" is an undeclared variable. //

I changed the array $objSel[] to $his as I had in the second line
Code:
string $wireList[] = `ls -typ "wire" $hist`;
and didnt work.

I also tried to change the variable $obj for $geometry (i.e) and didnt work also.

There is something in MaYa 2014 that doesnt allow me to get access to the obj History using

Code:
string $his[] = `listHistory $obj`;
And because the first line doesnt work MaYa cant go thrue to the second code line
Code:
string $wires[] = `ls -typ "wire" $hist`;

# 4 02-03-2014 , 02:03 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Anything with a dollar sign in front is a variable that needs declaration. And now you've spelled his and hist differently. Variables have to be named consistently. Perhaps it would be good to do some Mel tutorials or scripting tutorials.

# 5 02-03-2014 , 06:08 PM
Registered User
Join Date: Mar 2014
Posts: 3
Hi stwert,

Thank you.
Yes I know that everything that has dollar in front is a variable.
Im having Problems to load some selections, that I forgot I change something in the code.

With an small advice from NextDesign I saw the problems and I correct them.
I also thank you for the observation.

Thank you guys.
I found the solution to my script problem.

Cheers!


Last edited by combojerman; 02-03-2014 at 09:05 PM.
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads