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: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

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 » Tue Aug 16, 2016 9:05 am

You can find a new version on the download page, I hope it's working now.
- - - Fazek
ulrik
Posts: 1074
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

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

Post by ulrik » Tue Aug 16, 2016 9:32 am

Thanks for the script, it's working here with TVP 10 and Moho 12 on OS X :D
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 » Tue Aug 16, 2016 4:50 pm

ulrik, please download and try the new version I just uploaded. The problem is the new directory structure of the CSV 1.1 format (I think TVPaint implemented this recently in version 11). cartoonmonkey, please, if you want to help me with testing, please try the new version with your files, and also move (ie. copy the files and delete the originals) your test.csv file and your test.layers folder to a different location on your harddisk, then try to load them from there.

Thanks
- - - Fazek
ulrik
Posts: 1074
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

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

Post by ulrik » Tue Aug 16, 2016 8:39 pm

Fazek, the latest version works just fine here, even if I move the csv file and the layers to another location. TVP Pro v.10, Moho 12, OS X 10.11.6
Thanks once again for this script!
Regards Ulrik
User avatar
cartoonmonkey
Posts: 80
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 » Fri Aug 19, 2016 12:31 am

Working well with TVP 11 Pro!
Cheers!
C
User avatar
cartoonmonkey
Posts: 80
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 » Fri Aug 19, 2016 5:22 pm

Now if only Moho would export CSV as well...
:-D
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 » Thu Aug 25, 2016 8:14 pm

cartoonmonkey wrote:Now if only Moho would export CSV as well...
:-D
Actually it's not a completely impossible wish. But only if Moho is able to render the current frame from lua. I'll check the possibilities, it's a good idea.
- - - Fazek
User avatar
synthsin75
Posts: 7155
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

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

Post by synthsin75 » Thu Aug 25, 2016 9:56 pm

Fazek wrote:
cartoonmonkey wrote:Now if only Moho would export CSV as well...
:-D
Actually it's not a completely impossible wish. But only if Moho is able to render the current frame from lua. I'll check the possibilities, it's a good idea.
moho:FileRender(path) renders the current frame to the image format given in the path file name extension.
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 » Sat Aug 27, 2016 6:50 pm

A new experimental export plugin is avaliable now. I've also fixed the import plugin: importing layers with empty first frames was buggy.

About the export plugin: It exports the top level layers as separate layers. If a top level layer is a group, the plugin renders its contents together. But it expands top level group layers if the group has no masking and it contains switch layers only. Basically this is the "inverse" of the import plugin. If a layer is a still picture (vector or image), it tries to render only the changes. If the layer or the camera has ANY animated keys, it renders all frames of the layer separately.

The the render window shows up for each exported image with an annoying beep sound (at least for me). So it's flashing and beeping like crazy during exporting. Sorry for that, I don't know yet how to avoid it.
- - - Fazek
User avatar
synthsin75
Posts: 7155
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

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

Post by synthsin75 » Sat Aug 27, 2016 7:11 pm

Fazek wrote:The the render window shows up for each exported image with an annoying beep sound (at least for me). So it's flashing and beeping like crazy during exporting. Sorry for that, I don't know yet how to avoid it.
I don't think there's a way to avoid that. The user can disable audio feedback in the preferences if the beeping is really annoying.
ulrik
Posts: 1074
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

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

Post by ulrik » Wed Aug 31, 2016 10:18 am

When exporting csv from Moho on OS X, is there a way to stop the rendering?
I ask because I started a csv export from a big project and while rendering I noticed that I had forgotten to fix a layer and wanted it to stop,
I tried with esc and command+. but I had to use force quit

Regards Ulrik
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 » Wed Aug 31, 2016 12:53 pm

Hello Ulrik,

To do such things like capturing keystrokes, processing dialog messages etc. the script should return the control back to the main program and gain it again during the rendering. This is a simple menu script with a linear workflow. The user control you want is perhaps possible, but these things are making the code very complicated. Perhaps instead of tricks, there supposed to be an official way to abort runaway lua scripts nicely, without quitting the program.
- - - Fazek
ulrik
Posts: 1074
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

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

Post by ulrik » Wed Aug 31, 2016 1:45 pm

Ok, I understand, thanks!

Regards Ulrik
User avatar
synthsin75
Posts: 7155
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

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

Post by synthsin75 » Wed Aug 31, 2016 5:21 pm

I noticed in the code that you were looking to get the Moho version:
const char *AppVersion()

Yeah, I can't think of anyway to allow the user to interrupt the rendering without also making them babysit the rendering by periodically telling the script it's okay to continue.
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 » Wed Aug 31, 2016 5:39 pm

Hello synthsin75,
Yes, I noticed it too and probably I will change the current (.moho vs. .anme) solution to that.

About the abort functionality: perhaps if i exit the script after each rendered frame and force the system somehow to call it back again for the next frame... but it seems difficult.
- - - Fazek
Post Reply