CSV format importer script for TVPaint

fazek
Posts: 24
Joined: 07 Feb 2016, 14:54

CSV format importer script for TVPaint

Post by fazek »

TVPaint can export layered animation into its own CSV format (File / Export to menu, Clip: Layers structure tab) The format contains a simple text file for the exposure sheet and also all your pictures in a directory as PNG files. With my script you can load back these files into TVPaint. So you can edit your drawings with external graphics programs or you can modify the exposure sheet with a spreadsheet editor like Excel, and after that you can load back everything into TVPaint. Enjoy!

Install:
1. download the attached import_csv.grg file and copy it into a folder on your disk to keep it permanently.
2. create a Custom Panel with the Custom Panels / New Custom Panel menu item. Or if you have a Custom Panel already, you can use it too.
3. click on the Custom Panel with the right button of the mouse and select Add Action from the menu.
4. the Edit window pops up, then click on the highlighted End row and select Set Script from the menu.
5. in the File request window, find and select the saved import_csv.grg file.
6. you can set an icon for the import grg tool.
7. close the Edit window with the OK button.

Now you have a button on the panel to load the CSV format. After you click on it, you can select the .csv file to load. Then the program asks if you want to create a new project (Yes) or want to load it into the actual project as new layers.

The PNG standard defines straight (not premultiplied) alpha in the images. But if for some reason you have premultiplied alpha in your images, use the import_csv_premultiplied_alpha.grg script. If you are unsure, just use import_csv.grg .
17 AUG 2016, Version 1.4: Basic support for the #Folder line
29 AUG 2016, Version 1.5: Bugfix for spaces in filenames, path translation to the current folder, handling of file errors
31 AUG 2016, Version 1.6: Bugfix for spaces in scene name, proper handling of interlaced scenes
Attachments
import_csv.grg
CSV import script v1.6
(15.63 KiB) Downloaded 2444 times
import_csv_premultiplied_alpha.grg
CSV import script v1.6 for premultiplied alpha
(15.68 KiB) Downloaded 2340 times
Last edited by fazek on 31 Aug 2016, 05:34, edited 5 times in total.
User avatar
Fabrice
Posts: 10077
Joined: 17 Jul 2007, 15:00
Contact:

Re: CSV format importer script for TVPaint

Post by Fabrice »

Will try it on monday ! Thanks for posting.
Fabrice Debarge
fazek
Posts: 24
Joined: 07 Feb 2016, 14:54

Re: CSV format importer script for TVPaint

Post by fazek »

Update V1.2: a small correction in the code because PNG files have unpremultiplied alpha by default.
Elodie
Posts: 13912
Joined: 06 Jan 2009, 09:53
Location: Metz

Re: CSV format importer script for TVPaint

Post by Elodie »

That's actually better to use No Premultiply.
User avatar
Fabrice
Posts: 10077
Joined: 17 Jul 2007, 15:00
Contact:

Re: CSV format importer script for TVPaint

Post by Fabrice »

Elodie is right, you should do two scripts or give the choice between the two options.
Fabrice Debarge
fazek
Posts: 24
Joined: 07 Feb 2016, 14:54

Re: CSV format importer script for TVPaint

Post by fazek »

I think "straight alpha" is the right term :)

So I made two versions of the script. Most people need the import_csv.grg version, but if somehow you have premultiplied alpha, use the other script.
fazek
Posts: 24
Joined: 07 Feb 2016, 14:54

Re: CSV format importer script for TVPaint

Post by fazek »

Added support for the Folder feature of CSV 1.1.
ulrik
Posts: 37
Joined: 10 Sep 2006, 08:59
Location: Sweden
Contact:

Re: CSV format importer script for TVPaint

Post by ulrik »

Hi Fazek!

Thank you for the great csv import and export scripts for Moho, they seems to work great, you just have to think of the structure when exporting from Moho so you'll get what you want. :)
I'm testing the csv export from Moho at the moment and wanted to try to load it in TVP Pro 10, I followed your instructions and made a custom panel for the scripts, but when I click on any of the 2 scripts. scripts, they are trying to save, not load csv. see attached screenshots.

regards Ulrik

Image
Image
fazek
Posts: 24
Joined: 07 Feb 2016, 14:54

Re: CSV format importer script for TVPaint

Post by fazek »

Hello Ulrik, I think it's just a save file dialog. Just select the file there, it must load it correctly. I have the same "save" button on this dialog in the TVP11 linux demo too. I don't know how to change it yet. The tv_ReqFile() call has no option to set the load/save/folderselect etc. dialog mode.
ulrik
Posts: 37
Joined: 10 Sep 2006, 08:59
Location: Sweden
Contact:

Re: CSV format importer script for TVPaint

Post by ulrik »

fazek wrote:Hello Ulrik, I think it's just a save file dialog. Just select the file there, it must load it correctly. I have the same "save" button on this dialog in the TVP11 linux demo too. I don't know how to change it yet. The tv_ReqFile() call has no option to set the load/save/folderselect etc. dialog mode.
Hi again,
if I select the csv file I'll get this:

Image

and if I chose "Cancel" nothing will happen and if I chose "Replace" TVP hangs and I have to "force quit"

and the program never asks if you want to create a new project (Yes) or want to load it into the actual project as new layers.

So this is working on you linux machine, are you running TVP v.11? I'm running TVP 10 maybe it has something to do with that?

/Ulrik
fazek
Posts: 24
Joined: 07 Feb 2016, 14:54

Re: CSV format importer script for TVPaint

Post by fazek »

Hello Ulrik, I tried this with the TVPaint 11 demo on Linux (I'm not using TVPaint yet otherwise) but other people are tried this plugin with TVPaint 10 on Windows and I think it works for them. Perhaps you have an OSX specific problem, I have no information how my plugin works on a Mac. But maybe the export plugin for Moho has some bugs (it's only two days old) so please first try to export a CSV from inside your TVPaint and try to load that back with my plugin. If it also crashes or hangs, you could try to download a demo of TVPaint version 11 for Mac and try it with the plugin. At least under Linux it works for sure with the demo version too.
ulrik
Posts: 37
Joined: 10 Sep 2006, 08:59
Location: Sweden
Contact:

Re: CSV format importer script for TVPaint

Post by ulrik »

Hi Fazek, ok I'll try that, thank you!

/Ulrik
ulrik
Posts: 37
Joined: 10 Sep 2006, 08:59
Location: Sweden
Contact:

Re: CSV format importer script for TVPaint

Post by ulrik »

Still no luck :)
I changed the "file requester" from "system" to "tvp's own system", then I got rid of the stupid "Save file as", so now I could chose the csv file when trying to import :)
I exported a small project as csv from TVP 10, tried to load the same project both in TVP 10 and a downloaded trial version of TVP 11, both v.10 and 11 free and hang so I had to force quit them.
Image
I guess it has something to do with that I am on mac I guess, to bad :(

I loaded the same csv project in Moho 12 without any problem, so I am very happy for the Moho import/export scripts you wrote, thanks again!

Regards Ulrik
fazek
Posts: 24
Joined: 07 Feb 2016, 14:54

Re: CSV format importer script for TVPaint

Post by fazek »

Hello Ulrik,

Thank you for your patience! After reading your answer, I think the Mac is doing something differently than Linux or Windows. It's not the file dialog window. Something happens after that. Could you please help me to investigate this? Maybe I can modify the script to run on Mac as well, or we can tell the exact bug for the developers to correct.

It's not easy to debug a George script but I prepared a debug version of the script for you. After you select the file to load, hopefully it will show you message windows, one after another. You can continue by clicking on the button of the window. I hope you will see at most 8-10 messages before the freeze. Could you please tell me the texts of these windows?
Attachments
import_csv_debug.grg
(14.51 KiB) Downloaded 2220 times
ulrik
Posts: 37
Joined: 10 Sep 2006, 08:59
Location: Sweden
Contact:

Re: CSV format importer script for TVPaint

Post by ulrik »

Yeah, progress, this time I made a really simple project, 2 layers with 4 frames each. I used the "debug" version and got all the way to the end :)
I managed to load the csv projekt but, the layers were empty.
Here is the project I used and also screenshots of every message window in chronologic order, I hope it tells you something.
https://dl.dropboxusercontent.com/u/215 ... frames.zip
Post Reply