Hi guys!
I wonder, if someone is interested to write a script for importing JSON format generated by COA Tools?
Short explanation:
COA Tools is used to export layered artwork from Krita/GIMP to separate (cropped) PNG images + it creates a JSON file, which contains information how those layers are located relatively to each other.
The information from JSON file allows to automatically assemble those exported PNGs in Blender/Godot or other software.
We need this script as we want it to use during production of Pepper&Carrot Episode 4.
Help is much appreciated!
I would like to work on this, but I am not sure if importer plugins are supported in stable version (1.4.2). This might be possible in development version (1.5.1). I will try to get the development version.
Will you be using development version ?
Till when should I complete the script ? (any deadline ?)
I am trying to understand the JSON file, some fields like tiles_x, tiles_y, children, frame_index, type, doesn’t seem useful, or are they ?
One thing I noticed is, if more than one image have same z-index we should put them in Switch Group Layer. I will write a simple script so that it can import with necessary information and will ignore the things that I didn’t understand.
@KonstantinDmitriev if you have anything exported to the JSON format and files, that you would use please provide it here so that I can work with real examples.
Yeah, I saw the video (Devlog by the developer), I didn’t know anything about it, I have worked on script.
I am having problem with Python, whenever I run any plugin I get this error
(Synfig 1.5.1, Windows 11, I think this happens with development version)
I have setup the SYNFIG_PYTHON_BINARY path variable. And then this error started. (I have set to python3 exe)
I will test this later on Ubuntu VM.
@KonstantinDmitriev I have wrote this script, hopefully it works (still need a lot of work), this can now only import images and arranges them on their position. I have decided to put the image in single groups, and have enabled lock selection by default.
The control handles are at the top left of the sprite (image), I will work on that so that the control duck would be on the center.
I tested it on my Ubuntu VM, one thing I understood is importer plugin don’t import but open files from other format, so initially I thought the data will be appended in already existing which is not true, so now some changes need to be done in case of canvas view-box.
One important thing I forgot to mention is that my plugin requires pillow package in python, I don’t know how to package the program to have all the dependency, sorry for that
Also it also have some problems with path which I fixed, if any problems please report I will fix as soon as possible. coaTools(pathFix).zip (2.3 KB)
It even correctly handled Cyrillic characters in my test file.
Though, I found one issue, which turned to be related with tile_x and tile_y parameters.
Here is a sample file - 005.zip (21.7 KB)
It is imported like this -
I will take a look into this and will soon post a solution, seems a little difficult, like where should we store the spliced images ? Or maybe not split the images at all but create a rectangular revealing mask and duplicate the layer n times and mask the layer. Duplicating the layer seems good, and not hard, I will go by this approach
1.duplicate the layer based on the tiles
2.Create rectangular revealing mask around each tile
3.Put them in a switch layer with proper positioning.
Both files are imported into Blender correctly (both have correct layer order) -
…but here is how they are imported into Synfig with the latest version of the plugin (one file imported with correct layer order, other file is imported reversed) -
I guess, the layer order works somehow different, maybe it depends on order of items in JSON file?
Just in case if you need, here I am attaching code of plugin that I used for importing in Blender - coa_tools.zip (593.8 KB)
They have provided the z parameter in JSON, which I didn’t previously consider.
JSON does preserve the order, but the exporter work different maybe, the Krita exporter might export in correct format, while GIMP exporter might not do so, that’s why they have the z parameter.