crdmrn

As the title says, I can#t seem to find a way to export an atlas of ONLY the attached images without having them all mixed together. This happens if I select "Image Folders", but then all images are exported, even the ones that are not attached anywhere.
Suggestions/Solutions? :think:
crdmrn
  • Сообщения: 29

Erika

Spine is going to export all the images you added to your project unless you uncheck the export checkmark in the attachment properties. However, if the attachment is keyed in an animation, it will still be exported.
Attachments - Spine User Guide: Settings
Аватара пользователя
Erika

Erikari
  • Сообщения: 2554

crdmrn

I have an image that is unchecked for export, and is not part of any animation. Still, if I select "Image Folders" it is exported anyway. But i also feel that's the intended behavior; on the other hand, I wish there was a third option to export only attached/keyed images keeping the folder structure, cause atm it's whether one or the other, am I wrong?

---

I know this is annoying, but I'm in the middle of defining our spine workflow, so I need to know if I'm missing something or if that's actually not possible so... Up :D
crdmrn
  • Сообщения: 29

Nate

When you select Image Folders it is equivalent to running the texture packer on the images folder. It does not use the Spine project or attachments in the project (except meshes for whitespace stripping), so unchecking the Export checkbox on an attachment won't prevent the image from getting picked up and put in the atlas.

You can put images you don't want in the atlas into their own folder, then create a pack.json file in that folder with the contents:
{
ignore: true
}
That will cause all images in that folder to be ignored by the texture packer when using Image Folders or running the packer separately from data export.
Аватара пользователя
Nate

Nate
  • Сообщения: 9861

crdmrn

Thats just a partial answer, this way I have to manually check and be sure any of the images in the "ignore" folder is linked on the skeleton I'm exporting.
This makes it prone to raise errors when exporting, especially with big and complicated setups.
I'd rather turn this card into a feature request, as I really feel this could be a feature many people would/could benefit from.
crdmrn
  • Сообщения: 29

Nate

If you want to only pack images that your skeleton uses, why are you choosing Image Folders? It sounds like if you choose Attachments that it will do what you want.
Аватара пользователя
Nate

Nate
  • Сообщения: 9861

crdmrn

Nate писал(а):If you want to only pack images that your skeleton uses, why are you choosing Image Folders? It sounds like if you choose Attachments that it will do what you want.
Because Attachments doesn't retain the folder structure, and creates atlases that mix all the graphics together, as I wrote in my first post.
On the other side, Image Folders does create an atlas per folder, but it packs all the images regardless if they're attached or not.
What I'm looking for is some built-in way to do both: like an Attached Image Folders that creates an atlas for each image folder but only with the attached images among the ones in the folder.
crdmrn
  • Сообщения: 29

Nate

I see, sorry I missed that point. One thing you can do is pack an atlas using Attachments, then unpack the atlas so you have a folder (and subfolders) of only the images used by attachments, then run the texture packer on that, which will use the filesystem subfolders to control how the images are grouped on the atlas pages. It's a little bit more work to do, but you can automate it using the command line interface to do the export, unpacking, and repacking. We'll consider a way to do it without the extra steps.
Аватара пользователя
Nate

Nate
  • Сообщения: 9861

crdmrn

Nate писал(а):I see, sorry I missed that point. One thing you can do is pack an atlas using Attachments, then unpack the atlas so you have a folder (and subfolders) of only the images used by attachments, then run the texture packer on that, which will use the filesystem subfolders to control how the images are grouped on the atlas pages. It's a little bit more work to do, but you can automate it using the command line interface to do the export, unpacking, and repacking. We'll consider a way to do it without the extra steps.
I see, that's a bit tricky, especially if one goes through reimporting stuff pretty often (I'm in the process of defining a workflow that will hopefully give the chance to our artists to handle the whole Spine part themselves).
Would there be a way to automate that with an external extension script, while waiting for an eventual built-in solution? :D
crdmrn
  • Сообщения: 29

Nate

Yes, you can export, pack, and unpack from the command line.
Export - Spine User Guide: Command line
Аватара пользователя
Nate

Nate
  • Сообщения: 9861

crdmrn

Nate писал(а):Yes, you can export, pack, and unpack from the command line.
Export - Spine User Guide: Command line
Is there a way to run such scripts from within Spine, similar to what happens with custom Photoshop scripts?
crdmrn
  • Сообщения: 29

Nate

No, I'm afraid it has to be done from the command line or with a shell script.
Аватара пользователя
Nate

Nate
  • Сообщения: 9861

crdmrn

I see :( Please consider adding something like that in the future, as for someone who's not really used to use the terminal (e.g. the artists I'm preparing the workflow for) this is not really less tricky than doing the pack/unpack/repack thing by hand ^^"
crdmrn
  • Сообщения: 29

nimbling

What we did, to kinda sorta solve this, is make sure all the attachments of a single skin are in their own folder (no reusing of the same attachment) and afterwards pakc those folders separately using the command line.
Аватара пользователя
nimbling
  • Сообщения: 177

crdmrn

nimbling писал(а):What we did, to kinda sorta solve this, is make sure all the attachments of a single skin are in their own folder (no reusing of the same attachment) and afterwards pakc those folders separately using the command line.
I'm aware of all the command line options; the thing is, I can't ask non-programmers to write things in the terminal. That's too prone to mistakes and also it's not a a good workflow. Spine already offers the two separated packing options, what I'm asking is just considering implementing a mixed one in the program GUI so no artist will risk messing up on export using weird script or worse, the terminal.
crdmrn
  • Сообщения: 29

Nate

Understood. As mentioned, we will consider a way to do it without the extra steps. The workaround described above is a stopgap until then. While I also wouldn't suggest asking animators to write terminal commands, it may be acceptable for them to run a shell script that does the necessary steps for them.

However, I do believe that automating export can be beneficial in many cases. In general, it can be error prone to trust people (animators, programmers, or anyone else) to both remember to do the exports when project files change and to do all the exports with the right settings, to the right place, etc. Also, often a build is not just processing Spine projects -- usually all but the simplest of applications has a fair amount of tasks that can be automated to reduce errors and save time.
Аватара пользователя
Nate

Nate
  • Сообщения: 9861

crdmrn

We do have similar export scripts for Photoshop. The problem is not writing them, is to make them easily accessible from the program GUI; for example, Photoshop has the option to place .jsx files in the Scripts folder that then pop-up in the program GUI as menu options. A similar function in Spine could help lot of developers to automate specific processes without requiring you (ES) to consider coding them in yourself.
crdmrn
  • Сообщения: 29

Nick

How do I get the command line packer NOT to create multiple atlas based on folders?

My command is like this:
Spine -i image_folder/ -o "output_path" -n set1 -p polygon_halfsize.pack.json

There seems no way to tell the packer to ignore folders and pack everything into one big atlas. I have skin folders of characters and some common folders which contains shared images among skins. I want to use symbolic link to prepare image folders which can skip copying images every time doing the export.

---

Besides the single atlas issue, I got a lot of "Missing Region" warning but I already unchecked "export" for the unrelated skins. I found that the export.json seems doesn't even saved which skins should be ignored thus causing the "Missing Region" warning in unity. It try to get the attachment which should be excluded from the export.
Nick
  • Сообщения: 152

Nate

Note folders give you one atlas with multiple atlas page images, not multiple atlases.

You can use the "combine subdirectories" setting to pack images in folders (subdirectories) into the same atlas page. If they don't fit they will spill over into subsequent pages.

When you run the texture packer on a folder of images, it just packs the images found. Unchecking Export for a skin causes that skin and its attachments to not be written in exported JSON or binary data. You can inspect the JSON and make sure that is the case. The only reason you should ever get "missing region" messages in Unity is that there are attachments in the data that don't have a matching texture region in the atlas.
Аватара пользователя
Nate

Nate
  • Сообщения: 9861

Nick

Nate писал(а):You can use the "combine subdirectories" setting to pack images in folders (subdirectories) into the same atlas page. If they don't fit they will spill over into subsequent pages.
CombineSubdirectories.jpg

Just found that the latest version has this option missing. No wonder why I don't find it.
Unchecking Export for a skin causes that skin and its attachments to not be written in exported JSON or binary data. You can inspect the JSON and make sure that is the case. The only reason you should ever get "missing region" messages in Unity is that there are attachments in the data that don't have a matching texture region in the atlas.
Exactly, the xxx.export.json didn't store which skin to ignore. Thus, when exporting from command line using that export.json file , all skins are exported. That's the issue. Alhought exporting directly from spine UI mode works, it would not be easy because for each skin, user has to manually adjust the ignore list for the skins.

Here is the saved export.json file. Not mentioning the export-unchecked skins at all.
{
"class": "export-binary",
"name": "Binary",
"project": "Kids.spine",
"output": "D:/exports/Units/Npc/HarbourKids",
"open": false,
"extension": ".skel.bytes",
"nonessential": false,
"cleanUp": false,
"packAtlas": {
"stripWhitespaceX": true,
"stripWhitespaceY": true,
"rotation": true,
"alias": true,
"ignoreBlankImages": false,
"alphaThreshold": 3,
"minWidth": 16,
"minHeight": 16,
"maxWidth": 2048,
"maxHeight": 2048,
"pot": true,
"multipleOfFour": false,
"square": false,
"outputFormat": "png",
"jpegQuality": 0.9,
"premultiplyAlpha": true,
"bleed": false,
"scale": [ 0.5 ],
"scaleSuffix": [ "_half" ],
"scaleResampling": [ "bicubic" ],
"paddingX": 1,
"paddingY": 1,
"edgePadding": true,
"duplicatePadding": false,
"filterMin": "Linear",
"filterMag": "Linear",
"wrapX": "ClampToEdge",
"wrapY": "ClampToEdge",
"format": "RGBA8888",
"atlasExtension": ".atlas.txt",
"combineSubdirectories": false,
"flattenPaths": false,
"useIndexes": false,
"debug": false,
"fast": false,
"limitMemory": true,
"currentProject": true,
"packing": "polygons",
"silent": false,
"ignore": false,
"bleedIterations": 2
},
"packSource": "attachments",
"packTarget": "perskeleton",
"warnings": true
}


---

I changed the combineSubdirectories to true directly from .json file. It works, now only output one PNG.

However, when try to export directly from Spine Editor instead of command line. It has error.
The HomeTown_Girl skin has "export" unchecked and it blame not being able to find it.
Spine Launcher 3.8.82
Esoteric Software LLC (C) 2013-2020 | http://esotericsoftware.com
Windows 10 Enterprise x86 10.0
Spine 3.8.93 Professional
Licensed to: Secret
Pack: skeleton
Complete.
ERROR: Unable to export:
java.lang.RuntimeException: java.lang.RuntimeException: Skin not found in skeleton: HomeTown_Girl
at OT.Z(SourceFile:1858)
at CF.S(SourceFile:48)
at AP.run(SourceFile:671)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Skin not found in skeleton: HomeTown_Girl
at sX.S(SourceFile:853)
at sX.S(SourceFile:428)
at sX.S(SourceFile:103)
at sX.S(SourceFile:123)
at CH.run(SourceFile:60)
at OV.run(SourceFile:1846)
at cOM9.S(SourceFile:289)
at Com2.run(SourceFile:252)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue.access$600(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
У вас нет необходимых прав для просмотра вложений в этом сообщении.
Nick
  • Сообщения: 152

Nate

Nothing about skins will ever be in the export JSON or texture packing setting JSON. Whether a skin is exported is only stored in the .spine project file.

There are two ways to export an atlas:
Texture Packing - Spine User Guide

1) Packing during skeleton data export
When doing this, there is no option to combine subdirectories because Spine is packing only the images actually used by the skeleton -- subdirectories/folders are not being used at all to find images or decide which images go on what atlas page (which also means pack.json in your image folders files are not used). I will make a note about this setting not being shown when packing in this mode.

You get this mode when you check Pack while doing binary or JSON export AND you choose Attachments. When you export from the command line, you'd use the --export or -e options with an export settings JSON file.

Note this option is for convenience, to quickly get an atlas for a skeleton, or for simple projects that don't need more control.

2) Using the Spine Texture Packer separately
When doing this, folders are used to determine which pages images are written to and combine subdirectories can be set.

You get this mode when you run the texture packer separately, not as part of binary or JSON export. When you export from the command line, you'd use the --pack or -p options with a texture atlas settings JSON file.

Note this option gives more control over how packing is done (via folders, combine subdirectories, and pack.json files, you can pack images for multiple skeletons into the same atlas, etc).

---

The export settings JSON you showed is for binary export with texture atlas packing (#1). Everything will be packed in one page, if it fits.

Using the "kids" project you posted in another thread, I reproduced the error log you showed by unchecking Export for HomeTown_Girl. It happens for me in the UI. I didn't try the CLI, but seeing it is sufficient for us to fix it. From a quick look, it happens during export of a deform timeline for a mesh attachment in the skin that is not being exported. The fix is easy (we should just skip such timelines). We'll do a 3.8 release in a day or two, in case there are other fixes needed for 3.8.

With that fixed, I notice the atlas still contains HomeTown_Girl/* images. I think there is another bug that doesn't respect the skin Export being unchecked. It should not include those images in the atlas when packing. We'll get that fixed too!

Sorry for the trouble with bugs you are having lately! We really do appreciate that you are taking the time to help us reproduce and fix them.

---

Hmm. For the export checkbox on attachments, if the attachment is keyed in an animation, it is exported anyway and a warning is shown. I honestly don't remember when we added an export checkbox for skins, so we'll have to think on how that should behave.

---

To follow up, in 3.8.94 we've fixed a number of bugs with export checkboxes for attachments and skins, and changed how they work for attachments slightly. :greatsuccess:
Аватара пользователя
Nate

Nate
  • Сообщения: 9861

alysonafs

Nick писал(а):
Nate писал(а):You can use the "combine subdirectories" setting to pack images in folders (subdirectories) into the same atlas page. If they don't fit they will spill over into subsequent pages.
CombineSubdirectories.jpg

Just found that the latest version has this option missing. No wonder why I don't find it.
Unchecking Export for a skin causes that skin and its attachments to not be written in exported JSON or binary data. You can inspect the JSON and make sure that is the case. The only reason you should ever get "missing region" messages in Unity is that there are attachments in the data that don't have a matching texture region in the atlas.
Exactly, the xxx.export.json didn't store which skin to ignore. Thus, when exporting from command line using that export.json file , all skins are exported. That's the issue. Alhought exporting directly from spine UI mode works, it would not be easy because for each skin, user has to manually adjust the ignore list for the skins.

Here is the saved export.json file. Not mentioning the export-unchecked skins at all.
{
"class": "export-binary",
"name": "Binary",
"project": "Kids.spine",
"output": "D:/exports/Units/Npc/HarbourKids",
"open": false,
"extension": ".skel.bytes",
"nonessential": false,
"cleanUp": false,
"packAtlas": {
"stripWhitespaceX": true,
"stripWhitespaceY": true,
"rotation": true,
"alias": true,
"ignoreBlankImages": false,
"alphaThreshold": 3,
"minWidth": 16,
"minHeight": 16,
"maxWidth": 2048,
"maxHeight": 2048,
"pot": true,
"multipleOfFour": false,
"square": false,
"outputFormat": "png",
"jpegQuality": 0.9,
"premultiplyAlpha": true,
"bleed": false,
"scale": [ 0.5 ],
"scaleSuffix": [ "_half" ],
"scaleResampling": [ "bicubic" ],
"paddingX": 1,
"paddingY": 1,
"edgePadding": true,
"duplicatePadding": false,
"filterMin": "Linear",
"filterMag": "Linear",
"wrapX": "ClampToEdge",
"wrapY": "ClampToEdge",
"format": "RGBA8888",
"atlasExtension": ".atlas.txt",
"combineSubdirectories": false,
"flattenPaths": false,
"useIndexes": false,
"debug": false,
"fast": false,
"limitMemory": true,
"currentProject": true,
"packing": "polygons",
"silent": false,
"ignore": false,
"bleedIterations": 2
},
"packSource": "attachments",
"packTarget": "perskeleton",
"warnings": true
}


---

I changed the combineSubdirectories to true directly from .json file. It works, now only output one PNG.

However, when try to export directly from Spine Editor instead of command line. It has error.
The HomeTown_Girl skin has "export" unchecked and it blame not being able to find it.
Spine Launcher 3.8.82
Esoteric Software LLC (C) 2013-2020 | http://esotericsoftware.com
Windows 10 Enterprise x86 10.0
Spine 3.8.93 Professional
Licensed to: Secret
Pack: skeleton
Complete.
ERROR: Unable to export:
java.lang.RuntimeException: java.lang.RuntimeException: Skin not found in skeleton: HomeTown_Girl
at OT.Z(SourceFile:1858)
at CF.S(SourceFile:48)
at AP.run(SourceFile:671)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Skin not found in skeleton: HomeTown_Girl
at sX.S(SourceFile:853)
at sX.S(SourceFile:428)
at sX.S(SourceFile:103)
at sX.S(SourceFile:123)
at CH.run(SourceFile:60)
at OV.run(SourceFile:1846)
at cOM9.S(SourceFile:289)
at Com2.run(SourceFile:252)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue.access$600(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source) https://mouseclicker.net/minecraft-auto-clicker/
The problem is not writing them, is to make them easily accessible from the program GUI; for example, Photoshop has the option to place .jsx files in the Scripts folder that then pop-up in the program GUI as menu options.
alysonafs
  • Сообщения: 1


Вернуться в Editor