Skip to content

CLI: frame tags incorrect when exporting a spritesheet from multiple files #3611

@alexgorcrom

Description

@alexgorcrom

While running the bellow command (via gitbash for the path niceties) over two different files, each with a single layer and multiple tags:

 ~/Downloads/Aseprite-v1.2.40/Aseprite-v1.2.40/Aseprite.exe -b king.aseprite silver_knight.aseprite --sheet ../spritesheets/characters.png --scale 2 --sheet-pack --list-tags --filename-format {tag}_{tagframe} --format json-array --data ../spritesheets/characters.json

The produced json has all the frames in the array, however the produces frame tags section in the meta object is problematic:

{
  ...
  "meta": {
    ...
    "frameTags": [
      { "name": "king_idle", "from": 0, "to": 7, "direction": "forward" },
      { "name": "king_run", "from": 8, "to": 15, "direction": "forward" },
      { "name": "king_death", "from": 16, "to": 21, "direction": "forward" },
      { "name": "king_attack1", "from": 22, "to": 25, "direction": "forward" },
      { "name": "king_attack2", "from": 26, "to": 29, "direction": "forward" },
      { "name": "king_attack3", "from": 30, "to": 33, "direction": "forward" },
      { "name": "king_hit", "from": 34, "to": 37, "direction": "forward" },
      { "name": "silver_knight_idle", "from": 0, "to": 10, "direction": "forward" },
      { "name": "silver_knight_run", "from": 11, "to": 18, "direction": "forward" },
      { "name": "silver_knight_attack1", "from": 19, "to": 25, "direction": "forward" },
      { "name": "silver_knight_attack2", "from": 26, "to": 32, "direction": "forward" },
      { "name": "silver_knight_death", "from": 33, "to": 43, "direction": "forward" },
      { "name": "silver_knight_hit", "from": 44, "to": 47, "direction": "forward" }
    ]
  }
}

From the above it is both the king_idle and silver_knight_idle have overlapping from->to frame numbers. This makes it pretty much impossible to extract which frames in the array are meant to be for which tag, when attempting to do something as follows (in peudo code):

json frames = json_get_array( root, "frames );
json frame_tags = json_get_array( json_get_obj( root, "meta" ), "frameTags")

for( tag in frame_tags ) {
  int from, to;
  if( tag.name == "<tag>" ) {
    from = tag.from;
    to = tag.to;
  } 
  for( i = from; i <= to; i++ ) {
    extract_frame( frames, i );
  }
}

Aseprite and System version

  • Aseprite version: 1.2.40, portable
  • System: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions