I wrote a conversion program (python) like the title. There are some parts that are not good, but I will publish it because there seems to be demand now.
suv2spine https://github.com/harayoki/suv2spine
SpriteUV2 has an excellent function of integrating multiple Spine data, but it does not export the mesh data generated by itself as data that can be imported by Spine. (Why!) Well, I believe that it will be supported from now on, but when I check the contents of the json data to be written out for general purposes, it is relatively close to the data format that can be read by Spine, so it is possible to perform conversion processing with a simple program. I can do it.
The point to note here is that when comparing the two data
That's about it. The last item will be described later.
First, generate a mesh with SpriteUV2 and export it as json data together with atlas data.
Download the python script on github (https://github.com/harayoki/suv2spine/blob/master/suv2spine.py), give execute permission, and then execute the conversion process.
./suv2spine hoge.json
hoge.json
is a json file exported by SpriteUV2. This process will generate a converted file called hoge_out.json
. (You can also specify the output file name with the -o option. For other options, refer to the README on the github side.)
Launch Spine and select ʻimport Data` from the Spine menu.
The import dialog will be displayed. Select the json output by the converter and press OK. You can also adjust the import size and specify the skeleton name after importing here. Now, if you want to add a skeleton to your current project instead of creating a new project, uncheck New Project
.
A warning will be displayed in a dialog like this here, but since this is the specification of this conversion program, it is OK as it is. The content of the warning is something like "It seems that the data of the mesh outline and mesh dividing line has not been exported, so it will be recreated automatically".
The loading is completed like this. If the image is out of reference and only the mesh shape is displayed, please set it again manually. Reset the path to the Images folder, but select the mesh to change the displayed path.
First of all, this converter does not support conversion of multiple meshes. Perform the conversion for each mesh. (If multiple meshes are included in the SpriteUV2 export data, only the first one will be converted.)
Also, if you load a very fine mesh, the outline shape may become strange. In this example as well, the shape on the left side of the head horn is strange.
If that happens, I think it will be necessary to adjust the mesh on the SpriteUV2 side or the Spine side. Also, although it is okay in the above, the gap between the legs was sometimes recognized as part of the mesh. It may be better to prepare the original image so that holes will not be opened when setting the mesh as much as possible.
The reason for this problem is that on the Spine side, in addition to the vertex data list, we expect that there will be a list of outer vertices (hull) and line segment (edges) data connecting the vertices. However, it is difficult to reproduce the data from the json that SpriteUV2 spits out. For the time being, they are not essential data, but data that can be automatically generated by Spine (the warning in the previous dialog that I will do it), so even in this case it will work like that, but automatic generation is If it doesn't work, it seems that the above situation will occur.
It's been about 10 years since I wrote decent Python code, so please keep an eye on it. mm
In the first place, it would be nice if Spine's automatic mesh generation function seems to work, or SpriteUV2 supports Spine data export. Regarding this tool, if there is demand, it may or may not support conversion of multiple meshes.
Recommended Posts