• Editor
  • Texture Packer, Image folder

Quick question, When I pack I need a texture created for each folder in the project. I know about this option I have attached below, however I want more control over the order of the textures are being created. I tried to set a prefix for first folder name _Folder Name It is the first folder now in the project directory, but texture that is being created for this folder is the last one

  • Nate ответили на это сообщение.
    Related Discussions
    ...

    warmanw I want more control over the order of the textures are being created.

    More control how? It's not clear what the goal is.

    The name of the atlas will be the name of the skeleton when using "image folder to atlas per skeleton". Which skeleton is packed first is probably the order the skeletons appear in the tree, which can be changed with drag and drop (the order determines which skeleton is on top in the editor viewport).

    Thanks for clarification Nate

    I want custom names for the spritesheets one atlas can have. Changing image folders' names in the directory does not affect the final exported spritesheets' names

    Gotcha, thanks. Why would you want to do this? It's unusual to care what the image names are.

    The texture packer does not support this. Atlas page images are named after the atlas file with a numeric suffix.

    Should it be supported? When packing a subfolder to its own atlas page, we could name the page after the folder. You could still end up with a numeric suffix if there are more images than fit on one page. However, we'd need to have a plan on how the combine subdirectories setting works with this naming. A subfolder can have a pack.json file that enables combine subdirectories for that subfolder, in which case all images for the subfolders of the subfolder would be named after the rootmost folder that doesn't have combine subdirectories enabled. That may work if there are no other complexities, but before we can add such a feature I need to understand why you would care what the atlas image file names are.

    How to workaround it? At runtime if you want to get the atlas image that has a particular region, get the region (eg from the atlas) and the get the reference to the image. Eg, if you want to do something with the texture that has weapons, get the sword AtlasRegion, then look at its AtlasPage which has a rendererObject that is the texture for your game toolkit. The texture likely can tell you what file it came from. If you have an attachment, not a region, then look at the mesh or region attachment's rendererObject, which is an AtlasRegion for most game toolkits.

    Another workaround is to edit the atlas file with a text editor to change the names for each section. Then you can rename the files in the same way.

    • warmanw ответили на это сообщение.

      Nate This was requested by developers I understand that it is a rare case, but they pretty much need each image to be readable(folders are outfit skins) so later they can add normal maps to each. Now we go with packing all separately using Spines Texture Packer then exporting data without pack. This way we dont need to pack all again if we introduce new skin.

      Normal maps or other reliance on specific atlas images can be done with the default atlas+number.png naming. Which images from a subfolder are packed on to which image will stay consistent. It can break if a subfolder ends up having enough images to spill over to a second image, but that is true even if we named the images differently.

      For normal maps it is likely easiest to pack them just like the diffuse images. As long as the normal maps have identical alpha and the pack settings are the same, they will pack identically. You can simply match a normal map image to a diffuse image, eg diffuse1.png and normal1.png go together. You can just throw away the .atlas file for the normal atlas, as you only pack it to get the images.