PDA

View Full Version : keyTangent / keyframe commands; querying info


trancor
07-03-2008, 03:44 AM
Hey, I've been running into some issues with querying pretty much any information from keyframes. You can't query based on time, based on the keyframe id or what ever because the queries only return float[] values.

So is there a way to find out the specific index on a key? This is the only way I can think to find anything I need, when I have the index I can just use that element from the float[] that I get from the keyframe and keyTangent commands.

I came up with a way to do it, but it's such a round-about insane way to do something that should be so simple. (I haven't written it but) starting from 0, having a script count every frame using the findKeyframe command. By checking what time the frame is at and if it's not within the range I need to keep going on to the next frame. This would suck for script run time if I have a huge animation and alot of keys per attribute.

How do you find out a keyframe's index or can I find a keyframe's tangent angle or tangent weight by the time of the frame somehow?

NaughtyNathan
07-03-2008, 09:54 AM
hmm.. I'm a bit confused by your question(s) as it seems pretty straight forward to me...

you have some keys selected? you wan't their indexes?

int $keyIds[] = `keyframe -sl -q -iv`;

you have a time in mind (e.g. frame 12) and you want to find the key index at that time..?

int $keyIds[] = `keyframe -t 12 -q -iv myObject.tx`;

you want the in/out tangent value at a given frame/time (e.g. frame 12)?

float $angle[] = `keyTangent -t 12 -q -ia myObject.tx`;

is this the kind of thing you're after or have I misunderstood... I seem to remember the whole keyframe thing and the command syntax a bit confusing when I first looked into it myself...

:nathaN

trancor
07-03-2008, 02:53 PM
ohh.... oh kay...... sooo...... why does this work

keyframe -t 12 -q -iv pSphere1.tx

but this doesn't

keyframe -q -t 12 -iv pSphere1.tx


because that was my problem.


And thanks, because I had no clue the -t needed to be before -q (for some reason)

NaughtyNathan
07-03-2008, 03:35 PM
yeah.. that does seem dumb, and doesn't really seem to fit the general syntax of other MEL commands does it...?

I guess it's just because most MEL commands don't have to be given an input value before a different property can be queried... and as you're NOT querying the time, and "-q -t" is effectively saying "query time", it's not expecting a "12" immediately after and it gets syntaxically confused...

:nathaN

trancor
07-03-2008, 04:15 PM
Dumb indeed, also seeing how the -time tag can't even be querried in those commands.

But I got everything working now, so thanks again.

CGTalk Moderation
07-03-2008, 04:15 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.