aseprite/aseprite

JSON slice information unusable when combining multiple input files in CLI

Lommix opened this issue · 1 comments

When combining multiple input files into one big atlas, slice bounds in the json output file are relative to their original image and do not represent the bounds of the new atlas. There is an offset missing.

Example:

aseprite -b  first.aseprite second.aseprite --data atlas.json --sheet atlas.png --list-slices 

Aseprite and System version

  • Aseprite version: 1.3.6-dev
  • System: Linux

Thanks for this report. I was able to reproduce it.
This was requested on #1651 (#1651 (comment)) too. Anyway it's good to have a specific issue for this.

Test result:
bug.zip

{ "frames": {
   "spr_a.aseprite": {
    "frame": { "x": 0, "y": 0, "w": 32, "h": 32 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
    "sourceSize": { "w": 32, "h": 32 },
    "duration": 100
   },
   "spr_b.aseprite": {
    "frame": { "x": 0, "y": 32, "w": 16, "h": 16 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 16, "h": 16 },
    "sourceSize": { "w": 16, "h": 16 },
    "duration": 100
   }
 },
 "meta": {
  "app": "https://www.aseprite.org/",
  "version": "1.3.6-x64",
  "image": "atlas.png",
  "format": "RGBA8888",
  "size": { "w": 32, "h": 48 },
  "scale": "1",
  "slices": [
   { "name": "Slice 1", "color": "#0000ffff", "keys": [{ "frame": 0, "bounds": {"x": 16, "y": 16, "w": 6, "h": 12 } }] },
   { "name": "Slice 1", "color": "#0000ffff", "keys": [{ "frame": 0, "bounds": {"x": 1, "y": 1, "w": 7, "h": 7 } }] },
   { "name": "Slice 2", "color": "#0000ffff", "keys": [{ "frame": 0, "bounds": {"x": 8, "y": 8, "w": 7, "h": 7 } }] }
  ]
 }
}

We need to fix each slice coordinate and include an extended name for each:
spr_a/Slice 1
spr_b/Slice 1
spr_b/Slice 2