View Full Version : mel in the digital tutors tutorials
freudork
08-29-2006, 11:34 PM
there is a mel like this. but my maya 7 say there is something wrong with the 'ls -sl'.
string $mySelection[] = 'ls -sl';
setAttr -keyable false ($mySelection[0] + ".sx");
setAttr -keyable false ($mySelection[0] + ".sy");
setAttr -keyable false ($mySelection[0] + ".sz");
anyone know how to correct this?
shk1101
08-29-2006, 11:42 PM
use back ticks `ls -sl`, next to number 1, instead of single quotes 'ls -sl'.
freudork
08-31-2006, 12:46 AM
wht was wrong with this one? there is syntax error on the "proc attrRemover(String $myTranslate)".
window -title "remove attribute from channel box" -rtf true myControlWindow;
rowLayout -nc 3;
button -label "Translate" -c "attrRemover t" myTransT;
button -label "Rotate" myTransR;
button -label "Scale" myTransS;
showWindow myControlWindow;
proc attrRemover(String $myTranslate){
string $mySelection[] = `ls -sl`;
setAttr -keyable false ($mySelection[0] + ".sx");
setAttr -keyable false ($mySelection[0] + ".sy");
setAttr -keyable false ($mySelection[0] + ".sz");
}
freudork
08-31-2006, 11:30 PM
syntax error, man.
there is syntax error on the "proc attrRemover(String $myTranslate)".
glick_c
09-01-2006, 09:07 AM
proc attrRemover(String $myTranslate)
proc attrRemover(string $myTranslate)
;)
Yep you did a caps on the S in String. use lowercase like glick pointed out.
freudork
09-01-2006, 09:27 PM
HM, million thanks............
later maybe more.
In the future please create a help ticket in our helpdesk system.
freudork
09-03-2006, 09:51 PM
i paste this into the editor, but there is nothing in the viewport. i move the script to the shelf.
global proc flowermaker () {
//build the petal
sphere -ax 0 1 0;
move 0 0 -1.6;
scale .7 .3 1.7;
}
you have to call the procedure.
freudork
09-04-2006, 11:53 PM
how to call the procedure?
why cant i simply copy and paste the code to the editor, then run it.
there is nothing in the viewport with this way.
glick_c
09-05-2006, 09:01 AM
run your procedure by typing:
flowermaker ();
You can just put that at the end of your code or in a for loop or wherever you want.
freudork
09-05-2006, 10:27 PM
i can run the script with the just the "flowermaker".
can i simply copy and paste the code on the editor to run? i cant.
and there is something wrong with this code. the cv seems to be not moving.
global proc flowermaker () {
//build the petal
sphere -ax 0 1 0;
move 0 0 -1.6;
scale .7 .3 1.7;
string $myPetal[] = `ls -sl`;
select ($myPetal[0] + ".cv[3] [7]");
move -r 0 1.5 0;
}
glick_c
09-05-2006, 11:53 PM
http://img204.imageshack.us/img204/5387/petalad2.jpg
this is the image I get, what are you trying to do?
freudork
09-09-2006, 07:07 PM
there is some thing i dont quite understand in this mel. i hope i get it correct here.
global proc flowermaker () {
int $numPetals = `rand 10 20`;
//why there are three no. in the ``
sphere -ax 0 1 0;
move 0 0 -1.6;
scale .7 .3 1.7;
FreezeTransformations;
ResetTransformations;
string $myPetal[] = `ls -sl`;
select $myPetal[0];
float $degreeApart = (360/$numPetals);
print $degreeApart;
for ($i = 0; $i <= $numPetals; $i++) {
duplicate;
rotate -r 0 $degreeApart 0;
float $petalRX = `rand -10 10`;
float $petalRY = `rand -10 10`;
float $petalRZ = `rand -10 10`;
//wht does this one mean. why it is not
float $petalRY = `-10 rand 10`;
then
rotate $petalRX $petalRY $petalRZ;
FreezeTransformations;
rotate $petalRX $petalRY $petalRZ;
}
}
there is another problem for my maya. everytime i adjust the mel, i need to restart the maya to run the mel.