Introduction to Maya - Rendering in Arnold
This course will look at the fundamentals of rendering in Arnold. We'll go through the different light types available, cameras, shaders, Arnold's render settings and finally how to split an image into render passes (AOV's), before we then reassemble it i
# 1 09-12-2006 , 12:12 PM
Registered User
Join Date: Dec 2006
Posts: 3

mel script

im doing a project on animating the Towers Of Hanoi using a recursive algorithm. It all works fine but im adding a couple of features and have come across a problem. i need an assembled variable name to print out its value. not the string itself

i.e

int $srcCount = 2 ;
string $dst = "src"
print("$" + $dst + "Count")

this prints out "$srcCount". which means it is assembling the variable correctly, but instead of printing its value, its printing the word.

eg if i were to simply type "print($srcCount)" it would print out its value of 2 which it was initialised at.

does anyone know of the way of making maya output the assembled variable names value. so the previous three lines of code would print "2"?

thanks

# 2 09-12-2006 , 01:30 PM
HelioAraujo's Avatar
Subscriber
Join Date: Aug 2006
Posts: 2
Try this:

int $srcCount = 2;
string $dst = "src";
eval( "print $" + $dst + "Count" );

Regards,
Helio

# 3 09-12-2006 , 01:46 PM
Registered User
Join Date: Dec 2006
Posts: 3
thanks that works. but i cant quite impliment it correctly

heres the line

setAttr ("pCylinder" + $n + ".translateY") (eval("$" + $dst + "Count"));

doesnt work without the brackets either btw

setAttr ("pCylinder" + $n + ".translateY") eval("$" + $dst + "Count");


its the last part in brackets that needs to be evaluated but i dont know enough about the command to make it work. from what ive read that should work i think. any help much appreciated. thanks


Last edited by deaniopo; 09-12-2006 at 01:53 PM.
# 4 09-12-2006 , 01:54 PM
HelioAraujo's Avatar
Subscriber
Join Date: Aug 2006
Posts: 2
Try this:

int $srcCount = 2;
string $dst = "src";
int $n = 1;
int $x = eval( "print $" + $dst + "Count" );
setAttr( "pCylinder" + $n + ".translateY" ) $x;


Regards,
Helio

# 5 09-12-2006 , 01:59 PM
Registered User
Join Date: Dec 2006
Posts: 3
this worked. thanks a million

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