• Editor
  • Relative path not handled correctly

Related Discussions
...

When we import a json file (exported with the photoshopToSpine script) with a relative path to the image folder, the path is not recognized correctly once in spine which forces us to use an absolute path.

Our json file :

json
{ "skeleton": { "images": "./images/" },
"bones": [
  { "name": "root" }
],
"slots": [
  { "name": "arm_R", "bone": "root", "attachment": "arm_R" },
  { "name": "torso", "bone": "root", "attachment": "torso" },
  { "name": "arm_L", "bone": "root", "attachment": "arm_L" },
    

Also, when moving the spine project files and the image folder from one computer to another for example the paths don't work anymore...
Would it be possible to manage relative path to the image folder in spine project file?

Thanks in advance.

Spine does manage relative and absolute paths just fine. You have to save your Spine project next to the images folder for the relative path in the images node to work.

Ok indeed I had not tried to save the project after importing the json and before correcting the path. It seems to work. It's a bit strange behavior that the relative path becomes good again after saving. It seems to work like this (saving before changing the path)

However, it remains broken when I move the spine project (from one folder to another keeping the relative structure of the image folder) and the relative path becomes absolute and therefore not good when I reopen the project elsewhere.

Am I doing something wrong? How can I correct this?
Thanks

Hello,
the project appears broken because to be relative, it has to be relative so a certain position, and this position is not defined until you save, this is why the images appear missing until the first save.

When moving the Spine project around, my recommandation is to put the images folder and the spine project inside a folder and move said folder to avoid the problem altogether. Otherwise the same principle applies, the relativeness is in retationship to the project position, and you can either write it manually to be so or to be absolute and therefore retrieve images at a specific location regardless of where the project is saved.

To change the images path, make sure to be in Setup mode, then click on the images node, you'll be able to input a path in the path field, or click on the folder icon to have Spine write it for you.
Images - Spine User Guide: Images path

14 天 后

Hello,
I'm coming back to the topic because I get an error when I move the spine project and the image folder from one folder to another. The initial relative path in the spine project becomes absolute without changing anything.

I have the problem only when I create the project from the spine CLI with the python script below:

def CreateSpineProject(jsonPath, verbose=False):
    # http://fr.esotericsoftware.com/spine-command-line-interface#Import
    outSpinePath = jsonPath.with_suffix('.spine')
    exportProcess = subprocess.run([
        "Spine",
        "-i", jsonPath.as_posix(),
        "-o", outSpinePath.as_posix(),
        "

---

import"
        ], capture_output=True)

if verbose: print(exportProcess.stdout.decode("utf-8"))
return outSpinePath

The relativity doesn't seem to be related to the position of the project or I'm miss something.

When I create the spine project from the spine GUI by doing:

  • import from data (with the json file)
  • save it next to the image folder to make the relativity work

With this process, moving the spine project and the image folder works well.
I don't really explain this difference with the CLI but it's a real problem for me.

Thanks in avance.

8 个月 后

As you'll be able to see in the following videos, with very simple operations from Windows explorer, the relative path are not kept in the Spine project when moving it to a new place.
Bug Spine 4.0.64 - Relative path is kept when copying Spine project : https://www.youtube.com/watch?v=u9_4-auoHKU&ab_channel=MidiphonyM
Bug Spine 4.0.64 - Images are missing when moving Spine project : https://www.youtube.com/watch?v=ODzDYT-I4Xo&ab_channel=MidiphonyM

If I am doing anything wrong, don't hesitate to tell me :wounded:

You'll find attached a .zip containing the original PSD file, the PhotoshopToSpine.jsx file, and the ouput Spine folder.

@midiphony-panda Thank you for reporting the problem in so much detail. However, we were unable to reproduce the problem on either Windows or macOS PCs. According to your video, it looked like you were duplicating the folder on another drive, so we did that but still kept the relative paths correct.

How long has this problem been occurring? Were relative paths kept correctly before?

The problem has been occurring for as long as this thread has started, but with inconsistent repro rates (I'm working with @edesmet).
Now that we found a 100% repro rate (at least on our machines), I wanted to chime in and detail the issue ^^"

Some additional information :

  • if the .json exported from Photoshop contains an absolute path for the images, and we create a project from the .json :

if we don't move the project, Spine editor displays the relative path


if we move the project, Spine editor displays the absolute path, and the images are "MISSING".

  • if we edit the .json exported from Photoshop to replace the absolute path with a relative one, and we create a project from the .json :

everything works fine, and relative path is always displayed

We are wondering if the Spine project is somehow retaining the absolute path that was set from the jsx script in the json. But even in this case, we would expect Spine to be transparent and display this absolute path.

Is it normal that the output json from the Photoshop jsx is always containing an absolute path ?

You say it is due to the .json exported from Photoshop contains an absolute path for the images, but I still am not able to reproduce the problem after trying both duplicating the project and duplicating after importing the skeleton from the .json file. Also I have tried to export the PSD using PhotoshopToSpine v7.21 and import the exported JSON, but it does not affect anything. I recorded what I tried on video except for Photoshop operating, so please see the video below:

If there is something missing in my procedure, please let me know.

At 0:04, you are modifying the absolute path with the relative path of the images folder.
This is what our artists have been doing, and are still doing currently.

We have therefore two feedbacks :

  1. We have developed a pipeline to automatize the Spine project creation from Photoshop files. It would be nice if the Spine project already contained the relative path from the very start of the project creation (from the .json import).

  2. It would be nice if the Spine editor displayed the actual images path saved in the project.
    We can see that a relative path is displayed at 0:22 in this video : https://youtu.be/u9_4-auoHKU?t=22
    After moving the project elsewhere, we can see at 0:51 that an absolute path is eventually displayed : https://youtu.be/u9_4-auoHKU?t=51
    We are wondering if the absolute path was the only thing saved in the project file, but displayed as relative in the first case.

This is obviously "Quality of Life" feedbacks and there are workarounds around those issues : but the UX would be much smoother if you could investigate those 🙂

10 天 后

Sorry for the delay. It was tricky to see your actual problem, but we got it eventually. The image and audio paths were not "relativized" when a new project file is saved for CLI import. We've fixed this is 4.1.07!

This is awesome, thank you very much ! :grinteeth:

Would it be possible to backport it to Spine 4.0 ?
I see in the changelog 4.0 hasn't been touched since April, so I would understand if it's not doable/not a prio :p

We aren't doing more 4.0 releases, sorry! Have to move on.