How do I get the action at a particular frame

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
Dodgy
Posts: 207
Joined: Sat Jan 13, 2007 8:01 pm
Location: Sydney
Contact:

How do I get the action at a particular frame

Post by Dodgy »

Hi all,

I'd like to be able to find out what action is used at a particular frame. Does anyone have any idea how to get this info? I've found the

layer:InsertAction(name, frame, byReference)

method, but no way of retrieving the value once it's set.

Regards,
Mike
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

No. Actions are "key frame interpolation values" or they are just ordinary key frames. If you insert a reference to an action that is a type of "key frame interpolation" (like smooth, linear, step, etc) and there is no way to get key frame interpolation using the script interface. Even if you could there is no access to what action is used either. If the action is inserted as a copy they are just regular key frames and no longer have any connection to the action that was inserted.

The only way to check for an action reference is through parsing the entire file format... I haven't quite got the hang of that yet myself.

-vern
Dodgy
Posts: 207
Joined: Sat Jan 13, 2007 8:01 pm
Location: Sydney
Contact:

Post by Dodgy »

Bum, I thought that might be the case. I think I've figured out a way to do what I wanted without mass replacing actions though :)

Thanks Vern.
User avatar
synthsin75
Posts: 10280
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

Actually, I've been parsing the file format more recently. I think it would be possible to find out what action/s are used at what keyframes. Referenced actions are the easiest to find, but copied actions are quite a bit harder. But it could be done.

There is a sort of 'ghosting' of old keyframe values where the referenced ones are in the format. They also break the rules, so to speak. Took me a little bit to sort that out.

Let me know if you end up needing it for referenced action only, as I could probably writing that up pretty easy. Granted any file parsing relies on the state of the saved file.

:wink:
Post Reply