Page 1 of 2

Roll drawings macro

Posted: 28 Feb 2009, 00:10
by tigerknight
Hi all,

I'm still transitioning from traditional pencil-on-paper animation to TVPA. One thing that bugged me was that I did not have an easy way to 'roll' my drawings. For a while, I held down the right-mouse-button (on the stylus) and dragged across the timeline to 'roll'... but that was using my drawing hand. I wanted my non-drawing-hand to do this. Instead of purchasing a PowerMate or ShuttlePro, I decided to see if my (somewhat primitive) programming skills can tackle the problem first. The result is this macro 'roll.ahk'.

Very simply, the macro allows me to hold down a keyboard key to 'roll' back or forward a number of drawings. When I release the key, it 'snaps' back to the original drawing.

Code: Select all

+--------+--------+--------+--------+
| Q      | W      | E      | R      |
| roll   | roll   | roll   | roll   |
| <<-- 2 | <- 1   | 1 ->   | 2 -->> |
+--------+--------+--------+--------+
| A      | S      | D      | F      |
| prev   | prev   | next   | next   |
| cell   | frame  | frame  | cell   |
+--------+--------+--------+--------+
I'm right-handed, so I assigned the left keys on the keyboard. On a QWERTY keyboard, that's QWER. I'm actually on a Dvorak keyboard so it's ',.P. Anyway, you will probably need to modify the macro to your needs because everyone assigns keyboard shortcuts differently.

How to get this to work:
1. You must have AutoHotkey installed. It's Windows only, sorry Mac users :(
2. You also need the Instance Panel.
3. Download the 'roll.ahk' file and save it somewhere. In TVPA's directory, on your desktop, whatever.
4. You must assign the following shortcut keys in TVPA (I've put my example in brackets):
- Instance panel: PrevCel [A]
- Instance panel: NextCel [F]
5. Make sure [Q] [W] [E] [R] are not assigned in TVPA.
6. Open 'roll.ahk' in Notepad (it's a text file) and edit the sections (they have been commented for guidance):
- If you're using TVPA 8, remove the first ; from the line 6 and add a ; in front of line 7.
- You can set a custom flip speed on line 10. It's in milliseconds... so if you want to flip at 12 fps, then type in 83 (1000/12). Otherwise, default is 10 fps.
- For lines 13-37, enter your custom shortcut keys here, in case they're different from mine. Lines that have 'hotkey' refer to [Q] [W] [E] [R], PrevCel and NextCel are [A] and [F] respectively.
7. Save, then exit Notepad.
8. Double-click on the 'roll.ahk' file. Assuming you have set up AutoHotkey and associated .ahk files with it, it will run. It will put a green 'H' icon in the system tray. (You can stop the macro by right-clicking on this icon and selecting Exit.)
9. Start TVPA. Make some drawings... and try out the keys. Hold down [Q]... and it rolls back 2 drawings. You can even draw on the frame while it's held down! Release [Q]... and boing! it snaps back to your original frame. Want to roll forward 3 drawings? Hold down [E] and then [R] together!

Note -- I've only tested this on TVPA Standard 8.6.4 and 9.0.5 on WinXP Pro SP3 English. I'm not sure if it'll work on TVPA Pro because it may have a different 'ahk_class' name.

Disclaimer -- this macro is quite rough around the edges. There's no error-catching, GUI, kitchen sink, etc., and I won't be held responsible if it breaks your stuff, yadda yadda yadda. I made it for my own use and am releasing it in case anyone else finds it useful. If you can improve the macro, please share it in this thread!

Cheers! 8)

Re: Roll drawings macro

Posted: 28 Feb 2009, 02:08
by Paul Fierlinger
I use the Flip button on the Project panel. In case you haven't noticed , in the Preview Settings Panel you can set the length of the flipping to your current need.

Re: Roll drawings macro

Posted: 28 Feb 2009, 02:28
by tigerknight
Yes, but it's a different function.. not what I was looking for. With the 'flip book', the animation plays repeatedly and doesn't let you 'pause' on a specific frame. Nor does it let you draw on that specific frame.

Hence this macro... :wink:

Re: Roll drawings macro

Posted: 28 Feb 2009, 02:37
by Paul Fierlinger
For that I scrub the cursor with my stylus on the project panel. To each his own... I have yet to meet two people who draw and use TVP exactly the same way, actually not even close to the same way, which says a lot for TVP. I hope you'll like paperless animation. It's like discovering the Kindle after almost 3/4 of a century of reading books.

Re: Roll drawings macro

Posted: 12 Mar 2009, 12:27
by oliveuk
I would love to see a video of the script in action....

Re: Roll drawings macro

Posted: 13 Mar 2009, 03:55
by tigerknight
Okay, here's a very simple demo (no sound -- captions only)
Image
(edit: updated link)

Re: Roll drawings macro

Posted: 13 Mar 2009, 10:34
by oliveuk
I am not a traditional 2d animator but that sounds very usefull. Nice

Re: Roll drawings macro

Posted: 17 Mar 2009, 09:10
by elmisilhumano
Is it possibe to make this work for mac users?

M.

Re: Roll drawings macro

Posted: 19 Mar 2009, 11:39
by Gravin
This is very intersting!

I'm very new to TVPaint and I'm looking at the scripting and action functions to see if this might be a function that could be easily integrated into the programs native tongue without relying on outside applications like the hotkey program. It seems like it would be a simple matter of instructing the program to move "x" number of frames or cells in one direction, but it would have to be smart enough to snap back to the original location. Does anyone know if TVPaint can be instructed to perform an inverse action after a key release or if key releases can be used in the scripting language to pass further instructions?

I'm not really a programmer by any means but I think that I could make a useful script if I could instruct tvpaint to move forward by pressing a key and then snap back when releasing the key. That would make it possible to kind of roll the frames by hand by pressing and releasing 4 keys:


~Curt

Re: Roll drawings macro

Posted: 19 Mar 2009, 15:13
by tigerknight
@elmisilhumano
It appears there's an effort to port AutoHotkey to the Mac (http://www.autohotkey.com/forum/topic34421.html), but it's not complete yet. I'm sure there are other keyboard macro/automator programs on the Mac, but I'm not familar with that platform. :?

@Curt
Yeah, I've thought about your method too, but I've yet to figure out a way to do that. Seems like a function that's more native to the PowerMates. I don't know how to script within TVP... yet.
lemec made something similar here... not sure how he did it (http://www.tvpaint.com/forum/viewtopic.php?f=26&t=2481), and here's a demo of it (http://video.google.com/videoplay?docid ... 3449&hl=en) (from this thread)

On a similar note, does anyone know whether there's a TVP scripting instruction manual? Or just some tutorials even?

Re: Roll drawings macro

Posted: 19 Mar 2009, 17:48
by Rik Jurriaans
Hi,

If i download eny of the downloads on the forum winzip wont open it, it says that it is damaged or something,
but if i download a non zip file from this website it works


Rik

Re: Roll drawings macro

Posted: 19 Mar 2009, 17:53
by Fabrice
Hi Rik,

We are trying to fix the issue. Sorry for the trouble.

Re: Roll drawings macro

Posted: 19 Mar 2009, 21:55
by Gravin
@tigerknight,

Yeah I sent Lemec a PM asking if I could buy a copy but he has yet to get back to me... Hopefully he's just too busy... and not unconscious and nude in his shower after falling and taking a sever blow to the head :cry:

In any case, I think I might find something more like your script more useful since its more instantaneous. I've been selecting the range of images I want to flip to gain more control over the flipbook function but it is a little less intuitive or tactile then it could be with a four button flip setup.

Oh yeah and there is some instruction on George scripting in the pdf manual available here in the downloads section. I took a look at it but I'm afraid that I'm probably going to have to get a hold of the SDK before I can figure out what does what and how to setup the proper commands... doesn't look much more difficult then Applescript, and I can poke my way through that usually :wink:

~Curt

Re: Roll drawings macro

Posted: 21 Mar 2009, 13:59
by tigerknight
I guess the forum is still having problems with attachments.

In the meantime, here are alternative download links for the macro:
http://cid-aa3a7cd89c853a69.skydrive.li ... qwerty.ahk
http://cid-aa3a7cd89c853a69.skydrive.li ... dvorak.ahk

Re: Roll drawings macro

Posted: 22 Mar 2009, 12:57
by Fabrice
tigerknight wrote:I guess the forum is still having problems with attachments.

In the meantime, here are alternative download links for the macro:
http://cid-aa3a7cd89c853a69.skydrive.li ... qwerty.ahk
http://cid-aa3a7cd89c853a69.skydrive.li ... dvorak.ahk
I thought it was fixed. We will hae to run some other tests ... :?