ndee85 / coa_tools

COA Tools is a 2D Animation Suite for blender. It offers a 2D cutout animation workflow similar to programs like spine or spriter.
GNU General Public License v3.0
893 stars 139 forks source link

Gimp export #4

Open robbibob opened 8 years ago

robbibob commented 8 years ago

Hi, are there any plans for a gimp exporter?

NathanLovato commented 8 years ago

This would only happen if some Gimp user was to do it I'd say. Andreas took a look at the ORA file format to import in Blender, which you can save in Gimp, Krita and MyPaint. But splitting up an ORA file (it contains all of your Gimp/Krita layers + XML data) in Blender is not as easy as using the JSON format and individual sprites.

robbibob commented 8 years ago

Ok I understand, thanks answering. Btw I like the way the Inkscape similar thread is heading sounds like a possible solution

ragtag commented 8 years ago

I've started working on a GIMP exporter, which I hope to finish within two to three weeks. It's currently in a broken state, but if you want you can check out the progress in my forked branch here: https://github.com/ragtag/coa_tools/tree/gimp

Once done and tested, it can hopefully be merged back into the main development tree and become a part of CoaTools.

I did a quick test with Layer Groups and the OpenRaster (.ora) GIMP exporter/importer, and it seems to flatten Layer Groups. I don't know if this is a limitation of the OpenRaster format, or of the GIMP exporter/importer. If it's the former, OpenRaster may not be a good option, as Layer Groups are used for sprites with multiple frames in CoaTools (e.g. different mouth shapes, blinking eyes etc.).

ndee85 commented 8 years ago

Hi ragtag, that sounds great! I would really love to merge a GIMP exporter to the coa tools! I want to change the export format a tiny bit. So its more like the one that is exported from blender. That way we could also directly import the ps or gimp exported json file into godot. I will write a specification how that format has to look like. Changes will come in the next days!

Thanks for you effort ragtag!

ndee85 commented 8 years ago

@ragtag I would propose this new export formatting for sprite export. This is what the blender exporter also exports. I think its better to unify the json and blender json file. This will mean less confusion in the future. What do you think?

The really important keys for the exporter are: name, resource_path, position, tiles_x, tiles_y and thats it. The other values would be still good to be in just to have a more complete description of a sprite.

`{

"name": "ObjectName",

"nodes": [

    {

        "name": "layer_name.png",

        "type": "SPRITE",

        "node_path": "layer_name.png",

        "resource_path": "sprites/layer_name.png",

        "pivot_offset": [0,0],

        "offset": [0,0],

        "position": [0,0],

        "rotation": 0.0,

        "scale": [1.0,1.0],

        "opacity": 1.0,

        "z": 0,

        "tiles_x": 1,

        "tiles_y": 1,

        "frame_index": 0,

        "children": []

    },

    ...,

    ...

]

}`

ragtag commented 8 years ago

@ndee85 That looks fine. I haven't gotten to writing out the json yet, so it wont affect my code yet. Some of the values, such as rotation and scale will have fixed default values when exporting from GIMP or Photoshop, but it's good to have them there if you want to make the format consistent with the one exported from Blender.

Btw, I've sort of had this plan at the back of my todo list to write a cut-out animation tools for Blender for a couple of years, but now you've done the work for me. :) So thank you for writing it CoaTools and sharing it with the community, it's a great tool. Hopefully we'll see some cool 2D games and cut-out animations produced using it soon.

On Thu, Mar 17, 2016 at 10:34 AM, ndee85 notifications@github.com wrote:

@ragtag https://github.com/ragtag I would propose this new export formatting for sprite export. This is what the blender exporter also exports. I think its better to unify the json and blender json file. This will mean less confusion in the future. What do you think?

{ "name": "ObjectName", "nodes": [ { "name": "layer_name.png", "type": "SPRITE", "node_path": "layer_name.png", "resource_path": "sprites/layer_name.png", "pivot_offset": [0.0,0.0], "position": [0.0,0.0], "rotation": 0.0, "scale": [1.0,1.0], "opacity": 1.0, "z": 0, "tiles_x": 1, "tiles_y": 1, "frame_index": 0, "children": [] }, ..., ... ] }

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/ndee85/coa_tools/issues/4#issuecomment-197788587

ndee85 commented 8 years ago

@ragtag awesome. Really looking forward to your contribution! If we have a gimp exporter we have at least one open source solution which is great! People who use krita can then exort to .ora and use gimp for an export if needed. Seems boud is willing to also write an exporter for krita once he has finished the exporter for spriter.

I have finished the ps exporter changes. And also added that changes to the Blender Sprite importer. Will probably push everything tonight.

I needed something like that in blender, because I am using cutout animation at work alot. And AfterEffects Puppet tool was just to limited. Glad I can share with you guys. Awesome that there are first contributions!

ndee85 commented 8 years ago

@ragtag just for info. I have pushed all changes to the json format now to github. So importer and exporter are now using one format. As described at the top.

OBKF commented 8 years ago

Great news :) this is really awesome, now we have the possibility to make everything in open-source softwares, and easier than ever

ndee85 commented 8 years ago

hey @ragtag, just wanted to ask how your work is going on the gimp exporter? I have seen you have commited something lately.

ragtag commented 8 years ago

I got some work done on the plane back from Iceland on Wednesday. :)

It's almost there. It exports the sprites and sprite sheets seemingly correctly, and writes out the json file. While resulting file imports into Blender, there are some slight offsets that I need to fix. The UV's on the sprites overlap by a couple of pixels, and the sprites are not positioned correctly relative to each others. It's just some math in my code I'm getting a bit wrong, which I'll hopefully find time to fix this weekend.

ragtag commented 8 years ago

I need to test it a little bit more, beyond using random programmer art, but I think everything is working as it should now. I've merged it with my master branch, and updated the README with some installation instructions. I'll do a bit more testing, and send you a pull request once I'm sure everything is working as it should.

I've mainly tested it using GIMP 2.8.14 under Linux, but did a quick test under Windows 10 and it seemed to work fine there too. I haven't tested it on OSX, but I see no reason it shouldn't work there too.

If anyone wants to test it, you can find it here https://github.com/ragtag/coa_tools. You only need the GIMP/coatools_exporter.py file, the rest is the same as ndee85's version of CoaTools. If you find any issues, please post them here.

ndee85 commented 8 years ago

@ragtag awesome job!!! Just made a quick test with some simple stuff, works perfectly! I am going to port my sample character to gimp and then try the export with it again. I will write again once I tried it.

Thanks alot for your work ragtag! I think Gimp users will love that exporter! :+1:

IBwWG commented 8 years ago

@ragtag I just tried your exporter in GIMP 2.8.16 for Windows, but unfortunately, I don't see the new option in the File menu. I put it in the exact same location (per the instructions) as I had put another plugin, Export Layers, which works. Also, there are no complaints in the Error Console, and it doesn't show up in the Plugin Browser. As a check (in case the Export Layers plugin was somehow preventing Export to Coatools from showing up) I moved the Export Layers plugin files elsewhere, and they stopped showing up, but Export to Coatools still did not show up, even though it's the only file in the plugins folder. Any ideas?

ragtag commented 8 years ago

@GimmickyApps I just installed GIMP 2.8.16 on Windows 10 (64bit), and it ran fine, I had been testing with 2.8.14 previously. The option should show up between 'Save as...' and 'Create Template...' in th File menu. You can also check in the Help>Plug-in Browser menu, and search for 'coa'.

Just a couple of thoughts. Have you installed GIMP with Python support (I think this is the default, so most likely you have). I'm not sure how GIMP looks without Python, but you can open the Filters>Python-Fu>Console, and enter 'print("Hello world")', to check. Without Python support, I guess the Python-Fu menu item will be missnig.

Secondly, are you running Windows and/or GIMP in another language than English? I don't think this should affect anything, but you never know.

Finally, if you're running a very old version of Windows, like XP, I guess the install path is C:\Documents and Settings\YOU.gimp2.8\plug-ins, but since you're seeing the Export Layers plug-in, I guess the path is correct. Btw. is the Export Layers plug-in written in Python or Schema?

Other than that I'm really not sure what is going on.

IBwWG commented 8 years ago

@ragtag Unfortunately as I said (under the name GimmickyApps--since changed) it doesn't show in the plugin browser menu (also searching for 'coa'), and my File menu doesn't have it: gimp-menu That is a good thought about Python support, because I had not initially installed it that way. However, that is a hurdle I had already overcome in order to get the Export Layers plugin working correctly, which is written in Python as well, to answer your later question. To confirm, the Python console is present in the Filters menu too.

My Windows and GIMP installs are both English, but I hadn't thought of that. :)

It's Windows 7, x64. Sounds like we have a fairly similar setup? I'm a bit at a loss too then.

ragtag commented 8 years ago

@IBwWG That's really strange. Both me and ndee85 have gotten it to run under Windows. To be honest, I'm a bit lost for solutions here, as I can't recreate the bug on my end.

@ndee85 I've sent you a pull request with the changes. I synced my branch with yours, so the only changes is the added GIMP exporter, and a slightly update README.

I also did a quick test of the whole pipeline, creating a nerdy flamenco. I've attached the file, which includes a GIMP .xcf file, the exporter .png and .json files, plus a rather primitively rigged Blender character. I am putting the flamenco in the public domain, so anyone can feel free to use it however they like.

GIMP_Sample_Files.zip

IBwWG commented 8 years ago

Thanks for trying. I'll try a fresh GIMP reinstall next time I'm at it with coatools again and give it a go. Thanks for writing the exporter!

shturm commented 7 years ago

@IBwWG @ragtag Thanks for you contribution !

I had similar issues with GIMP exporter and the mentioned "Export Layers" plugin on both Windows 10 64bit and Ubuntu 14.04 64bit.

On Windows:

On Linux: