A script to import TVPaint's CSV file format

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

A script to import TVPaint's CSV file format

Post 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.
Last edited by Fazek on Thu Sep 01, 2016 12:53 pm, edited 2 times in total.
- - - Fazek
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

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

Post by hayasidist »

(win 7/64bit) I'm getting an error trying to open the file after download - The compressed (zipped) folder ... is invalid.
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

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

Post 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.
- - - Fazek
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

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

Post by hayasidist »

yes - all good - downloaded ok. Thanks. (I'm interested in the import concept in general rather than TVP in particular)
F.M.
Posts: 497
Joined: Thu Nov 04, 2004 4:29 pm
Location: Between my ears

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

Post by F.M. »

Welcome Back! And thanks for your scripts, that's very generous of you!
"and then Man created god!"
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

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

Post 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.
- - - Fazek
User avatar
rrahh
Posts: 39
Joined: Mon Jan 28, 2013 3:56 pm
Contact:

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

Post by rrahh »

Wow! Thank you very much!
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

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

Post 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.
- - - Fazek
User avatar
cartoonmonkey
Posts: 90
Joined: Thu Feb 12, 2009 2:06 pm
Location: Portland, Oregon
Contact:

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

Post by cartoonmonkey »

Is this script useful mainly for importing a multi-layered character into Moho? Or a whole film?
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

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

Post 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...
- - - Fazek
User avatar
cartoonmonkey
Posts: 90
Joined: Thu Feb 12, 2009 2:06 pm
Location: Portland, Oregon
Contact:

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

Post 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
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

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

Post 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"
- - - Fazek
User avatar
cartoonmonkey
Posts: 90
Joined: Thu Feb 12, 2009 2:06 pm
Location: Portland, Oregon
Contact:

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

Post 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"
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

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

Post by Fazek »

The #Folder row is a new thing, I'll add support then.

Thanks
- - - Fazek
User avatar
cartoonmonkey
Posts: 90
Joined: Thu Feb 12, 2009 2:06 pm
Location: Portland, Oregon
Contact:

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

Post by cartoonmonkey »

Cheers Fazek,
Can't wait to try it!
Post Reply