Layer Script Question

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
teotoon
Posts: 135
Joined: Wed Aug 04, 2004 7:19 am
Location: Turkey

Layer Script Question

Post by teotoon »

Are layer scripts animatable? I mean, can I temporarily turn on/off these scripts during the animation?
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

You could have a table in the script that keeps track of when you want the script working or not at particular frames, and then put the rest of the script in a if/then block and test if it should be working for that particular frame. If you kept the on off data in something akin to a switch data file, persistence along with the project would be easy enough. If there was a way to get the path to the project file in Lua (Hey Mike! Please please please!) it would be cake.

Probably, what I would do is make a little Button type tool script to set the table and toggle the script on and off for particular frames. If each layer with the script was named uniquely, you could have the Button script build a little bit of code assigning a global variable for the table based on the layer name, and then execute that. If the embedded script has a similar bit of code to find the variable name it's looking for, it should be nice and neat.

If that's confusing, I'm sure I can find a few minutes to whip up an example.
teotoon
Posts: 135
Joined: Wed Aug 04, 2004 7:19 am
Location: Turkey

Post by teotoon »

Dear 7Feet,

Thank you for your reply. As for the second solution, I think I understood what you have written and this is a brilliant idea, but I am not sure if I can realize it. If you can post the button you have mentioned, this would make many people's job easier with layer scripts...

As for the first solution, if you can post the example, at least, I can try by myself.

Thank you again...
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

No problem. I'm moving, and finishing off my packing at the moment, so it may take a few days. But take a look at one of the existing Button tools, like the Smooth tool, or the Layer Flipping ones. They don't have any user interface stuff, as they just do something when you click on 'em, so they're pretty simple. The one slightly unusual thing about them is they have to be specified in the tool_list.txt file or they won't show up in the tool window.
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

Post by Fazek »

Because a switch layer can contain any strings in the keys, perhaps you can use a switch layer to "program" your layerscript. Maybe you can make commands even with arguments (like: "move 100,100") as strings. In this case, you can use all of the built-in key editing functions of the program.
- - - Fazek
Post Reply