• Editor
  • packing textures using cli

Hi all. I'm struggling with the CLI, maybe someone can tell me what to do.

There is a project in it, for example, pants. The options for pants are endless - they all fit 1 mesh. Using a skin for each option is not suitable because their number is infinite.

One thing - one atlas.

I specify different commands in the cli, but I still couldn’t get an atlas that takes according to the mesh.

skeleton.png - correct atlas received via export from the application
pack.png - what I get through the CLI

I need a command with which I can specify the folder for the art and get the correct atlas from it and so that it packs the atlas according to the mesh. I don't need to export the entire project, because... In addition to pants, there are a lot of other objects and catching the right atlas will not be easy.

Spine -i SpineFolder\images\j\01 -o SpineFolder\export -p skelt

I used this one, tried adding a link to the spine file via -j. I tried adding settings files to -p, but the result did not change

Related Discussions
...

To pack textures using the CLI while taking into account the mesh, you need to ensure that the texture packer is aware of the skeleton's attachments. This can be done by specifying the project file using the -j or --project parameter. Here is an example command that should help you achieve the desired result:

Spine -i SpineFolder/images/j/01 -o SpineFolder/export -j SpineFolder/project.spine -p SpineFolder/pack.json

Here's a breakdown of the command:

  • -i specifies the input folder containing the images.
  • -o specifies the output folder where the atlas and PNG files will be written.
  • -j specifies the path to the Spine project file to determine which images are used by meshes.
  • -p specifies the path to the pack settings JSON file.

Make sure your pack.json file is correctly configured to match your needs. You can create this file using the Spine Texture Packer settings dialog and save it.

If you still encounter issues, ensure that your project file and images are correctly set up and that the paths are accurate.

For more detailed information, you can refer to the Spine Command Line Interface User Guide.

Unfortunately, the atlas is still different from what I receive through the application.

My command looks like this, the files are all in place, checked many times.


Spine -i G:\Projects_Tile_tests\atlas\images\j\01 -o G:\Projects_Tile_tests\atlas\export -n Test -j G:\Projects_Tile_tests\atlas\atlasTest.spine -p G:\Projects_Tile_tests\atlas\pack.json

Here is another example and it shows that if the mesh was taken into account when packing, then there should have been an indent from the edge of the image in cli.png

I also attach the code from pack.json

The problem is specifying the path to the pictures - this path should be like in the images folder. Those if I want to generate only pants, then I specify the path to the images folder, and delete everything else from it.

Spine -i G:\Projects_Tile_tests\atlas\images -o G:\Projects_Tile_tests\atlas\export -n CLI -j G:\Projects_Tile_tests\atlas\atlasTest2.spine -p G:\Projects_Tile_tests\atlas\pack.json

    aivan3d

    Are you sure you are using the exact same export configuration (pack.json) when exporting from the Export option and using the CLI? Try to load your pack.json when you are exporting using the Export option by clicking Pack Settings and Load.

    As far as I understand, you are trying to generate image atlases (PNG) with the same structure as the image atlas exported by the Export project option.

    To ensure the texture packer or the CLI packs in the same way, the input image folder you provide must contain the exact structure of your original image folder, with the same names and folders. Otherwise, Spine won't be able to associate the images with the regions and pack them in the same way. Please note that if the images have different sizes, you might encounter undesired results.

    Under these circumstances and with the same export configuration (pack.json), the atlas image should have the same layout.

    The -j parameter is how Spine finds the meshes in your project for consideration when packing. Your first post didn't have it, but your later post does so that should work. Note that is only used if you are packing polygons, which the (image of) your pack.json shows you are doing.

    The only thing I can think of is that you aren't specifying the same input path as your images folder. If you specify a subfolder in your images folder, the paths won't match your meshes. However, we improved this in 4.2.18+ so it should still find your meshes. What version of Spine are you using to do the packing?

    Thanks for the help.

    I already answered a little higher that it was on the way to the pictures. I thought that I could specify a specific landmark, but now I know that I just need to indicate the root. It's not a big problem, but it's not obvious. 🙂

    Spine version is 4.0.64 and I won’t be able to update because this will break the animations from the project.

    You can use a newer version of Spine to pack your atlas, for example by adding -u 4.2:

    Spine -u 4.2 -i G:\Projects_Tile_tests\atlas\images\j\01 ^
    -o G:\Projects_Tile_tests\atlas\export ^
    -n Test ^
    -j G:\Projects_Tile_tests\atlas\atlasTest.spine ^
    -p G:\Projects_Tile_tests\atlas\pack.json

    The resulting atlas will be compatible with 4.0 runtimes.