FWIW, copying the images to a temp folder is unlikely to take very long.
The AttachmentLoader is the standard way of customizing how attachment names/paths are mapped to texture atlas names. It's very easy, just copy/paste the source for AtlasAttachmentLoader (from whichever runtime you are using), rename the class, then everywhere you see TextureAtlas findRegion
called, add the both/
prefix. Then you use your attachment loader like this:
loader = new SkeletonJson(new YourAttachmentLoader(atlas));
I'm not sure how a CLI parameter would work well. If we strip all the folder prefixes from the texture atlas names, the names still need to be unique else we'd need to stop with an error. It seems easier to solve the problem by adjusting your organization. Doing that doesn't seem terribly onerous.
You could pack one folder higher and use pack.json
files containing {ignore:true}
so you don't pack other folders. Or you could move those other folders elsewhere. Or you could add a new folder so you have:
images/nopack1
images/nopack2
images/skeletons/both/Arm.png
images/skeletons/both/Leg.png
Then you'd pack images/skeletons
and set the images path of your Spine projects to images/skeletons
.
Most people with a similar problem have the opposite: they want to strip a prefix. They have image folders like this:
root/skeleton1/images
root/skeleton2/images
They pack root
and don't want the skeleton1/
or skeleton2/
prefixes in the atlas because it's not there in the Spine project. The easiest answer is to set both the Spine project and the texture packer to the same folder. Then you won't have any of these issues. The tree even has a Hide skeleton names setting to reduce clutter when doing that.