Skip to content

Commit

Permalink
tweak create jsons
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodBoyDigital committed Jun 24, 2024
1 parent 22301be commit a8ebc80
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/texture-packer/packer/createJsons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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;
}

0 comments on commit a8ebc80

Please sign in to comment.