From 09958449c39bad222c66252a23aac9f3a5eacd3a Mon Sep 17 00:00:00 2001 From: Gaspar Capello Date: Thu, 3 Mar 2022 11:29:36 -0300 Subject: [PATCH] Add export sprite sheet test when some cels are linked + TrimmedCels + Merge Duplicates + SplitLayers checked https://github.com/aseprite/aseprite/issues/2600 --- cli/sheet.sh | 71 +++++++++++++++++++++++++++++++++++++++++- sprites/link.aseprite | Bin 0 -> 845 bytes 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 sprites/link.aseprite diff --git a/cli/sheet.sh b/cli/sheet.sh index f6e2c2be0..27c46b4aa 100644 --- a/cli/sheet.sh +++ b/cli/sheet.sh @@ -1,5 +1,5 @@ #! /bin/bash -# Copyright (C) 2019-2020 Igara Studio S.A. +# Copyright (C) 2019-2022 Igara Studio S.A. # $1 = first sprite sheet json file # $2 = second sprite sheet json file @@ -331,3 +331,72 @@ assert(#sheet2.meta.layers == 8) assert(json.encode(sheet1.meta.layers) == json.encode(sheet2.meta.layers)) EOF $ASEPRITE -b -script "$d/check.lua" || exit 1 + +# https://github.com/aseprite/aseprite/issues/2600 +# -merge-duplicates -split-layers -trim give incorrect 'frame' coordinates on linked cels +d=$t/issue-2600 +$ASEPRITE -b -list-layers -format json-array -trim -merge-duplicates -split-layers -all-layers "sprites/link.aseprite" -data "$d/sheet.json" -sheet "$d/sheet.png" +cat >$d/check.lua < #sheet.meta.layers) + +app.activeSprite = restoredSprite +app.activeLayer = restoredSprite.layers[#restoredSprite.layers] +for i=1,#restoredSprite.layers-1 do + app.command.MergeDownLayer() +end + +local orig = app.open("sprites/link.aseprite") +app.activeSprite = orig +app.activeLayer = orig.layers[#orig.layers] +for i=1,#orig.layers-1 do + app.command.MergeDownLayer() +end + +assert(orig.width == restoredSprite.width) +assert(orig.height == restoredSprite.height) +assert(#orig.frames == #restoredSprite.frames) +for fr=1,#restoredSprite.frames do + for celIndex1=1,#restoredSprite.cels do + if restoredSprite.cels[celIndex1].frameNumber == fr then + for celIndex2=1,#orig.cels do + if orig.cels[celIndex2].frameNumber == fr then + assert(orig.cels[celIndex2].position == restoredSprite.cels[celIndex1].position) + if orig.cels[celIndex2].image ~= nil and restoredSprite.cels[celIndex1].image ~= nil then + assert(orig.cels[celIndex2].image:isEqual(restoredSprite.cels[celIndex1].image)) + end + end + end + end + end +end +EOF +$ASEPRITE -b -script "$d/check.lua" || exit 1 diff --git a/sprites/link.aseprite b/sprites/link.aseprite new file mode 100644 index 0000000000000000000000000000000000000000..461eba73e91e4b5e084337189943ebe88c1a4c26 GIT binary patch literal 845 zcmcJNPe>F|9LImoIvQS-4z?BSK18I%Xm^ZcaZwSyWPvQQQ63!Iu$+TSB)JfDh(OrO zUV^CIgBMTg!BgNNf*=s_yqE_S)`L)qp2AI@pP5~96g>7G^WpLS%=hz~HxB|L+w+E8 zqARHpk*7STjX8Hxn&|(dJvKy+4jR1F1_GLS>XjGii~GU&s#4XNuy4g1YLOOo2M*qd z!--fF=91lT>qQ&fn45sVzkPz`!@Ka~?l5$|L}1tZDL6EF8zzQYp%st8-ri{#vERbc zsU4WgYdE%Ef@_<9p{9xCmp;RHZ)V}7g^QL2Hy);7@%0MKeYgj+>4xoGKH(%2OD2J&5p~T?Qe5}H zhJqM!KYHPcb>T{98)t)O?&;i}1!QFW*)4XN%1tpubJLYpOU0Q&%C_x4jRPfnE?Fnp zt?RotSv9>^n!e2ej%Etwuq08%Twy6v;`EI9gt!~ueZjtu#mA#kjIywk= zf0kQyr*}#?<9Dg6y7ZaFg_+~}@#&uBC(pk}MZWHb(n0TtTNp;Z`YQ8P0pI)y5tFo! literal 0 HcmV?d00001