Switch layer tool that uses key commands to add keys

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

madrobot wrote:And I have a question - would it be possible to do something similar with actions? So if you were rigged with actions for your phonemes you could use a similar method in lipsyncing?
Hmm... interesting. Have to look into it. Actions are accessible with scripts. I know to that scripting has all the features of actions available as well, insert copy, insert reference etc.

I think this could be done. it would require a special "action" tool of course.
------------
On another topic,

I can use more than the number keys but I am using the value of the "key" pressed (ascii code) as an increment for selecting the switch. The trouble with the stupid ascii codes and the keyboard... they aren't in the same order. A-Z are in numerical ascii order, but they aren't on the key board... have to hunt around. I like things in order. ;)

Plus, I have to watch out for other commands! I really messed up my computer when I used the stupid shift key for the modifer. Kept doing screen captures pressing CMD-SHIFT-3. ;)

There is no way to have two modifier keys press at the same time as far as I can tell. AS sees the second modifier as the key being pressed instead o the THIRD key that is pressed. Only CTRL and ALT work as modifiers and they have to be "swapped" on mac/win because they don't work the same.

I check for both CTRL and ALT being "true" and then continue on. If you are on a mac CTRL is CMD and it works. If you are on Windows, ALT is ALT and it works. The mac ignores ALT in AS for some reason. Very confusing.

-vern
User avatar
mkelley
Posts: 1647
Joined: Fri Nov 02, 2007 5:29 pm
Location: Sunny Florida
Contact:

Post by mkelley »

Yes, I second the motion to have actions accessible by keystrokes. That would actually be much more useful to me than the switch layers.

(Wes, I'll look at those tools -- I'm actually at a breathing space now and need to reevaluate my workflow in general for the next show, so this would be a good time to see if they can improve anything for me. I'm trying as much as possible not to take my right hand off the mouse, and my left hand off the shuttle pro).
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Well I spoke too soon.

There doesn't seem to be any way to access a list of actions in the file through the script interface.

You can check if you are in an action. You can activate an action (if you already know the name). You can insert an action into the current timeline (if you already know the name... see a pattern here?). But no "list" of actions. If you activate an action and it doesn't exist it creates one.

There isn't a way to get the names of all the actions of a document... unless I'm missing something.

The only other option would be to read the file format and parse the file for the action names. If it's a big file this could slow things down. I don't like that. Reading the file while it's open? Makes me nervous... like picking yourself up by your own bootstraps.

Have to wait till Mike adds some more scripting functions.

-vern
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Action key commands could work if you knew the names of the actions ahead of time.

So if this was for lipsync phonemes with specific names then it could be "hard coded" into the tool script. If the actions weren't there it wouldn't work... or at worst it would create a bunch of empty actions. Haven't tested it.

-vern
User avatar
madrobot
Posts: 667
Joined: Mon Apr 07, 2008 3:07 pm

Post by madrobot »

Thanks for giving it your consideration Vern.

I understand the limitations you are talking about.
When you say that "Action key commands could work if you knew the names of the actions ahead of time." - that to me is a ray of hope.

I guess this would only really be practical if you were to establish a set of default phonemes. Fortunately we're not the first to give this some thought :)

A solid "generic" "default" phoneme list is the Preston Blair (basic) phoneme series

But personally I reckon if you're going to do it why not do it properly and give yourself some leeway with the Extended Preston Blair phoneme series.

So for example you could have (from the extended series):

"Command"+ key = Phoneme

A = A I
E = E
O = O
U = U
C = C D G K N R S Y Z
H = C D G K N R S Y Z*
F = FV
T = Th
L = L
M = MBP
W = WQ
R = Rest


* Basically "Ch", "Sh", the "harder" version of that phoneme, see the link for more details

I reckon that in terms of lip syncing with actions, this would be an awesome workflow tool. You could use the hotkeys to sync at a reasonable pace I think.

What do you think?
Cheers
Adrian
User avatar
mkelley
Posts: 1647
Joined: Fri Nov 02, 2007 5:29 pm
Location: Sunny Florida
Contact:

Post by mkelley »

Vern,

Even if you had to know the action names ahead of time (hard coded in your script) that would be an extremely useful script for me to have. If nothing more I could alter it myself for my default list of actions.

I have a set of eye actions (have to be actions and not switches since they control both the upper and lower lids as well as eyelashes) that if I could call via a key press would speed up my work flow greatly. I wouldn't expect anyone to hard code my own names, but if I had a template I could do it myself.

I need to sit down and really decide what is useful in terms of pressing a button, but the more options the better.
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I haven't tested it at all but from what I gather, you could have this list of any size of pre determined actions. If you "activate" one that isn't there then nothing would happen.

You would only see a result if the action existed.

Another possibility which is very doable, would be a tiny small simple text file that could be "read in" that would have a USER defined list of actions. This would just be a simple text file with the name of the action in quotes on each line.

Possibly a user defined "key" could be added separated by by a comma, although that may be trouble if you used a key command that conflicted with something in AS or even the OS. AS just blocks certain keys or it activates it AND does the user defined thing. I kept doing preview renders by mistake during testing of this switch tool script (f5) when I tried using f keys... which didn't work so well. If I used f5, I got an animation preview, CMD/CTRL+f5 reloads all the scripted tools in AS so it is blocked.

------

Want to hear something ironic? Something funny? I created this script to speed up lip sync done by hand. It was still taking WAY too long. So I did my lip sync with Papagayo on the PC in a fraction of the time (Papagayo is useless on my Mac... so freaking slow). The time it took to do just one sentence by hand in AS I did a full 30 seconds in Papagayo.

Still, a useful script. ;)

-vern
User avatar
madrobot
Posts: 667
Joined: Mon Apr 07, 2008 3:07 pm

Post by madrobot »

That sounds awesome

The user defined list would be fantastic. Really good. Flexible, and you can use it as much or as little as appropriate.

There was an AnimeStudio hotkeys document I printed and set aside ready for laminating - it's since fallen into my "filing system", which is like an archeological dig on my desk :oops:

Anyway that list has most of the AS keys, so people shouldn't have too much trouble working out what keys are out-of-bounds for their action lists.

I hear what you're saying about lipsync workflow, and while I found Papagayo didn't give the very good results and was timeconsuming your milage is probably going to vary depending on what you're comfortable with.

I love the idea of having hot-keyable switch AND action phonemes available as options for lipsync, and imagine for lipsyncing I'd end up printing out a list to run down the side of my monitor. (Something like this http://minyos.its.rmit.edu.au/aim/a_not ... es_02.html)

It wouldn't take long to get into the rythym of hotkeyed lipsync I reckon.

Switch does the job but actions would be cool I think. Hotkeying doesnt mean you're not going to have to go back in later to drop in some mid point morphs and adjust easing, but the results could be pretty cool.

Sorry, I'm rambling.

Thanks again Vern
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Actually the key commands for AS are SINGLE keys. Press one letter or number.

In the scripting interface you have the option of using modifier keys (CTRL, ALT, SHIFT). We also have access to the fkeys which is really good. Some of those would be off limits depending on the system. I know that Mac uses f1 and f2 for copy/paste although I never ever used that in my 15-20 years of mac usage (how long has mac been around?). The f5 key is blocked for use by AS of course.

So this means you have f3-f4, f6-f12, plus adding alt/cmd to those doubles them and you have cmd/alt+0-9.

Each tool can use those keys for it's own purposes... I hope so anyway. Would need to test it.

This "Action Command" script should be very light weight. There are only two things needed, the name of the action, and the key frame to insert it at (the frame you are on most likely).

One other thing would be a check box on screen for the tool itself (at the top). this would be for inserting a reference or a copy of the action. Maybe a button of some sort to "reload" the key list if you make changes to it.

---------------

I keep saying it, and I will never stop saying it... if Mike put in more script access and the ability to store small scripts IN the AS file format, we could reinvent AS. We could make it do nearly anything exactly the way we want it to. You could design your own interface. You could have scripted animation to rival Flash... and I mean seriously RIVAL Flash. Lua is as robust a language as Actionscript. My physics animation experiments is proof of that.

I can imagine an open source "AS Player" that can display and run AS files with lua scripting support. Or possibly, convert lua script in an AS file directly to Actionscript for SWF export... but that's just crazy hard and probably not practical... not impossible... just hard. I've been able to convert Actionscript to lua script about 90% of the way using a series of regex search and replace commands in a text editor. The rest I have to do by hand but I'm not even a "real" programmer. Imagine someone with actual skills doing this.

Dear GOD why didn''t I pay more attention in math class??!?!? ;)

-vern
rogermate
Posts: 296
Joined: Mon Jun 02, 2008 5:53 am
Location: Mars

Post by rogermate »

Hi mkelley,
Do you think you might share your Shuttle Pro key mappings overall?
I'm still learning AS but already had the shuttle.

- Roger
mkelley wrote:That's okay, Vern --your heart is in the right place.

I really wish it did work for us Window users. I have a Shuttle Pro and I was envisioning adding the commands to the buttons (I already have a "key all" as well as "Key various thingees" assigned that make it super fast to animate -- but I do have to do the right click number when working with switch layers, which I do A LOT!

Sigh.
User avatar
mkelley
Posts: 1647
Joined: Fri Nov 02, 2007 5:29 pm
Location: Sunny Florida
Contact:

Post by mkelley »

You're asking me how *I* set mine up, right? Because there are lots of ways to do it depending on how you work.

For me the top row (reading left to right) is:
(unassigned), Control-Z (undo), Z (Manipulate Bones), S (size)

Second row of five buttons is:

Play even from the start of the file (I use a macro for this, control right arrow and then space), space (to start and stop), Control-A (select all), R (rotate), T (translate)

Then my far left button (aside the shuttle) is set currently for Shift+Left arrow, but I'm going to try and reassign that for the bone layer macro (to return you to the bone or master group layer for that object). The far right button is my key-all trigger -- it runs my key all script which will place all keys down for bones or vector objects (or layers) depending on what type of layer is currently active.

That's about it -- I have the shuttle assigned to right arrow so I can step through the animation, but in practice I find I use the mouse instead. But with my hand on the shuttle I can instantly key all, or select rotation, translation or size keying as well as play through. (note that all such keys are arranged in the four keys on the right top, so it's easy to select with the index and middle fingers whatever manipulation you want to do, and then use your thumb to key down below to "hold" whatever point of the animation you need to hold). The mouse is purely to move on the timeline and select layers -- but I'm hoping to even cut down the layer selection (so with my little finger I can easily jump back up to the master bone layer). I also may try using the two bottom keys (presently unassigned) for layer jumping and manipulation, but we'll see -- I've been script writing and am just now returning to animation).


It works for me and probably speeds up my animation about 100%
rogermate
Posts: 296
Joined: Mon Jun 02, 2008 5:53 am
Location: Mars

Post by rogermate »

Cool, thanks for sharing.


mkelley wrote:You're asking me how *I* set mine up, right? Because there are lots of ways to do it depending on how you work.

For me the top row (reading left to right) is:
(unassigned), Control-Z (undo), Z (Manipulate Bones), S (size)

Second row of five buttons is:

Play even from the start of the file (I use a macro for this, control right arrow and then space), space (to start and stop), Control-A (select all), R (rotate), T (translate)

Then my far left button (aside the shuttle) is set currently for Shift+Left arrow, but I'm going to try and reassign that for the bone layer macro (to return you to the bone or master group layer for that object). The far right button is my key-all trigger -- it runs my key all script which will place all keys down for bones or vector objects (or layers) depending on what type of layer is currently active.

That's about it -- I have the shuttle assigned to right arrow so I can step through the animation, but in practice I find I use the mouse instead. But with my hand on the shuttle I can instantly key all, or select rotation, translation or size keying as well as play through. (note that all such keys are arranged in the four keys on the right top, so it's easy to select with the index and middle fingers whatever manipulation you want to do, and then use your thumb to key down below to "hold" whatever point of the animation you need to hold). The mouse is purely to move on the timeline and select layers -- but I'm hoping to even cut down the layer selection (so with my little finger I can easily jump back up to the master bone layer). I also may try using the two bottom keys (presently unassigned) for layer jumping and manipulation, but we'll see -- I've been script writing and am just now returning to animation).


It works for me and probably speeds up my animation about 100%
tinnycan
Posts: 28
Joined: Mon Nov 13, 2006 5:46 pm

Post by tinnycan »

Is it possible to get this script updated for 6.1? This would be a life saver (currently getting errors)
Post Reply