tv_loadkeymap question

A forum dedicated to George scripting questions
Post Reply
kelanhordos
Posts: 61
Joined: 06 Aug 2019, 01:09

tv_loadkeymap question

Post by kelanhordos »

I have a couple questions for a problem I am trying to work around with regards to changing shortcuts on the fly if possible.

1. When using tv_loadkeymap it loads a previously saved config fine, but it seems that you need to open the keyboard shortcut menu and press "OK" for this loaded keymap to be assigned. I'm wondering if this is intended behaviour, and if there is a way around this where you can "force" this and skip that step, or some other george command that would cause it to be accepted?

2. Also in relation, is it possible to force a keyboard keypress in TVPaint? I found an old topic discussing it in the forum, but there was only some talk that it was hypothetical, but no info how to do it. If I have part of the script open the Keyboard Shortcut menu, I cannot figure a way to force it to press OK, and am wondering if this is possible (For reference pressing Enter twice on this menu works, pressing it once goes to the enter shortcut, and then on the second press it closes out with an OK)

3. I can't seem to find anything that would do this, but just in case, is there a way through george to change what shortcut is set for a command? (i assume it's not the case, which is why I was trying the workaround with loading a separate keymap, and this works but with the added step of having to press enter twice to select OK, which ruins the flow of everything, so is not very smooth)
PC: Windows 10/64 Pro - TUF Gaming H470-PRO, i9-10900F@ 2.8 GHz - 32Gb RAM
Tvpaint 12 Pro
Wacom Cintiq 16 Driver: 6.4.5-5
User avatar
Peter Wassink
Posts: 4403
Joined: 17 Feb 2006, 15:38
Location: Amsterdam
Contact:

Re: tv_loadkeymap question

Post by Peter Wassink »

1) i believe you always need to restart before a new config will kick in
Peter Wassink - 2D animator
• PC: Win11/64 Pro - AMD Ryzen 9 5900X 12-Core - 64Gb RAM
• laptop: Win10/64 Pro - i7-4600@2.1 GHz - 16Gb RAM
kelanhordos
Posts: 61
Joined: 06 Aug 2019, 01:09

Re: tv_loadkeymap question

Post by kelanhordos »

Thanks Peter, I figure that is the case, but as I am still discovering new stuff in Tvpaint itself and the forum every time I look I thought I would ask if anyone knows. In that regard I actually found a post by D.T. Nethery that dealt with what I was trying to accomplish. Not sure if this part of the forum is the best place to raise the discussion, and not sure if it has been discussed elsewhere either. The forum is a treasure of information, but it seems sometimes you need to read through every thread to find things haha. Toon Boom Harmony does something similar to what I am looking for as D. T. Nethery mentioned in the thread below. I was searching through the forum for ways to make toggleable buttons or change shortcuts but I haven't come across a perfect solution.

Basically my problem is running out of keys for shortcuts and ergonomic function as I discover more ways to do things in TVPaint. I would like to consolidate the various shortcuts I have using F and G and modifier keys to flip and have something I can easily toggle to change the behaviour from flipping between drawings, instances, and keys/bds etc. that have been marked without needing several groups of keys and modifiers to do so. I also have "Flips" for going between various configurations of Keys/BDs and rather than having several buttons for each it would be nice to quickly be able to change the behaviour of a single set of buttons(F,G) or for my main Flip I am using W right now without needing to reach for shift or ctrl over extended periods.

https://forum.tvpaint.com/viewtopic.php ... 17#p124917
PC: Windows 10/64 Pro - TUF Gaming H470-PRO, i9-10900F@ 2.8 GHz - 32Gb RAM
Tvpaint 12 Pro
Wacom Cintiq 16 Driver: 6.4.5-5
Svengali
Posts: 1565
Joined: 28 Dec 2006, 10:08

Re: tv_loadkeymap question

Post by Svengali »

On occasion when I want one Function key to perform several different functions I will...

1. use tv_WriteUserString to set a flag value in the Config file.

2. in the script assigned to the Function key, use tv_ReadUserString to look at the flag value, then execute the appropriate action using if/then segments.

3. by using a tv_GetModifiers command, you can also have a Ctrl+Function key option within the same Function key script that lets the user change the flag value in the Config file, altering future action of the Function key.

sven

p.s. Actually, if you are wanting to change the functionality of a multiple-key set, you could have a Function key dedicated to changing the flag value, then have the scripts of each of the multiple-keys read the flag and perform appropriately...
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
kelanhordos
Posts: 61
Joined: 06 Aug 2019, 01:09

Re: tv_loadkeymap question

Post by kelanhordos »

Thanks Sven, its been a while since I did any programming and the bit I've looked at george made me feel stupid as there was something I was doing wrong with the syntax and didn't realize until looking through very old threads you could use tv_warn to help debug whats going on. Anyhow, I played around a bit more after reading your post and that stuff if very interesting. An aside, but one of the difficult things I have found is just how much information there is on the forum but so dispersed over so many years and threads its like literally panning for gold, especially with the cooldown on the forum search and google not going to the right forum since the upgrade to the website with the launch of v12.

If I may, I have tried finding the answer to this question in the myriad threads, and wasn't sure if its just too simple or if I am misunderstanding, but maybe you could answer since you have been around a long time and seem to know george as well as anyone. When you are making a button in a custom panel and you can add line with actions > set keystroke...are these commands not all available in GEORGE in one form or another? Maybe this was a presupposition of mine that was incorrect, I just assumed that these keystroke actions were a simpler way of doing things george could do but without knowing how to use the scripting language. For instance is there no way with george to call the same action as Key:ImageMarks: Next Color 01?

I have gotten a ways along setting up a modifiable function with what you mentioned above, I am wondering if what I was thinking of is not even possible. If these actions aren't available with GEORGE, is there some way to set up IF ELSE conditions with these actions with the embedded script line?

Sorry if these are newbie questions, and thanks in advance if you can spare any time, I've found some similar threads you were involved in about executing a specific keypress on another custom panel which is similar but slightly different? (The other difficult is knowing whether some of this stuff was addressed over the years after initial threads that brought it up)
PC: Windows 10/64 Pro - TUF Gaming H470-PRO, i9-10900F@ 2.8 GHz - 32Gb RAM
Tvpaint 12 Pro
Wacom Cintiq 16 Driver: 6.4.5-5
Svengali
Posts: 1565
Joined: 28 Dec 2006, 10:08

Re: tv_loadkeymap question

Post by Svengali »

K:
I wasn't sure how familiar you were with GEORGE (which is really simple once you get syntax down.)

Give me a day or two to look at some of my old GEORGE scripts and I'll post some simple code that might help:
With setting flag values in Config - and key-scripts that read flag values, then do different but related actions...

sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
kelanhordos
Posts: 61
Joined: 06 Aug 2019, 01:09

Re: tv_loadkeymap question

Post by kelanhordos »

Thanks Sven I would very much appreciate that.
PC: Windows 10/64 Pro - TUF Gaming H470-PRO, i9-10900F@ 2.8 GHz - 32Gb RAM
Tvpaint 12 Pro
Wacom Cintiq 16 Driver: 6.4.5-5
Svengali
Posts: 1565
Joined: 28 Dec 2006, 10:08

Re: tv_loadkeymap question

Post by Svengali »

K,
I've distilled the essential steps to show how you might use GEORGE scripting to have two (or more) processes assigned to a shortcutkey or shortcutkeys using a FLAG. I'm uploading a demo that shows the possibilities, nothing more, in bare-bone scripts.
Short Cut Keys Demo.png
Short Cut Keys Demo.png (8.56 KiB) Viewed 382 times
Hope this helps toward a solution.

I'm including a .PDF file and a .tvpx file which explains all.

sven
Attachments
SCKeys to Scripts.tvpx
(196.5 KiB) Downloaded 24 times
SCkeys to scripts.pdf
(122.86 KiB) Downloaded 27 times
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
kelanhordos
Posts: 61
Joined: 06 Aug 2019, 01:09

Re: tv_loadkeymap question

Post by kelanhordos »

Hey, thanks so much Sven, I will take a look at it!

I have been smashing my head against George the last few days and have made some progress by messing around and trying to decipher what other people have done in scripts...and a lot of trial and error once I actually got a few things working.

I have sort of figured out the flag thing I think, but as I don't know much about George i'm not sure if this is the correct or best way of doing things. I also don't know what I don't know about debugging so hopefully these scripts don't cause errors for other people if they want to try them, but I think I'm pretty close to getting the functionality I was looking for out of these? I've already found a better way of doing the Flipping with keyboard shortcuts(compared to an earlier version I did that had preset combinations of flags) so I changed that one to what it currently is, and likely there is a better way to do all of this, but first steps and all.

I appreciate your time in putting together that document so very much, if you have any feedback on these it would be much appreciated.

This first one is for FLIPS. You need to have a manual flip named "FlipFlop" for it to work. Something like this...not sure yet if there are any bugs if there are different layer limits etc.
Image

I don't use extremes separate from Keys in my workflow but the thread I linked above the D.T. Nethery posted had me try it out for the extra variable to work with. I also don't like these colors for marks, but they are the current default and I thought it might be less confusing what's happening. K = keys(Mark 1) E = Extremes(Mark 2) B = Breakdowns(Mark 3) and I = Inbetweens, which bypasses marks and lets you flip all instances(heads). The last button displays a popup with X or O depending on if the flag is turned off(x) or on(o).

So create a flip named Flipflop, set a shortcut, and if you toggle on only K for example, it should only flip through your Key (Mark 1: A, RED by default). It should be color agnostic, and just uses the first 3 marks 1:A(RED) 2:B(ORANGE) 3:C(YELLOW). I don't see a reason to mark your inbetweens myself if everything else is marked, but I think it would be easy enough to add more marks. (**edit: I should add one thing I discovered, which is probably a feature not a bug, but if you are for instance on inbetweens only, and currently on an inbetween, and then hit K for keys, when you use the flip it will go between keys AND the current instance you were on until you no longer have that instance selected. This actually works well in that you dont lose your spot, but it seemed like a bug at first and in case it seems that way to anyone else I think it is intended)

Image

The second one works pretty much the same except if is for using two keyboard shortcuts for flipping forward and backward, which I set as F and G. When using the flags on this one I added some more options which is that you need to have the inbetweens flagged on to flip to them, and you can also skip any marks that are off and just go to inbetweens if the Inbetween flag is on.
Image

I'm not 100% sure if this hasn't been done somewhere else better(if it has I tried my best reading and searching through the forum and asking above!) and try it out at your own risk as I'm new to scripting.

Anyhow thank you so much again for posting this, i'm going to take a look right away(and probably rewrite this stuff! haha)
MarkFlip Set v1.tvpx
(240 KiB) Downloaded 27 times
MarkFlipKeys Set v1.tvpx
(336 KiB) Downloaded 22 times
P.S.

As it's still a WIP I didn't want to start a new thread. I'm also not sure if people have normally posted scripts while they are working on them, so please forgive my ignorance, and hopefully it doesn't wreck anything(I had one version I tried making the flip....but in a loop that checked first and the exit flag never fired and it made 2k flips before I could cancel out)
Attachments
kebi keys.jpg
kebi keys.jpg (9.73 KiB) Viewed 376 times
KEBI flips.jpg
KEBI flips.jpg (7.35 KiB) Viewed 376 times
flipflop.jpg
flipflop.jpg (37.82 KiB) Viewed 376 times
PC: Windows 10/64 Pro - TUF Gaming H470-PRO, i9-10900F@ 2.8 GHz - 32Gb RAM
Tvpaint 12 Pro
Wacom Cintiq 16 Driver: 6.4.5-5
Svengali
Posts: 1565
Joined: 28 Dec 2006, 10:08

Re: tv_loadkeymap question

Post by Svengali »

K,
I grabbed your 2 tvpx files... I'll have a look tomorrow. 8)

sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
User avatar
Hironori Takagi
Posts: 305
Joined: 14 May 2018, 10:15
Location: Tokyo, Japan
Contact:

Re: tv_loadkeymap question

Post by Hironori Takagi »

I would like to hear from the TVPaint team.
After using tv_LoadKeyMap, the results are not fixed.
Will this be fixed with a minor version update of TVPaint 11/12?
TVPaint 11.7.2(Nov 14 2023), Windows11 Pro, HP Spectre x360 Convertible 14-ea0xxx / TVPaint 11.7.1(Dec 22 2022) Mac OS 11.6, Apple MacBookPro M1 2020
Post Reply