CoaTools import

I am not sure about tiles_x and tiles_y, never used them…

Probably it is for spritesheet.
tile x and tile y would be the sprite size and frame index the sprite index in the sheet.

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)
image

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.

coaTools.zip (1.7 KB)

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)

3 Likes

Hi @veermetri05! Thank you so much! For some reason I didn’t received notifications about the replies in this topic. :sweat:

Will test it and report back. Thank you so much!

I have tested and it works! -

It even correctly handled Cyrillic characters in my test file. :slight_smile:

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 figured out that importer should split the image into tiles and put the tile pieces into switch group.

That’s all so far. Thank you so much for the great work!

2 Likes

I’ve just found one more issue, the layers are stacked in the wrong order when importing this file - 001.zip (2.3 MB)

Here is a video demonstrating the problem -

1 Like

I put all the layers in a list, so that I can reverse it, but stupidly I just forgot to reverse the list.

coaTools(reverseListFix).zip (2.2 KB)

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.

1 Like

Yes, I think this will be good solution!

Thank you! :slight_smile:

@veermetri05
I still have strange situation with order of layers.

Here are 2 sample CoaTools scenes for import:

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)

Thanks for detailed explanations.
I figured out why this occurs, I have to reorder them based on the z parameter and then reverse them.

coaTools.zip (2.2 KB)

I still need to implement the tiles.

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.

1 Like

Great, the order issue is fixed now! Thank you!

I suggest to create a PR on GitHub to include this plugin into Synfig. Can you do that, please?

Hi @veermetri05 ! How are you? If you need any help with preparing the PR - let me know, I will be happy to assist. :slight_smile:

I do actually need help with the PR, but I will implement the Tiles support, I will do it by today.
Also I will work with Joystick Plugin and make a PR for that, after I complete this.

1 Like

Great! I just want to mention that it is not required for PR to be 100% complete in terms of features. For example, you can submit PR for CoaTools plugin “as is” and then submit another PR for tiles support (when it will be ready).

Regarding help with PR - please describe the problem and I will be happy to help! :slight_smile:

Hey @veermetri05, how is it going with PR? :slight_smile:
Please let me know if I can help somehow.

Really looking forward to it!

Hi @veermetri05! If you do not have time for PR, maybe we can find someone who can make it instead of you? For that I just need your permission to publish your CoaTools plugin under GPLv3 license. Please let me know what you think… :slight_smile:

1 Like

I am okay with this.

I hereby, give permission to @KonstantinDmitriev and other developers, to publish the plugin under GPLv3 license, modify, use any code or algorithms, that I have provided or discussed on this thread related to development of CoaTools import plugin.

If I get time I will try to implement the tiles feature :sweat_smile:.

3 Likes

Thank you so much! :slight_smile:

A little update to the plugin: coaTools.zip (3.4 KB)

  • Added ability imports layers with tiles property, giving user all the contents wrapped in a Switch Layer

I apologize for reviving old topics :pray:

Todo

Todo:
Properly package the library, currently this package depends on Pillow package which isn’t installed by default in Python, need to deliver the plugin with all the dependencies within them. I still need to understand the process for it.
Hoping to give a single zip file that user just puts in the plugins directory without worrying about the dependencies

2 Likes