• Editor
  • Spine CLI Export Option for specific skeleton

I'm trying to update Spine from version 4.1 to 4.2 using the CLI and export the projects.

However, I have encountered an issue. Some Spine files contain multiple skeletons, and some of these skeletons are set not to be exported. I suspect this is because the artists manually export only the skeletons with changes and save those settings.

If there were only a few Spine files, it would be easy to fix manually, but we have around 200 Spine files. Manually exporting each time there is a version update is very difficult.

For this reason, I would like to have an option in the CLI to either 'ignore the export settings and export all skeletons' or 'ignore the export settings and export only specific skeletons' when dealing with Spine files that contain multiple skeletons.

    Related Discussions
    ...
    • Düzenlendi

    To address your issue of exporting specific skeletons using the Spine CLI, you can use the command line interface to automate the export process. Unfortunately, there is no direct option to ignore the export settings and export all skeletons or only specific skeletons directly from the CLI. However, you can achieve this by using a combination of JSON or binary data files and the CLI.

    Here are the steps you can follow:

    1. Export the project to JSON or binary format:
      Export your Spine project to a JSON or binary file. This will include all skeletons in the project.

         spine -i /path/to/project.spine -o /path/to/output/ -e /path/to/export.json
    2. Edit the JSON or binary file:
      Modify the JSON or binary file to include only the skeletons you want to export. You can write a script to automate this process if you have many files.

    3. Import the modified JSON or binary file and export:
      Use the CLI to import the modified JSON or binary file and export the skeletons.

         spine -i /path/to/modified_skeleton.json -o /path/to/output/ -e /path/to/export.json

    Alternatively, you can use the CLI to export all skeletons by ensuring the Export checkbox is checked for all skeletons. This can be done manually or by writing a script to modify the project file.

    For more details on using the CLI for exporting, you can refer to the Spine User Guide: Command line.

    For further automation, you can create a script that iterates through all your Spine files and performs the export process.

      Sekomu You can enable the Export alloption, but this is only available in the JSON export:

      In the .export.json file, you can add "all": true like the following:

      {
      "class": "export-json",
      ...
      "version": null,
      "all": true,
      "output": "",
      ...
      }
        • Düzenlendi

        Misaki

        Thank you for your response.
        I did not notice that the "Export All" option had been added.

        However, there seems to be an issue with it as well. I tried adding "all": true, but it did not work.
        (And if possible, I would like to use "all": true when performing a binary export as well.)

        <Deleted>

        Here is the file I used for testing.

        spine.zip
        1kB

          Sekomu Thank you for reporting the problem! I will check if I can reproduce it, but it seems that the version of Spine launcher you are using is quite old, so we would appreciate it if you could update it to the latest launcher for now. To update the launcher, install the latest installer from the Spine licensing page and reinstall Spine.

          Sekomu I checked and it seems to be due to the incorrect order of properties in the .export.json file: "all": true should be under "version": and above "output":. As long as I rearranged them in the correct order and ran the export, it worked fine. The full contents of the .export.json file are as follows:

          {
          "class": "export-json",
          "extension": ".json",
          "format": "JSON",
          "prettyPrint": true,
          "nonessential": true,
          "cleanUp": false,
          "packAtlas": null,
          "packSource": "attachments",
          "packTarget": "single",
          "warnings": true,
          "version": null,
          "all": true,
          "output": "",
          "id": -1,
          "input": "",
          "open": false
          }
          • Düzenlendi

          Sekomu By the way, the video you attached had your Spine license information on it, so I removed it to protect your license information.

          As for the suggestion to add "all":true even in the binary format, I have created an issue ticket here:
          EsotericSoftware/spine-editor812
          You can subscribe to this issue ticket to receive notifications when there is any progress on this issue.

            Misaki
            I updated the Launcher and corrected the order of the JSON file, but the export still did not work.
            The previously attached Test.spine file was saved with the Export✅ setting enabled, so I am attaching the file again. I believe this attachment will help reproduce the issue.

            spine2.zip
            944B

            without Export✅ in Test.spine

            C:\Workspace\Spine>spine -i Test.spine -o . -e exportAsJson.json
            Spine Launcher 4.2.17
            Esoteric Software LLC (C) 2013-2024 | http://esotericsoftware.com
            Windows 10 Pro amd64 10.0
            Starting: Spine 4.2.33 Enterprise
            Spine 4.2.33 Enterprise
            Licensed to: <removed>
            JSON export: Test
            Complete.

            with Export✅ in Test.spine

            C:\Workspace\Spine>spine -i Test.spine -o . -e exportAsJson.json
            Spine Launcher 4.2.17
            Esoteric Software LLC (C) 2013-2024 | http://esotericsoftware.com
            Windows 10 Pro amd64 10.0
            Starting: Spine 4.2.33 Enterprise
            Spine 4.2.33 Enterprise
            Licensed to: <removed>
            JSON export: Test
            Images path not found: ./images [skeleton2]
            Images path not found: ./images [skeleton1]
            Complete.

            and...
            Thank you for removing my personal information. You saved my life.🙇‍♂️

              Sekomu Indeed, I was able to reproduce the problem with the Spine project you sent me. I am sorry that the order in the JSON file did not seem to be a problem! I'll create an issue ticket to fix this.

                Misaki Thank you so much for taking the time and effort to verify it, Misaki!

                  Sekomu I have not created an issue ticket, but wanted to let you know that Nate is already working on this issue. I will let you know when the fix is complete!

                  bir ay sonra

                  Sekomu Sorry for the wait on this issue. In the recent release of Spine 4.2.34, the parameter --export-all is now available, which allows you to export all skeletons, whether you want to export them in JSON or binary format. (Please ignore that I previously told you that this can be set in the export settings JSON file, just add this parameter.)

                  3 ay sonra

                  Spinebot
                  I'm not seeing a --skeleton command line option

                    stupot Your point is correct, sorry I missed Spinebot's incorrect response! The command line option --skeleton does not exist, edited Spinebot's answer.

                      Misaki that option would still be good though, thats how I ended up here, looking for a way to target specific skeletons for export easily. Specifying a skeleton to override default behaviour would be great, specifying a list of skeletons even better (or multiple --skeleton). Whats mentioned in the above solution, to export and edit etc, although appreciated, is more of an impractical workaround than a realistic solution.

                        stupot Hmm, when I read your suggestion, I thought for a moment that we might consider adding a way to specify the export target skeleton via the CLI, but I can't think of many cases where that would be very useful. In Spine, whether exporting via the CLI or not, you cannot specify the target skeleton when exporting skeletons in JSON or binary format unless you uncheck the skeleton you want to exclude from the export. In many cases, exporting skeleton data is very fast, even if there are many skeletons in a single project, so re-exporting even unrelated skeletons should not be a big problem.

                        When exporting animations in image or video format, you can specify the target skeleton in the export configuration JSON file. I wonder if what you are referring to is the hassle of editing the export settings JSON file to export a specific skeleton when exporting in image or video format.
                        I would appreciate more details about your current workflow, preferably in a new thread.

                          Misaki Hi, it would be very handy for me if a single skeleton could be exported from a spine containing many skeletons, without any editing or unchecking exports.

                          In my use case, a spine could have many skeletons, each exporting with multiple variants, which then triggers creation of multiple image formats. So that generates a lot of image files (some quite big) and avif's aren't quick to generate. So for just one small source edit, this would generate a lengthy asset creation which would also hammer the source control for a lot of files that haven't really changed.

                            stupot Thanks for the additional clarification! As expected, this seems to be a fairly complex case, but I thought it might be worth considering and have created an issue ticket for it:
                            EsotericSoftware/spine-editor854
                            You can subscribe to this issue ticket to receive notifications when there is any progress on this issue.