PDA

View Full Version : how do i store getAttr when I don't know return value in advance?


tredeger
11-17-2006, 04:41 AM
Hi all,

So I am trying to write a generalized procedure in MEL that will end up keying a bunch of attrs all at once. The problem is that I want to be able to key the attrs at times other than the current frame. Easy enough with the -time flag. But I want the attr to be keyed with the value that it has *at that time*. The problem is that the default value to which to set the key is the value at the current frame (which of course makes sense). And I can override that value with the -value flag.

Now here's the rub: I'll have to specify the value with a variable. I'll have to get the value using getAttr with the -time flag. But since I want to use this in a general way, I won't always know the return value in advance. Sometimes it might be a double, sometimes a double3 or an int. What approach would you take to the variable scheme is this situation? Thanks in advance and

cheers,
j

Allpeace
11-17-2006, 01:08 PM
How about storing the return value in a string, and later do some tests to find out the type?

pgraham
11-17-2006, 06:38 PM
You can get the type from getAttr and store it in a string. Then you can add an extra attr of the same type and store the value there. addAttr and setAttr both take the type string.

Robert Bateman
11-19-2006, 03:05 PM
use the -type flag with getAttr to get it's type before querying the data and setting a key.

CGTalk Moderation
11-19-2006, 03:05 PM
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.