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: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

Post Reply
hayasidist
Posts: 2122
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 » Thu Feb 18, 2016 4:24 pm

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: 121
Joined: Sun Apr 19, 2009 3:22 pm
Contact:

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

Post by Stan » Thu Feb 18, 2016 4:48 pm

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
________________________________________________________________________
http://mohoscripting.com/ - Unofficial Moho (Anime Studio) Lua Scripting Documentation
http://2danimator.ru/ - Russian Anime Studio Forum
hayasidist
Posts: 2122
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 » Thu Feb 18, 2016 5:25 pm

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