how can I get at the timeline for an action from LUA

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

how can I get at the timeline for an action from LUA

Post by hayasidist »

what I want to do is, from a script, find out what items (points, bones ...) are being manipulated in an action.

Put another way, if I look at, say, the position animation channels of all the points in a mesh, I can see which ones are being moved.
(e.g. using if mesh:Point(j).fAnimPos:CountKeys() > 1 ...)

and the same code gives me the point motion keys in the action if I have the action timeline on screen.

What I can't figure out is how to access the animation channels in the timeline in an action without having the action timeline active in the workspace -- IOW doc:SetCurrentDocAction("action name") doesn't seem to work as I'd hoped?

Any one got any advice please?
Stan
Posts: 199
Joined: Sun Apr 19, 2009 3:22 pm

Re: how can I get at the timeline for an action from LUA

Post by Stan »

I think actions are layer-specific, so what you need to do is probably use the moho.layer:ActivateAction("myAction") method, then do your point stuff, and then deactivate the action using moho.layer:ActivateAction(nil).

http://aslua.com/index.php?show=method& ... ion&id=562
________________________________________________________________________
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: how can I get at the timeline for an action from LUA

Post by hayasidist »

Thanks Stan. that's it!!

===
and ... since it may help us update ASLua.com --
> for the record: smartbone layers are returned in the child layers of a bone layer but with a zero duration (non-zero duration in the bone layer itself) along with any layer-specific actions.
> and .. any idea what MohoDoc:SetCurrentDocAction and MohoDoc:CurrentDocAction actually do??
Post Reply