Page 1 of 3

A script to import TVPaint's CSV file format

Posted: Tue Jun 21, 2016 8:55 pm
by Fazek
I've just made this menu item script. CSV is an export format of TVPaint. I already made similar import scrips for Blender and TVPaint itself. You can find these on the same forum too. Also you can use the CSV format in newer versions of Krita.

You can find the script here:
(27.08.2016: a new experimental export plugin is also available here)

http://forum.tvpaint.com/viewtopic.php?f=26&t=10050

To select CSV format export in TVPaint, click on the Clip: layers structure tab in your Export footage window. TVPaint creates a simple text file with .csv extension for the exposure sheet - actually it is a spreadsheet format, so you can load it to Excel for example - and also creates .png files for the drawings into a folder.

In Moho, if you installed the script into a directory in your scripts/menu, you can use the new "Import CSV animation..." menu item to import this format. It creates Switch Layers with the images and puts everything inside a base Group layer. It loads the blending mode of the layers as well.

IMPORTANT! There are differences in character set encodings between parts of the lua system so use only ASCII-7 (English alphabet) for the filenames. If you cannot open or save a file, first ensure that its path is not containing any special (accented) characters.

If you have older versions of Anime Studio, I'm curious how it's working in them.

Re: A script to import TVPaint's CSV file format

Posted: Tue Jun 21, 2016 9:11 pm
by hayasidist
(win 7/64bit) I'm getting an error trying to open the file after download - The compressed (zipped) folder ... is invalid.

Re: A script to import TVPaint's CSV file format

Posted: Tue Jun 21, 2016 9:33 pm
by Fazek
You're right, the forum motor somehow modified the zip file. The zipping needed because the forum not accepted the .lua extension in the file name. I uploaded again, I hope it's good now.

Re: A script to import TVPaint's CSV file format

Posted: Wed Jun 22, 2016 10:46 am
by hayasidist
yes - all good - downloaded ok. Thanks. (I'm interested in the import concept in general rather than TVP in particular)

Re: A script to import TVPaint's CSV file format

Posted: Wed Jun 22, 2016 6:26 pm
by F.M.
Welcome Back! And thanks for your scripts, that's very generous of you!

Re: A script to import TVPaint's CSV file format

Posted: Wed Jun 22, 2016 8:45 pm
by Fazek
One important thing: on my machine with Windows 10, LUA can't open the files if their path contains characters outside of ASCII-7. So if you cannot open a file with this plugin, check the characters in the path name (ASCII-7 characters: basically the lower/upper case English alphabet + numbers + some special characters, like: space, dot, underscore, minus...). For me it's a problem because Hungarian alphabet has some accented characters too.

Re: A script to import TVPaint's CSV file format

Posted: Mon Jun 27, 2016 4:55 pm
by rrahh
Wow! Thank you very much!

Re: A script to import TVPaint's CSV file format

Posted: Fri Jul 22, 2016 10:40 am
by Fazek
I just uploaded a new version of this script into the original place. This new version can optionally set the document parameters, like field size, framerate and play duration from the CSV file. However, it still cannot open the files if there are international characters in the path name.

Re: A script to import TVPaint's CSV file format

Posted: Fri Aug 12, 2016 4:03 pm
by cartoonmonkey
Is this script useful mainly for importing a multi-layered character into Moho? Or a whole film?

Re: A script to import TVPaint's CSV file format

Posted: Fri Aug 12, 2016 10:22 pm
by Fazek
TVPaint is a pixel based program. it has layers like Photoshop, but each layer works on a timeline. The keys on the timeline are standalone, full-frame pictures. You cannot make motion tweens, rigged characters etc. with them. You must draw each motion steps manually. This program is best for traditional, cel-style animation, pencil drawings, paintings etc. There is a free alternative to TVPaint, named Krita, with a very similar working style.

So, you can import a complete scene into Moho with this plugin. You can import, for example a sketch animation or layout. But you can also use it to import a finished scene, to add some compositing effects, additional characters, motion blur, 3d camera movement...

Re: A script to import TVPaint's CSV file format

Posted: Sat Aug 13, 2016 6:09 pm
by cartoonmonkey
Hey Fazek,

I can't get this to work with the latest version of TVPaint 11 Pro, and MOHO.
Here's my error.

I even tried to put the path to the csv file in a directory on c:/a - and made sure I had no _ in any layers etc in TVPaint.. still to no avail...
Windows 10 X64, Moho x64, TVPaint 11 Pro X64

Image

Re: A script to import TVPaint's CSV file format

Posted: Mon Aug 15, 2016 7:52 pm
by Fazek
Thank you! I think this means there are more #something rows in your .csv file before the first #00000 numeric row. I will check it and make a workaround soon.

I assumed the files are starting like this example:

Code: Select all

UTF-8, TVPaint, "CSV 1.0"
Project Name, Width, Height, Frame Count, Layer Count, Frame Rate, Pixel Aspect Ratio, Field Mode
"Example", 640, 480, 4, 2, 24.000000, 1.000000, Progressive
#Layers, "B", "A"
#Density, 1.000000, 1.000000
#Blending, "Color", "Color"
#Visible, 1, 1
#00000, "", "frame001-00000.png"
#00001, "frame000-00001.png", "frame001-00000.png"

Re: A script to import TVPaint's CSV file format

Posted: Mon Aug 15, 2016 11:20 pm
by cartoonmonkey
Well, here's my csv file:
I just named all my layers a, b, c, d, e etc.



UTF-8, TVPaint, "CSV 1.1"
Project Name, Width, Height, Frame Count, Layer Count, Frame Rate, Pixel Aspect Ratio, Field Mode
"aaa", 1280, 720, 1, 10, 24.000000, 1.000000, Progressive

#Layers,"a","b","c","d","e","f","g","h","i","j"
#Folder,"C:\a\test.layers\[001] a","C:\a\test.layers\[002] b","C:\a\test.layers\[003] c","C:\a\test.layers\[004] d","C:\a\test.layers\[005] e","C:\a\test.layers\[006] f","C:\a\test.layers\[007] g","C:\a\test.layers\[008] h","C:\a\test.layers\[009] i","C:\a\test.layers\[010] j"
#Density,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000
#Blending,"Color", "Color", "Color", "Color", "Color", "Color", "Color", "Color", "Color", "Color"
#Visible,1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#00000, "[001][00000] a.png", "[002][00000] b.png", "[003][00000] c.png", "[004][00000] d.png", "[005][00000] e.png", "[006][00000] f.png", "[007][00000] g.png", "[008][00000] h.png", "[009][00000] i.png", "[010][00000] j.png"

Re: A script to import TVPaint's CSV file format

Posted: Tue Aug 16, 2016 5:30 am
by Fazek
The #Folder row is a new thing, I'll add support then.

Thanks

Re: A script to import TVPaint's CSV file format

Posted: Tue Aug 16, 2016 6:01 am
by cartoonmonkey
Cheers Fazek,
Can't wait to try it!