If you need the packed normal and mask images to match the color images, the texture packer is deterministic and will pack them exactly the same if the normal and mask images have the exact same silhouette as the color images.
Either way, you can pack all of them into a single atlas or pack multiple atlases and discard the .atlas
file for the normal and mask images.
Arzola लिखाuntil I had to start disabling some skins. So now, if I wanted to skip the export of skin #2 and #4 (for example)
Wait, why would you want to not export some skins? Skeleton data is not intended for partial exports. Exporting all the skins is not much more data. If the idea is to not load all the images for all the skins, keep in mind that the images/atlas are completely separate from the skeleton data. With a little configuration at runtime, you can use skeleton data with an atlas that does not contain all the images. That is done by specifying your own AttachmentLoader.
Here is an explanation I wrote in the past:
AtlasAttachmentLoader is used if an AttachmentLoader is not specified. It has this code to find a mesh's atlas region (varies a little per runtime):
public MeshAttachment newMeshAttachment (Skin skin, String name, String path) {
AtlasRegion region = atlas.findRegion(path);
if (region == null) throw new RuntimeException("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
MeshAttachment attachment = new MeshAttachment(name);
attachment.setRegion(region);
return attachment;
}
You can write your own AttachmentLoader that does similar, but you can customize how it looks in the atlas (instead of using the path) and what happens if a region can't be found (instead of throwing an exception). You'll need to do that for newMeshAttachment
and newRegionAttachment
, which are the only two that use atlas regions.
For example, to change how it looks in the atlas, you could prepend the skin name to the path, or look in multiple atlases to find the region, etc.
If a region can't be found, you could return null
, which means the skeleton will not have the mesh attachment at all. Note that if the skeleton data has linked meshes that use this mesh as a source mesh, it will cause an error to return null
.
Or, you could just return the attachment without setting its region. That is the safest, as you can still use its linked meshes, but it means trying to render the attachment will fail. That is probably fine, since if you don't have a region for the attachment, it's probably because you won't be rendering it.
TLDR; copy AtlasAttachmentLoader, paste it into your project, rename it, customize the newMeshAttachment
and newRegionAttachment
methods, and then create the JSON or binary loader like this:
var loader = new SkeletonJson(new MyAttachmentLoader());