Page 1 of 2

Export to Harmony

Posted: 26 Jan 2021, 20:00
by Cardin
The purpose of these scripts is to help TVP users to continue using TVPaint even if their contract/commission work requires the deliverables to be done in TB Harmony. This process will allow you to import your TVPaint work to TB Harmony, keeping the layers and exposures intact.

There are two scripts, one for TVPaint, and the other for Harmony:

TVPAINT
EXPORT SCRIPT - When your work in TVP is done, simply click the export button on the panel. The TVP export script will export the TVP project as single folder containing a set of PNG's. The result will look like a JSON folder with each layer having a separate folder within the main folder.



HARMONY
IMPORT SCRIPT - This is a modified version of the Import script written by Jacob Kafka, the author of the Rough Animator software. There are instructions on how to install and run the script here: http://roughanimator.com/toharmony/. The steps there will work for the modified script.

In Harmony, run the TVP IMPORT Script and it will rebuild the project (layers and timing intact) and vectorize the lines.

**Depending on your needs, you may want additional control over how Harmony vectorizes your line work. This will add a few more steps to the process which I will try to explain.
First, you will want to use Harmony's standard import dialog menu to test the vectorization options until you get your desired results. You can then save these vectorization options and Harmony will create a text file containing the vectorization codes. Copy these codes and then Paste them into the TVP IMPORT script. So now when you run the TVP Import script, it will use the vectorization options that you tested earlier. It's a few extra steps but it's mostly just Copy & Paste.

Changing vectorization codes in the Import script :
Spoiler : :
Image


Image
DT Nethery very generously sacrificed his time to test the script and provide feedback as needed. With his help, I believe the EXPORT script runs pretty smoothly.
The IMPORT script that runs from Harmony could be improved but I have limited experience with Qt Script, the scripting language used by Harmony. It would be more convenient if the Import script would automatically open the Vectorization Dialog Window so that the user didn't have to open it up separately and then copy & paste the vectorization codes back into the script.

I'll update this post later with pictures to that the everything will be easier to follow

EXPORT Script
See attached file

IMPORT Script
https://drive.google.com/file/d/1SS9BVD ... sp=sharing

Re: Export to Harmony

Posted: 27 Jan 2021, 16:43
by D.T. Nethery
Thanks for posting this , Cardin ! I had intended to do a video tutorial showing how to use this script, but I'm not currently working for the studio who provided me with the Harmony license (month-to-month license subscription) so I don't have a working license of Harmony at the moment. I'll probably wait to renew the license until I get another job using Harmony.
As far as adjusting the vectorization parameters , I can suggest spending some time in the Harmony user manual where it discusses how to adjust the vectorization parameters and do some tests, until you arrive at the ideal vectorization settings (take screen shots, take notes, write everything down). Most of the time if the original drawings from TVPaint are drawn with a clear, crisp line it will be a case of "what you see is what you get" , there won't be any noticeable difference in the line quality when it is vectorized in Harmony. With a very specific sort of texturized line quality you will need to tweak the parameters more carefully to retain the line quality.

Re: Export to Harmony

Posted: 03 Feb 2021, 16:59
by NathanOtano
Will be useful for lots of people! Thanks for the achievement :)
Nathan

Re: Export to Harmony

Posted: 12 Mar 2021, 14:42
by D.T. Nethery
Something I've discovered working more with Harmony is that many productions prefer the drawings (at least the final clean line drawings) to be drawn with the Pencil Tool , which is a different type of line than the Brush Tool in Harmony. (Pencil lines can be manipulated more easily in terms of adjusting the line width and texture than Brush strokes. Clean up with the Pencil tool is generally faster than using the Brush tool. ) .

However, Harmony's default mode when Importing and Vectorizing bitmap drawings is to vectorize them as Brush strokes, not as Pencil lines. In the Vectorization Parameter options you can enter a command to force it to vectorize as Pencil lines , but unfortunately this results in a vectorized pencil line quality that tends to be thicker and cruder than the original line quality and small gaps appear at points where the lines on a drawing intersect or overlap . Through trial and error testing I have been able to adjust the threshold and other settings on the vectorization parameters to somewhat improve the vectorized pencil line quality , but it is still not an acceptable line quality. I hope to be able to figure out the perfect vectorization parameters that will vectorize drawings as Harmony pencil lines , but so far this perfect setting eludes me.

This becomes a critical issue if you were working on a project where the final line artwork must be delivered in a Harmony file and your drawings made in TVPaint must match exactly the line quality of drawings made by other artists working directly in Harmony with the Pencil tool . (especially if they are using a textured Pencil line). I think it's possible to match the line quality so that drawings originally made in TVPaint and then vectorized in Harmony as Brush strokes will appear (to the naked eye) to be the same line quality as drawings made in Harmony using their Pencil tool , but it would be problem if the imported drawings needed to be adjusted using Harmony's Pencil LIne Editor , because if the lines are Brush strokes then you can not use the Pencil Editor. There is a tool in Harmony for "Convert Brush Strokes to Pencil Lines" , but in my experience it is worthless. It deforms the original drawing and all subtlety of the line quality is lost . (don't even go there , it doesn't work; not sure why they even keep it available as an option)

If all you need to do is vectorize drawings originally made in TVPaint into Harmony so they can be colored , then vectorizing the drawings as Brush strokes works fine. The line quality of the original drawing is retained when it is vectorized in Harmony as a Brush stroke. The problem will be if your drawings must be delivered in the Harmony file as Pencil lines instead of Brush strokes. It may be that I'm still such a newbie using Harmony that I haven't figured out how to do it properly with the correct vectorization parameters to import and vectorize the drawings as Pencil lines with acceptable line quality, but I noticed that the only response I received to my query on the Harmony forum was : "I don't think there's anything you can do about that" . (meaning the blocky line quality and the gaps that appear where lines touch).

Re: Export to Harmony

Posted: 02 Apr 2021, 21:55
by Soom
Amazing! wow - I think my workflow options have just expanded enormously and now every time I catch myself on cursing at Toon Boom more than 24 times per second, I can always switch to TVP. thank you for this script!

Re: Export to Harmony

Posted: 19 Jun 2021, 11:34
by Soom
I am using this script for a while now. Very handy, but not perfect because it doesn't vectorize the strokes themselves, which is nice for the looks but not perfect to continue working in TB on the same drawings. So I decided to try the vectorization options, but alas - they don't work, because the exported images are with Alpha channel, and I am unable to get TB to read it as a white background, so it seems that vectorization is impossible. Is there any way to change the script so that it exports the drawings without the transparency on white background?

Re: Export to Harmony

Posted: 25 Jun 2021, 18:51
by D.T. Nethery
I haven't discovered a way to do it. It's the same with importing animation sequences from Rough Animator to Harmony. As it is now , you can import all your rough animation (with layer structure intact) for clean-up and coloring on new layers in Harmony , OR if the animation was already cleaned-up in TVPaint for coloring in Harmony. You can't really do anything with adding to or adjusting the line art after it's been imported into Harmony, unless you make the alterations on a new layer in Harmony.

In the past I had tried importing and vectorizing scanned pencil on paper drawings into Harmony or importing and vectorizing a PNG image sequence from TVPaint to Harmony , and it's the same thing. It will vectorize the lines, so you can add fill colors to the line art , but you can't really do much with the line art itself, unless you re-draw it on a new layer in Harmony. The usefulness of the script is that it will bring in the line art from TVPaint with all the layers and exposures intact , so you don't have to reconstruct the scene manually. (with scanned drawings or PNG image sequence it just brings in each image as a single frame , which is easy if all your animation is "ON 1's" , but if you have some ON 2's and some ON 1's or Holds , or repeats , you have to manually reconstruct it. With the import script you don't have to do that , so it saves a lot of time)

Re: Export to Harmony

Posted: 27 Jun 2021, 00:49
by Soom
Yes of course - it;s understandable
the script is amazing already and I use it a lot.
however I discovered another little problem - it's very tricky to import footage into a project, that already had previously imported footage. the names of the frames are the same, and Toon Boom is a very confused little thing - it mixes them up in it's cumbersome folder structure during import, and half of my scene was disappearing in a glimpse - frames on other layers with same names were changed into the new footage, or simply empty. I had to discover it the hard way - good I had backups. I understand the blame is probably on how TB handles it's files, so I found a workaround - I create a new scene, then import the project there, then advanced-copy/paste them in the target scene...

Re: Export to Harmony

Posted: 30 Jun 2021, 01:56
by Soom
One more question - is it possible to import with color?

Re: Export to Harmony

Posted: 02 Jul 2021, 21:29
by D.T. Nethery
Soom wrote: 30 Jun 2021, 01:56 One more question - is it possible to import with color?
I haven't done much with color, only line art. I've imported colored PNG image sequences to Harmony before and it will do it, so the script should do it , too, but you would have to edit the vectorization parameters in the script to vectorize in color instead of B&W as it is now.

Re: Export to Harmony

Posted: 03 Jul 2021, 18:53
by Soom
D.T. Nethery wrote: 02 Jul 2021, 21:29
Soom wrote: 30 Jun 2021, 01:56 One more question - is it possible to import with color?
I haven't done much with color, only line art. I've imported colored PNG image sequences to Harmony before and it will do it, so the script should do it , too, but you would have to edit the vectorization parameters in the script to vectorize in color instead of B&W as it is now.
Yes - I need it for line art - I am importing animation with different color lines and I would prefer the colors are kept. Sorry, I am not sure how to change the import parameters to color. I see the line "no_color_art" - what do I do with it?
thanks

Re: Export to Harmony

Posted: 03 Jul 2021, 20:17
by D.T. Nethery
Soom wrote: 03 Jul 2021, 18:53
D.T. Nethery wrote: 02 Jul 2021, 21:29
Soom wrote: 30 Jun 2021, 01:56 One more question - is it possible to import with color?
I haven't done much with color, only line art. I've imported colored PNG image sequences to Harmony before and it will do it, so the script should do it , too, but you would have to edit the vectorization parameters in the script to vectorize in color instead of B&W as it is now.
Yes - I need it for line art - I am importing animation with different color lines and I would prefer the colors are kept. Sorry, I am not sure how to change the import parameters to color. I see the line "no_color_art" - what do I do with it?
thanks
I don't know. I hope Cardin Collins (who wrote the script) may see this and he may be able to tell you better than I can how to change the vectorization parameters. (I really know nothing about scripting. My only contribution to it was testing it .)

I do note that in the original post where Cardin posted the script he shows where to change the vectorization parameters:

Image


Image


The Harmony User Manual has information on creating custom vectorization parameters.

https://docs.toonboom.com/help/harmony- ... g-box.html

https://docs.toonboom.com/help/harmony- ... g-box.html


With some trial-and-error tests you could probably get your ideal vectorization parameters to retain the colored line art , then copy and paste it into the script in the area that Cardin indicates.

Re: Export to Harmony

Posted: 11 Jul 2021, 00:50
by Cardin
My apologies for not keeping up the thread.
D.T. Nethery wrote: 25 Jun 2021, 18:51 ... The problem will be if your drawings must be delivered in the Harmony file as Pencil lines instead of Brush strokes....
Indeed. In that scenario, I would settle on doing the rough animation in TVPaint and do the clean lines in Harmony directly. At the very least the script would save time by rebuilding the layers and timing for me.
D.T. Nethery wrote: 25 Jun 2021, 18:51 ...The usefulness of the script is that it will bring in the line art from TVPaint with all the layers and exposures intact , so you don't have to reconstruct the scene manually.
That's what I originally intended it for. Unfortunately, I'm not familiar enough with Harmony or Qt Script to know if there are ways to expand the vectorization capabilities.
NathanOtano wrote: 03 Feb 2021, 16:59 Will be useful for lots of people! Thanks for the achievement :)
Nathan
Thanks, Nathan! Some credit to you as I "borrowed" a function or two from one of your scripts. I needed a way to count the number of heads in a layer :)

Re: Export to Harmony

Posted: 11 Jul 2021, 00:52
by Cardin
D.T. Nethery wrote: 03 Jul 2021, 20:17 I do note that in the original post where Cardin posted the script he shows where to change the vectorization parameters:
Thanks for helping out David. The original post does goes over changing the parameters but I realized the instructions I left were pretty vague. Hopefully the steps below will provide better help...

Changing the Vectorization Parameters in the Script

The first step is to find the vectorization options that work best for your images.

Open the Import Images window: On the main menu bar, click File > Import > Images...
Select your file(s) and the appropriate layer option. In the Import Options section, select "Convert to Toon Boom Vector Drawing". Under "Vectorization", click on either the plus(add) or pencil(edit) icon to open the Vectorization Parameters window.
Image
Soom wrote: 03 Jul 2021, 18:53 Yes - I need it for line art - I am importing animation with different color lines and I would prefer the colors are kept. Sorry, I am not sure how to change the import parameters to color. I see the line "no_color_art" - what do I do with it?
thanks
Here is where you'll need to do some experimenting to find which parameters work the best for whatever you're importing. Note: If you want to import color, check the box for "Color as Texture" in the Output section. Once you have settled on your parameters, click Save. You can preview the vectorization in this window but you may need to actually execute the import to make sure everything works as expected.
Image

The Vectorization Parameters that you chose are saved as a .vof file which can be opened with any text editor like Notepad or WordPad. Open the file and copy everything there.
Image


Return to the Harmony main screen. Open the Script Editor window and select the TVPaint-to-Harmony script. Scroll down all the way to the bottom of the script where you'll see a line of code that reads, var vectorizeOptions = "......".
Image


Delete everything within those double quotes and then Paste the codes that you copied earlier. Click Save.
Image


The next time you run the script, it will use the vectorization parameters that you tested before.
Image

Re: Export to Harmony

Posted: 11 Jul 2021, 18:23
by Soom
Sorry, I think you might have missed my previous reply - Harmony would not apply any vectorisation parameters on images with Alpha channel - I tried everything... and TVPaint script exports only transparent images. I think the question here is more about the TVPaint Export script - can it "flatten" the layers with background color before exporting and make them RGB instead of RGBA?