Abelius

Hi there,

I'm wondering if there is some way to import existing attachments' positions (ONLY), using the JSON created with Photoshop2Spine export script, without deleting the previous meshes when 'Replace' is selected.

That is, I'm just interested in updating existing meshes positions, not the whole thing (mesh, binding, weights...)

Thanks!
アバター
Abelius
  • 記事: 146

Nate

When the images are rectangular it's easy to define an origin, eg Spine uses the center. For a mesh, it is much less clear what single point to use for an origin to position the whole mesh. At a low level, the mesh doesn't have a single position (the position shown for translation is the mesh hull's centroid), instead each vertex has a position. One could say it makes sense to use the center of the mesh's image, but consider that a mesh's vertices may have been moved around, so the mesh's image is stretched/deformed. In that case it's not clear how to position the entire mesh using the position from Photoshop. It is pretty common to not deform your meshes in setup mode, so we could support that, though it is unfortunate that it wouldn't work for deformed meshes. I'm afraid there's currently no way to do it.

We do some complex logic when you hit Reset on a mesh (which removes its deformation), finding the portions of the mesh that are least deformed, then we use some average of those to choose how to place the undeformed mesh. Sometimes this still moves the mesh in a way that isn't what you want. We could likely apply some logic like this to update positions from the Photoshop data.
アバター
Nate

Nate
  • 記事: 9452

Abelius

Ohh, I see... yeah, I forgot what happens when I delete a hull vertex...: translate coordinates change. :rolleyes:

Then, the only "automated" way I see to have flexibility in modifying linked meshes for larger variations is not trimming and using the full canvas for each image I expect having those variations (as I mentioned in another post). And not changing the canvas size later, ofc.

The other way would be doing what I did in the past: using GIMP to match the new layers into the master image and export preserving the image size of the original.

Well... actually there's a third, which is a modified first: exporting without trimming, then square-cropping from the center to the same size of the master mesh. Then you can create a linked mesh with the new image and nothing gets deformed.

I would have liked an automated way to do this, but that would require using the original image translate coords instead of the current mesh translate coords. Probably a bit obscure... and both the script and the editor would need to be modified to accept this behavior.

Thank you for the explanation. ;)
アバター
Abelius
  • 記事: 146


Return to Editor