• Editor
  • Importing PSD after renaming the root bone causes an error

Good day,
I don't even know if this should be considered as a bug, probably just needs better communication from Spine.
I accidentally renamed the root bone and then tried to import a PSD directly. Spine gave me an error saying "Please provide a PSD file". It was a perfectly valid PSD file, and after an inspection of the log, it turned out the error was that it wasn't able to find the root bone in the project:

ERROR: Error importing skeleton data file: /tmp/.spine/fabiano/psd.1e0f5bc88f7bfa2e.json
Si prega di inserire un file PSD.
[error] Bone not found: root
   at s.ROE.<init>(_:83)
   at s.smP._(_:503)
   at s.smP._(_:417)
   at s.WnT.I(_:321)
   at s.WnT._(_:312)
   at s.Ylk._(_:313)
   at s.dNJ._(_:89)
   at s.nyE.run(_:247)
   <events>

So I promptly restored the root's name, and the import went fine.

It makes sense, but shouldn't it explicitly say that it needs the root bone? Or alternatively, shouldn't it create a new root bone in the origin? Or again, couldn't it just use the first bone in the hierarchy?

    Related Discussions
    ...

    Good day,

    The issue you're experiencing with importing a PSD after renaming the root bone is indeed related to how Spine handles the root bone during the import process. As you discovered, Spine expects a bone named "root" to be present in the skeleton when importing data. If this bone is renamed or missing, it results in an error.

    Your suggestions for improving the error message or handling the missing root bone are valid. Here are a few points based on the provided contexts:

    1. Error Message Improvement: The error message could be more explicit about the requirement for a root bone. This would help users understand the issue immediately without needing to inspect the log file.

    2. Automatic Root Bone Creation: Spine could potentially create a new root bone at the origin if it doesn't find one. This would streamline the import process and reduce errors.

    3. Using the First Bone in Hierarchy: Another approach could be to use the first bone in the hierarchy as the root if a bone named "root" is not found. This would provide more flexibility in naming conventions.

    Currently, the best practice is to ensure that the root bone is named "root" before importing a PSD file. This is a known limitation, and improvements in this area could be considered for future updates.

    For now, you can track related issues and updates on the Spine GitHub repository, such as the Import Data into existing skeleton and Duplicate constraints.

    Fabiano Thank you for your report! I was able to reproduce the issue, and since the root bone name can be changed, I think this should be considered a bug, so I have created an issue ticket here for a fix:
    EsotericSoftware/spine-editor825