Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / eval() in expression?
  RSS 2.0 ATOM  

eval() in expression?
Rate this thread
 
62514
 
Permlink of this thread  
avatar
  • Total Posts: 11
  • Joined: 14 August 2011 04:29 PM

I would like to copy attributes of the fluidEmiter1 to fluidEmitter2, fluidEmitter3 ....
but I don’t know how to use eval in expression.
please help!

for ( $i =2$i<6$i ++ ){

eval(
"fluidEmitter" $i).fluidDensityEmission fluidEmitter1.fluidDensityEmission;
}

thanks.



Replies: 0
avatar

this code seems to be working,

for ( $i =2$i<6$i ++ ){
eval(
"fluidEmitter" $i +".fluidDensityEmission = fluidEmitter1.fluidDensityEmission");

}

but now i get this error
Error: Invalid use of Maya object “fluidEmitter1.fluidDensityEmission”.

please help.



Replies: 0
avatar

I think what you need is not eval but getAttr and setAttr. Try this:

setAttr ("fluidEmitter" $i +".fluidDensityEmission") (getAttr("fluidEmitter1.fluidDensityEmission"));

Statements like you had before, without eval, would attempt to make a connection when used in the expression editor, which I don’t think would work anyway because they are both inputs. And outside the expression editor, it is not an acceptable MEL statement. If you want to actually connect nodes, use connectAttr.

<* Wes *>



Replies: 0