edesmet

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.

relativePathBroken.png


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.
Nemaš dopuštenje za pregledavanje privit(a)ka dodan(og)ih postu.
edesmet
  • Postovi: 10

Mario

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.
Avatar
Mario

Mario
  • Postovi: 2828

edesmet

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
edesmet
  • Postovi: 10

Erika

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
Avatar
Erika

Erikari
  • Postovi: 3011

edesmet

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.
edesmet
  • Postovi: 10


Natrag na Editor