Im new to Mel- Im trying to make a checkbox turn on and off the visibility of another button in the GUI- i dont know how to correctly declare the variable-
thanks for the help- your scipt works perfectly, but when i use that code on mine i get a '$Rarm is an undeclared variable' - here is more of the code, any ideas?
global proc magnus() { string $image = (internalVar("-userBitmapsDir") + "magnus/magnus.bmp");
if ( window -exists imageWindow ) deleteUI -window imageWindow;
Nooo, dont use eval. thre -onc and ofc are strings so why eval somethings thats allready a string (evel is there so you can execute strings, well they arent executed, they are defeered just like eval anyway so no idea in double evaling things)
Using string variable name in the string expression which is argument to eval will dereference it into literal ( it's content ). It's exactly the same as using parenthesis to do it. The whole string expression is evaled not just the string variable. Btw. you are evaling when you use
In a way, you are right. Eval needs to do a bit more work than . But that's why it's capable of executing any kind of code, not just commands. The extra work eval does mainly consists of compilation of source into bytecode, which happens a lot faster than the actual execution of the same code. So it's much less than x2 slower.
Well actualy eval does carry other overheads too but yes not quite 2x... its a runtime compile of the string, normal mel is compiled Once whan run and kept compiled in memory (no maya does not copile line by line), wich means the effcicency will kick in the next time you run the code.
Btw you never need to use the s to return stuff... you can use all maya commands as if they were procedures.
example
print( ls("-sl","-dag"));
Im sure you can think of uses for that the is a ctualy just shorthand notation for this syntax version but note that you could do this also
$flag="-sl"; print(ls($flag,"-dag"));
Also you cnt nestle two s inside eachother but the proc version can! Example note the utility proc for getting the element out of array (no arrays can be passed in this manner). the utility proc shold be ovious.