Page 1 of 1

Utility Script Question

Posted: Fri Jul 04, 2014 1:45 pm
by dkwroot
I understand Tools, Menus and Embedded scripts, but I've been having a very difficult time finding information regarding utility scripts. My understanding is that utility scripts are loaded as soon as Anime Studio is booted up and they appear to have information about animation channels. My current understanding is that we can declare functions within these utility scripts and then execute those functions from embedded scripts, is this correct?

Has anyone figured out if these utilities can be used to avoid having to use embedded scripts all together? In other words, have the utility check for the currently selected layer type and then interact with tools and menu scripts directly instead of having to hassle with embedded scripts. I would really like to have a custom keyframe channel for my sequencer WITHOUT having to embed on every image layer... :|

Re: Utility Script Question

Posted: Fri Jul 04, 2014 4:05 pm
by synthsin75
Utility scripts are no substitute for layerscripts. Only layerscripts run automatically for each frame, allowing us to change things that are not natively animatable. Utilities are just a place to locate functions that are used a lot and/or by many different scripts. It saves on having, say, the same 20 line function repeated multiple time in the same script, and allows the code to be maintained from a single function. If the next Lua version changes something, you'd only need to update the one function instead of many over several scripts.

Re: Utility Script Question

Posted: Sun Jul 06, 2014 3:43 am
by dkwroot
Thanks Syn, it's unfortunate that this is the case, but oh well... I really hope they add support for automatic layer script loading in the future.

Re: Utility Script Question

Posted: Sun Jul 06, 2014 5:49 am
by synthsin75
Automatic layerscript loading? I didn't see you mention that before. Sure you can do that. We can embed scripts by script now, and I have a trick to automatically execute code on startup.

Re: Utility Script Question

Posted: Sun Jul 06, 2014 4:20 pm
by dkwroot
I'm guessing that you put a 'loader' script into a group layer at the top of the pile and then it goes through and embeds scripts to lower layers?

Re: Utility Script Question

Posted: Sun Jul 06, 2014 8:28 pm
by synthsin75
Having to embed a script wouldn't automatically load one on startup, unless you embed a custom startup file, in which case, you'd just embed the scripts you want in that startup file. I use the IsEnabled function of my auto-save tool to execute code on startup, as that function in tools is evaluated on startup, while the same function in menu scripts isn't evaluated until you select the scripts menu.

You just need to know the unique name of the layer you want to embed.

Re: Utility Script Question

Posted: Sun Jul 06, 2014 10:07 pm
by dkwroot
That's really clever! I'll trying doing that and see how it goes. Thanks. :D