View Full Version : The variable are not recognize
Quarions
02-22-2009, 05:33 PM
Hi,
I'm not sure if it's because I'm on a mac, but for every $... maya tell its it's an unrecognized variable, does someone know why.
Thank you.
LaLiLuLeLo
02-23-2009, 08:43 AM
What does your code look like?
Quarions
02-23-2009, 02:56 PM
There's a part of it, it's the flower from the introduction to MEL.
//Create the flower core
sphere -ax 0 1 0 -n "core";
string $myCore[] = `ls -sl`;
scale 1 .5 1;
move 0 .2 0;
//Connect to the shader network
// d = direction
select $myCore[0];
pickWalk -d down;
string $myCoreShape[] = `ls -sl`;
sets -edit -forceElement coreColorSG $myCoreShape[0];
//build the petal
sphere -ax 0 1 0;
move 0 0 -1.6;
scale .7 .3 1.7;
FreezeTransformations;
ResetTransformations;
string $myPetal[] = `ls -sl`;
parent $myPetal $myCore;
//Connect to the shader network
select $myPetal[0];
pickWalk -d down;
string $myPetalShape[] = `ls -sl`;
sets -edit -forceElement petalColorSG $myPetalShape[0];
sunder
02-23-2009, 04:40 PM
I tried the above and it executes with no errors on my end. Did you copy and paste that code from the provided files on the training kit? Those mel files were built in windows so maybe, just maybe there's some issues with the $ characters on the mac. It's a stretch but try and replace (or retype) the code in Maya.
Quarions
02-24-2009, 07:20 AM
There's the error I got, when I try to run my entire script :
// Error: for ($uCV = 5; $uCV <=6; $uCV++){ //
// Error: Syntax error //
// Error: for ($uCV = 5; $uCV <=6; $uCV++){ //
// Error: Syntax error //
// Error: for ($uCV = 5; $uCV <=6; $uCV++){ //
// Error: "$uCV" is an undeclared variable. //
// Error: for ($vCV = 0; $vCV <= 7; $vCV++){ //
// Error: Syntax error //
// Error: for ($vCV = 0; $vCV <= 7; $vCV++){ //
// Error: "$vCV" is an undeclared variable. //
// Error: }} //
// Error: Syntax error //
// Error: float $degreeApart = (360 / $numPetals); //
// Error: "$numPetals" is an undeclared variable. //
// Error: for ($i = 2; $i <= $numPetals; $i++){ //
// Error: "$numPetals" is an undeclared variable. //
// Error: } //
// Error: Syntax error //
Thank you for your help.
sunder
02-24-2009, 09:10 AM
Next time please post the whole script. When you see the error, one can tell that your variables have not been declared.
Before you run the loop, declare your variables. For example:
int $uCV;
for ($uCV = 5; $uCV <=6; $uCV++){ etc