hello, I am admittedly a mel newbie, and this one is dogging me-
I am creating an expression to get the closest point on a surface to deliver the color of that point to an object- I need to do this over a large array of objects and thus need to create a new closest point on surface node and evaluate it with a separate expression for each object in the array
but I can't figure out how to pass values from these closest point on surface nodes to an expression
I am getting the value of the current CPS node thusly:
string $CurrentCPS = rename CPSTemp JTCPS;
then I have something like this (a truncated version)
Well, aside for the fact thatyour expression is bad form the solution looks like this.
That said the eval is not going to work, the reason is that eval evaluates a mel command! but your syntax offcourse is Expression syntax, they dont intermix, expression eingene can evalueate mel but not the other way around. In general the two things should be considered seperate anyway.
Idea is that maya does not interpret variables inside strings like for instance perl does. Neither do expressions eavaluate expression strings at runtime so you cant have a variable inside a expression call to loop trough a a list for example, youd need to use getAttr wich is a bad thing for speed purposes.
instead you need to parse a new string
in your case
("float $u = "+ $CurrentCPS +".parameterU;")
And pass this solved string on! So the final mel for a expression would look something like this: