getAttr makes me nuts!



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 :frowning:


Hi chips__ ,

try this:

float $old_xpos = getAttr -t 100 nurbsCylinder1.translateX;

you have to use backticks “`” (ALT+096) instead of " ’ ".




YOU THE MAN!!! thanks Marco


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…

– Mark


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 :slight_smile:
i think i need to go get your book :smiley:


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.

– Mark


I know. But seriously, i need to learn :slight_smile: 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 :slight_smile:


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…

– Mark


well, i’m about halfway through it… i guess it’s a good idea :slight_smile:


yo’ Mark-

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??



i don’t know, I haven’t had great results with it either, but sometimes it does work…

– Mark


Haha! is that was computing has come to … but sometimes it works … hehehe :smiley:


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.