From a8ebc80f7594de3b8420e05b0d10e942218f7798 Mon Sep 17 00:00:00 2001 From: Mat Groves Date: Mon, 24 Jun 2024 15:23:25 +0100 Subject: [PATCH] tweak create jsons --- src/texture-packer/packer/createJsons.ts | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/texture-packer/packer/createJsons.ts b/src/texture-packer/packer/createJsons.ts index c920fd0..8c8144c 100644 --- a/src/texture-packer/packer/createJsons.ts +++ b/src/texture-packer/packer/createJsons.ts @@ -61,28 +61,17 @@ export function createJsons( }; } - const name = createName(options.textureName, i, bins.length !== 1, options.resolution, options.textureFormat); - - let multiPack: string[] | null = null; - - if (bins.length > 1 && i === 0) - { - const binsWithoutFirst = bins.slice(1); - - multiPack = binsWithoutFirst.map((_, i) => name.replace('-0', `-${i + 1}`).replace('.png', `.json`)); - } - json.meta = { app: 'http://github.com/pixijs/assetpack', version: '1.0', - image: name, + image: createName(options.textureName, i, bins.length !== 1, options.resolution, options.textureFormat), format: 'RGBA8888', size: { w: width, h: height, }, scale: options.resolution, - related_multi_packs: multiPack, + related_multi_packs: null, }; jsons.push({ @@ -91,5 +80,16 @@ export function createJsons( }); } + // before we leave, lets connect all the jsons to the first json.. + + const firstJsonMeta = jsons[0].json.meta; + + firstJsonMeta.related_multi_packs = []; + + for (let i = 1; i < jsons.length; i++) + { + firstJsonMeta.related_multi_packs.push(jsons[i].name); + } + return jsons; }