i have a script request! (Poses)

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Rudiger
Posts: 786
Joined: Sun Dec 18, 2005 2:25 am

Post by Rudiger »

Since you offered, Genete... :D

I'm on the verge of releasing a version of my morph dials scripts, now with similar pose array support, and I was looking at this script to see if there were any optimizations I should consider adding. My script tends to bloat out the memory that AnimeStudio uses, so I was interested in adding some calls to Lua's collectgarbage function. Unfortunately, the syntax for this function seems to have changed from Lua 5.0 to 5.1, so your poses script doesn't currently work with ASP v6.0.
Lua 5.0 Manual wrote:collectgarbage ([limit])

Sets the garbage-collection threshold to the given limit (in Kbytes) and checks it against the byte counter. If the new threshold is smaller than the byte counter, then Lua immediately runs the garbage collector (see 2.9). If limit is absent, it defaults to zero (thus forcing a garbage-collection cycle).
Lua 5.1 Manual wrote:collectgarbage (opt [, arg])

This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt:

* "stop": stops the garbage collector.
* "restart": restarts the garbage collector.
* "collect": performs a full garbage-collection cycle.
* "count": returns the total memory in use by Lua (in Kbytes).
* "step": performs a garbage-collection step. The step "size" is controlled by arg (larger values mean more steps) in a non-specified way. If you want to control the step size you must experimentally tune the value of arg. Returns true if the step finished a collection cycle.
* "setpause": sets arg as the new value for the pause of the collector (see §2.10). Returns the previous value for pause.
* "setstepmul": sets arg as the new value for the step multiplier of the collector (see §2.10). Returns the previous value for step.
So I was wondering if you, or Tim knew how to replicate the old functionality with this new syntax.

Thanks in advance
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

So I was wondering if you, or Tim knew how to replicate the old functionality with this new syntax.
Maybe use:

collectgarbage ("step", arg)

in all places where it is used in the old script and start with arg =10.

I have not more lua knowledge or experience that the reading of the scripts and some reading of the lua manual. :)

-G
Mylenthes
Posts: 44
Joined: Mon Jan 25, 2010 3:32 am
Contact:

Post by Mylenthes »

I know this is an old topic but the new script doesnt work and the first script messes up the original bone like i cant move the main bone to move the eyes any more.
-Mylen i pwn
Post Reply