PDA

View Full Version : Expressions: alternate for `getAttr -t...` ??


prettyh8machine
01-07-2004, 08:32 AM
Hi,
For a given object under a certrain group (e.g. Group1|object), I want to write an expression that needs to access the object's value on a certain frame. Im writing,

... = ` getAttr -t $previousTime $objectName`;

The prob is that getAttr shouldnt be used and it IS causing problems. Is there any alternative method to get an attributes value on a given time without using this command (instead accessing the object's attribute directly as should be used in expressions).

Secondly, since I dont know an alternative, when using getAttr, the $objectName should be Group1|object. That's fine but when I duplicate the objects (I need to do that), the new object's name is now Group2|object. So now the expression should have some mechanism to insert this name instead of using simple object.attribute format. I tried this:

getAttr $previousTime ".attribute";

and apparently it worked. But then again while playback, it starts giving error as it cant resolve the object to which .attribute is associated. Is there any way for the expression to find out whose object it (the expression) belongs to while running ?

Remember im doing all this thru a MEL script so I dont wanna edit each duplicated object's script manually.

Please help me.
Thanks

thematt
01-07-2004, 12:43 PM
yes there's another way the framecache node

it works with a bit of mel something like

$cache = `createNode frameCache`;
connectAttr myObject.ty ($cache + ".stream");
connectAttr ($cache + ".past[1]") myObject2.ty;

Ok hope that help

cheers

thematt
01-07-2004, 12:49 PM
$cache = `createNode frameCache`;
connectAttr myObject.ty ($cache + ".stream");
connectAttr ($cache + ".past[1]") myObject2.ty;


Sorry didn't explain..actually there is two attribute you can connect it to on the stream which are past[] and future[].

The number in the array is the number of frame so in the Exemple behind past[1] mean (you'll had understand I'm sure)..get the value of Myobject at 1 frame before.

Ok hope that's helpfull

thematt
01-07-2004, 12:52 PM
Damn sorry didn't read your post entierly mm hope you don't take it wrong, It's the only alternative I know and maybe it help you out anyway.

cheers

CGTalk Moderation
01-17-2006, 02: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.