aseprite icon indicating copy to clipboard operation
aseprite copied to clipboard

Slices are exported even for non-tagged frames

Open thomasgoldstein opened this issue 2 years ago • 3 comments

I know slices are kind of broken right now and need to be reimplemented, but I thought I'd report this just in case.

  1. Create an aseprite file with 3 frames.
  2. Add a slice, and resave it on every frame (to ensure it gets persisted and exported for every frame).
  3. Add a tag "Sheet" on the 2nd frame.
  4. Generate the sprite sheet JSON from your file with this command: aseprite.exe -b --list-slices --tag Sheet --data data.json

Actual result: in the generated JSON file, the slices have been added for all 3 frames. Expected result: in the generated JSON file, the slices have been added for the 2nd frame only (because it's the only one with the "Sheet" tag).

Aseprite and System version

  • Aseprite version: 1.2.40 and 1.3-beta21
  • System: Windows 7 (yeah, I know)

thomasgoldstein avatar Sep 16 '22 20:09 thomasgoldstein

Related, the generated slice frame indexes are inconsistent in cases where you use tags.

Example:

  1. Create an aseprite file with 3 frames.
  2. Add a slice on the 2nd frame, and resave it on the 3rd frame, to ensure it gets persisted and exported for these two frames.
  3. Add a tag "Sheet" on the 2nd and 3rd frame. Only the 1st frame has no tag.
  4. Generate the sprite sheet JSON from your file with this command: aseprite.exe -b --list-slices --tag Sheet --data data.json

Actual result: in the generated JSON file, the slice contains frame:0 and frame:2 (shifted due to the first frame which is not tagged). Expected result: in the generated JSON file, the slice contains frame:0 and frame:1.

thomasgoldstein avatar Sep 16 '22 21:09 thomasgoldstein

Thanks for this report @thomasgoldstein. This isn't a bug. At the moment, this is the normal behavior. Slices should be refactored (#721) / some behavior should be changed (#3142). All this is a work in progress.

Explanation of what is happening on First case and Second case

  • No matter which frame you make a new slice, always this action will create a slice + slice keyframe starting from first frame, then each intention to modify that slice in a particular frame will add a new slice keyframe in that frame.
  • The flags --list-slices lists-tags list-layers will put all the data in the meta section of the json file from the .aseprite source file. The frame numbers in the slice list are referred to the source file (-tag Sheet has no effect in meta section).
  • The --tag Sheet flag only has an effect for the generation of the frames array. As expected, only the frames included in the tag are shown.
  • Note: in the particular case: aseprite.exe -b --list-slices --tag Sheet --data data.json sample.aseprite you can't infer which slice belongs to Sheet frames. The solution to this is to add the --list-tags flag, with this you will get the number of the frame that the Sheet tag belongs to.

Mechanism of slice + slice keyframe (Aseprite current version 1.2.40):

  1. Suppose a Sprite with 10 frames. (frame 1 to 10)
  2. Add a slice at frame 5. This action will add a slice (that's what you see), but the Aseprite code adds a slice + slice keyframe at frame 1. This slice can be seen on all frames.
  3. Go to frame 8, click on the slice and modify its bounds. This action will add a new slice keyframe at frame 8. So, we got: a slice that can be seen in all frames, frames 1 to 7 with bounds set in "2" and frames 8 to 10 with bounds set in "3".

What do you think @dacap? Are there plans to modify the behavior of the list flag when a particular tag is required in the CLI/Export Sprite Sheet dialog?

Gasparoken avatar Sep 19 '22 15:09 Gasparoken

Hi @Gasparoken, thanks for your answer. Slices are still very confusing to me, as I have no choice but to export them to figure out what's really saved in the aseprite file. Or maybe I'm not looking at the right places. Looking forward to their updated version.

thomasgoldstein avatar Sep 19 '22 21:09 thomasgoldstein