-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading assets inline #54
Comments
I looked at atlasParser.js and wrote this: var rawSkeletonData = JSON.parse("$jsondata"); //your skeleton.json file here
var rawAtlasData = "$atlasdata"; //your atlas file
var spineAtlas = new spine.Atlas(rawAtlasData, "pathToAtlasImage/"); //specify path, image.png will be added automatically
var spineJsonParser = new PIXI.spine.SkeletonJsonParser(new PIXI.spine.AtlasAttachmentParser(spineAtlas));
var skeletonData = spineJsonParser.readSkeletonData(rawSkeletonData);
//now we can create spine instance
var spine = new PIXI.spine(skeletonData); if your atlas textures wasnt preloaded I recommend to copy part that use "async.each" too. Please test this code and tell me if it works for you. |
Thanks @ivanpopelyshev ! Below is what worked for me: var rawSkeletonData = {
"skeleton": { ... },
"bones": [ ... ],
"slots": [ ... ]
};
var rawAtlasData = 'test.png\nsize: 482,310\nformat: RGBA4444\nfilter: Linear,Linear\nrepeat: none\ndude/arm left hand\n rotate: false\n xy: 430, 30\n size: 19, 32\n orig: 21, 34\n offset: 1, 1\n index: -1\n...';
var spineAtlas = new PIXI.spine.SpineRuntime.Atlas(rawAtlasData, 'img/spine');
var atlasAttachment = new PIXI.spine.SpineRuntime.AtlasAttachmentParser(spineAtlas);
var spineJsonParser = new PIXI.spine.SpineRuntime.SkeletonJsonParser(atlasAttachment);
var skeletonData = spineJsonParser.readSkeletonData(rawSkeletonData);
var dude = new PIXI.spine.Spine(skeletonData); |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to not use the PIXI loader for assets, or somehow sidestep the ajax call?
I've tried to cut out the delay in the data loading over ajax by inlining the JSON object and atlas from Spine, but I can't get it to work.
Thanks.
The text was updated successfully, but these errors were encountered: