View Full Version : getAttr makes me nuts!
06 June 2003, 02:19 PM
PLEEEAAASSEEEEE HELPPPPP MEEEEEE
i have a problem in an expression i'm writing. I need a variable like this
float $old_xpos = 'getAttr -t 100 nurbsCylinder1.translateX';
it keeps failing!
it just gives me a syntax error :(
06 June 2003, 03:51 PM
Hi chips__ ,
float $old_xpos = `getAttr -t 100 nurbsCylinder1.translateX`;
you have to use backticks "`" (ALT+096) instead of " ' ".
06 June 2003, 04:08 PM
YOU THE MAN!!!! thanks Marco
06 June 2003, 07:16 PM
Note that you can use the frameCache node to do this without embedding a getAttr in your expression, though as of 4.5 it was still somewhat buggy. Depending on how your DG is set up, doing a getAttr like that can be very cheap or very very expensive.
(For example, if you constrain the object whose attribute you're getting to a point on a deforming surface, Maya will have to calculate everything upstream from that surface for the previous frame. In the worst case, this can nearly double - or worse! - your execution times per frame.)
Be careful out there...
06 June 2003, 07:28 PM
that's a really good idea! the stuff i'm doing is very simple, so it doesn't matter that much. but i know i should learn to code niceli though :)
i think i need to go get your book :D
06 June 2003, 07:34 PM
btw I don't mean to say that doing what you're doing isn't the best way to go -- just that it can be dangerous if you don't carefully think through what Maya will have to calculate to get what you're asking it to get for you.
Also, the expression may or may not recalculate correctly depending on its other inputs... worry about this as it happens.
06 June 2003, 09:13 AM
I know. But seriously, i need to learn :) i've only used MEL for about five days now, while doing regular production, so i have alot to learn:surprised
Just picked up your book (company billing rocks!! hehe), it looks really good! I just have to finish David Goulds first, then on to yours :)
06 June 2003, 10:11 AM
I just have to finish David Goulds first, then on to yours
Since David's book is a lot more rough for beginners, you might consider setting it aside and coming back to it later...
06 June 2003, 12:18 PM
well, i'm about halfway through it... i guess it's a good idea :)
06 June 2003, 11:23 AM
what's up with this frameCache node anyway?!... last time I played around with it, it was giving some crazy strange results, so i abandoned using it alltogether :annoyed:
Any improvements in Maya 5 with this??
06 June 2003, 11:48 AM
i don't know, I haven't had great results with it either, but sometimes it does work...
06 June 2003, 12:15 PM
Haha! is that was computing has come to .... but sometimes it works ... hehehe :D
01 January 2006, 10:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.