Designing new shortcut key functions

Please use this part to report bugs & errors, ask questions & "How to..."
Post Reply
Svengali
Posts: 1553
Joined: 28 Dec 2006, 10:08

Designing new shortcut key functions

Post by Svengali »

I am trying to find the best way to add new shortcut key functions to TVPaint. Here's one way I've done it and I was wondering if any other users or TVPaint facilitators might have an easier approach.

First thing I discovered with shortcut keys is that once a button is DEFINED AND NAMED, the list of actions assigned to that button can also be assigned to a shortcut key. The new button name will appear in the right column of the configure keyboard shortcuts list like this:

Panel-name:Button-name

Now a shortcut key can be assigned to the button which when pressed will to invoke the commands assigned to the custom button.

Next thing I discovered was that the custom panel need not be visible to show-up on the shortcuts list... so I created a special panel called HIDDEN BUTTONS and there I store all my custom buttons which I want to assign to shortcut keys.

Examples:

My Right Arrow key is assigned to HIDDEN BUTTONS:nextwrap
My Left Arrow key is assigned to HIDDEN BUTTONS:previouswrap

The nextwrap button simply calls the script NextFrame.grg
The previouswrap button simply calls the script PreviousFrame.grg

NextFrame.grg and PreviousFrame.grg are George scripts I posted earlier on the forum.

[ Question: is this the best way to assign scripts to shortcut keys? ]




Another Example:

I wanted to create a shortcut key to automatically add a predefined drop-shadow to the current layer. Here's what I did:


Step 1. In the FX window, I chose FXSTACK Stylize:Drop Shadow and set the parameters I wanted - angle, distance, opacity, smooth... and ADDED it to the FXBin list naming it dropshadow.

Step 2. In my HIDDEN BUTTONS panel I created another hidden custom button named DropShadow with the following list of commands:

0 FXStack:dropshadow
1 Key:FXStack Apply
2 Key:FXStack Delete All
3 Key:Interface:Close FX Panel
4 End

Step 3. Finally, in the Keyboard Shortcuts popup I assigned the A key to HIDDEN BUTTONS:DropShadow and saved it.

Now, anytime I want a dropshadow for a given layer, I just press the A key - which opens the FXStack popup, applies the shadow, then clears and closes the FXStack popup window.

[ Question: I was wondering if there is an easier / simpler way to do this? Any alternate methods for inventing new shortcut keys? ]

Sven
Last edited by Svengali on 12 Jul 2008, 17:53, edited 1 time in total.
User avatar
ZigOtto
Posts: 4102
Joined: 17 Feb 2006, 22:50
Location: south-Petazonia

Re: Designing new shortcut key functions

Post by ZigOtto »

Svengali wrote:[ Question: is this the best way to assign scripts to shortcut keys? ]
it's the right way, (and only way afaik at this time).
...
Svengali wrote:[ Question: I was wondering if there is an easier / simpler way to do this? Any alternate methods for inventing new shortcut keys? ]
I think it's the right way too, though I would insert a first command to load the FX-bin from file (tv_stackload pathbinfilename),
so if you inadvertently delete your DropShadow fx from the Bin, the shortkey will work as well.
Svengali
Posts: 1553
Joined: 28 Dec 2006, 10:08

Re: Designing new shortcut key functions

Post by Svengali »

Thanks Zig... good to know.

tv_Stackload command? I don't see that in the SDK (documentation from TVP 8 ). What is that doing?

Sven
User avatar
ZigOtto
Posts: 4102
Joined: 17 Feb 2006, 22:50
Location: south-Petazonia

Re: Designing new shortcut key functions

Post by ZigOtto »

Svengali wrote:... tv_Stackload command? I don't see that in the SDK (documentation from TVP 8 ). What is that doing?
oh, it's a command from Mirage (end)period I think ,
basically, and after having exported an FX bin file somewhere preciously on your HD,
(ex: C:\Program Files\TVPaint Developpement\TVP Animation 9 Pro\FXbin\MyEffect.bin),
you can load it by using this command : tv_Stackload pathbinfilename,
(in my exemple: tv_stackload C:\Program Files\TVPaint Developpement\TVP Animation 9 Pro\FXbin\MyEffect.bin)
:)
Svengali
Posts: 1553
Joined: 28 Dec 2006, 10:08

Re: Designing new shortcut key functions

Post by Svengali »

Hi Zig,

I looked into the other files included with the SDK 8 and found CHANGES.TXT which lists newer George commands including all the fx_stack commands. Based on that I rewrote the dropshadow button command list (Step 2 in the original post) as follows:

0 Command:tv_stackload FXbin\DropShadow.bin
1 Command:tv_stackapply
2 Command:tv_stackclear
3 Command:tv_stackclose

I also had to create a folder named Fxbin and EXPORT the dropshadow FXStack effect with custom settings to the folder saved as DropShadow.bin.

Using the tv_stack commands is a little neater since the FXStack window doesn't popup. I'm still testing possibilities.

Sven
Post Reply