spine
spine copied to clipboard
preloading base textures in Pixi 7
Is pixi-spine still capable of using a preloaded base texture in Pixi 7? I'm using [email protected].
The following code throws an error
await Assets.load("spineAnim.png");
await Assets.load({ src: "spineAnim.json",
data: {
image: Assets.get("spineAnim.png").baseTexture
}});
It works fine if I don't define an image, otherwise the error is TypeError: this.atlas.findRegion is not a function
It seems that the image metadata is successful if used when loading the atlas file rather than the json file. This is a suitable workaround for me. For reference:
await Assets.load("spineAnim.png");
await Assets.load({
src: "spineAnim.atlas",
data: { image: Assets.get("spineAnim.png")}
});
await Assets.load({
src: "spineAnim.json",
data: { spineAtlas: false }
})
Maybe similar problem, I have a suffix to the atlas name.
assets: [
{
name: "Beaver_Guard_Warrior",
srcs: "./assets/animation/units/Beaver_Guard_Warrior.json",
loaderOptions: { metadata: { spineAtlasSuffix: "@sd.atlas" } },
},
],
The above can be fixed by either:
name: "Beaver_Guard_Warrior",
srcs: "./assets/animation/units/Beaver_Guard_Warrior.json",
data: {
spineAtlasFile: "./assets/animation/units/[email protected]",
},
or spineAtlasSuffix - but that one I can't get to work
Can i update https://github.com/pixijs/spine/tree/master/examples ?