SpritesheetLoader - (multi-pack) metadata used only for first image
See original GitHub issueHi,
I think I’ve found a bug, the problem occurs when we are loading sprite sheets that use the multi-pack feature and we provide “metadata” in loader options.
The problem is that “metadata” is used only when loading the first sprite sheet, it is not passed to rest spritesheets, so for example when we are specifying baseTexture options (imageMetadata), those options are used only in first texture.
In my opinion, “metadata” should be shared across all sprite sheets in multi-pack.
Expected Behavior
“metadata” should be passed to rest sprite sheets.
Current Behavior
“metadata” is not passed to rest sprite sheets.
Possible Solution
pass metadata when adding rest multi-pack sprite sheets to the loader.
https://github.com/pixijs/pixijs/blob/dev/packages/spritesheet/src/SpritesheetLoader.ts (line 80)
const options = {
crossOrigin: resource.crossOrigin,
loadType: LoaderResource.LOAD_TYPE.XHR,
xhrType: LoaderResource.XHR_RESPONSE_TYPE.JSON,
parentResource: resource,
metadata: resource.metadata
};
Steps to Reproduce
https://codesandbox.io/s/pixi-spritesheetloader-metadata-rul1b
Environment
pixi.js
version: 6.1.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
I meant metadata passed in the loader options, not metadata inside sprite sheet (json file), for example, “imageMetadata” which is used to specify baseTexture options
loader.add("spritesheet.json", {metadata: {key: value}})
PR created: https://github.com/pixijs/pixijs/pull/7745