Jump to content

The spineData param is required !! in pixie-spine project. HELP HELP


oler
 Share

Recommended Posts

6 minutes ago, ivan.popelyshev said:

can you post it in text format? because right now its all... i dont know, its not correct json, and i cant determine whether the original is correct.

like this :

  1. {,…}
    1. animations:{,…}
    2. bones:[{name: "root"}, {name: "cont", parent: "root", x: -1132.31, y: -831.67},…]
    3. events:{plate-popup-sound: {}}
    4. ik:[{name: "left-bridge", order: 1, bones: ["bridge-left", "bridge-left2"], target: "left-bridge",…},…]
    5. skeleton:{hash: "oPv7d0JDjqC0QJ3N3tkRCntQgH8", spine: "3.6.53", width: 2302, height: 1690, images: "./images/"}
    6. skins:{default: {arena: {arena: {x: 1165.04, y: 674.25, width: 1282, height: 1002}},…}}
    7. slots:[{name: "background", bone: "cont", attachment: "background"},…]
Link to comment
Share on other sites

Did you have same issue if you run in fireFox ?
If work in fireFox, it because you bad config your local security acces with chrome web client.


here more help about this and how hack argument from your chrome web browser.

https://stackoverflow.com/questions/4819060/allow-google-chrome-to-use-xmlhttprequest-to-load-a-url-from-a-local-file

 

Alternative for chrome, are chromium with nwjs.

Link to comment
Share on other sites

also for 

Unexpected token s in JSON at position 1

it can be from your spine builder.
Update your software and build again the Spines Files.
 

Be shure you have the last spine version in your json.

"skeleton": { "hash": "O1AWSDiL/YgsybuuOr3c1JnIFs4", "spine": "3.7.19-beta", "width": 64, "height": 102, "images": "../images/", "audio": "C:/Users/jonle/Documents/Games/anft_1.6.1/data2/boot/P/cur/source/spine" },
 
image.thumb.png.e68e92336986140027674da33aa01602.png
Link to comment
Share on other sites

4 hours ago, ivan.popelyshev said:

actually now i have an idea. Please open "skeleton.json" file manually through notepad or your favorite editor. what do you see there?

Hey yes..I have opened to examine...nothing weird but all the json is on one line. Line 1

Link to comment
Share on other sites

  • 3 years later...

I'm having the hardest time getting this working in react.  I get the Error: The spineData param is required. error

 

Here's my code:

import React from 'react';
import * as PIXI from "pixi-spine";
 
window.PIXI = PIXI;
require("pixi-spine")
 
function Hero() {
const app = new PIXI.Application();
 
document.body.appendChild(app.view);
 
// load spine data
app.loader
.add('spineboypro', './spineboy.json')
.load(onAssetsLoaded);
 
app.stage.interactive = true;
 
function onAssetsLoaded(loader, res) {
// create a spine boy
const spineBoyPro = new PIXI.spine.Spine(res.spineboypro.spineData);
 
// set the position
spineBoyPro.x = app.screen.width / 2;
spineBoyPro.y = app.screen.height;
 
spineBoyPro.scale.set(0.5);
 
app.stage.addChild(spineBoyPro);
 
const singleAnimations = ['aim', 'death', 'jump', 'portal'];
const loopAnimations = ['hoverboard', 'idle', 'run', 'shoot', 'walk'];
const allAnimations = [].concat(singleAnimations, loopAnimations);
 
let lastAnimation = '';
 
// Press the screen to play a random animation
app.stage.on('pointerdown', () => {
let animation = '';
do {
animation = allAnimations[Math.floor(Math.random() * allAnimations.length)];
} while (animation === lastAnimation);
 
spineBoyPro.state.setAnimation(0, animation, loopAnimations.includes(animation));
 
lastAnimation = animation;
});
}
 
return (
<div/>
)
}
 
export default Hero;
Link to comment
Share on other sites

hmm

updated my code and get the error: TypeError: pixi_spine__WEBPACK_IMPORTED_MODULE_2__.Spine is not a constructor

import * as PIXI from 'pixi.js';
import {Spine} from 'pixi-spine';
 
window.PIXI = PIXI;
 
function Hero() {
const app = new PIXI.Application();
document.body.appendChild(app.view);
 
app.loader
.add('spineCharacter', './spineboy.json')
.load(function (loader, resources) {
const animation = new Spine(resources.spineCharacter.spineData);
 
// add the animation to the scene and render...
app.stage.addChild(animation);
 
if (animation.state.hasAnimation('run')) {
// run forever, little boy!
animation.state.setAnimation(0, 'run', true);
// dont run too fast
animation.state.timeScale = 0.1;
}
 
app.start();
});
 
return (
<div/>
)
}
 
export default Hero;
 
 
Link to comment
Share on other sites

it should work, it works for other people. Please re-install node_modules , remove package.lock, you know, the usual. And tell me which versions do you use

Obligatory note: I hate webpack and if its users dont know how to configure it - usually its their problem to solve.

Edited by ivan.popelyshev
Link to comment
Share on other sites

I removed all pixi from package-lock.json.  I was told to never delete package-lock.json.
I updated the libraries to the latest:
"resource-loader": "^3.0.1",
"pixi-spine": "^3.0.8",
"pixi.js": "^6.1.2"

but still get --> Error: The spineData param is required.

and get the error if I include 

window.PIXI = PIXI;

or not.

 

Link to comment
Share on other sites

Here's a really simple react app that tries to use the pixi libraries to display the spineboy animation.
The attached app was created using: npx create-react-app pixi-app

When you npm install, npm start the app, it gets this error: Error: The spineData param is required.

A simple react app like this would be a great addition to the pixi docs.

thanks!

pixi-app.zip

Link to comment
Share on other sites

When you add json to loader, when json is loaded - pixi loader middleware from pixi-spine adds two more files in loading queue. 

I dont know whether to advice you to just roll with it, or send you to sources https://github.com/pixijs/spine/blob/ccf3573b24745631157f054dbf211d9c69a49486/packages/loader-base/src/loaders.ts#L128 

Link to comment
Share on other sites

pixi-app.7z

here's what you did wrong:

json, png, and atlas has to be in "public/" , those are not sources you can include through react. It seems that you are working with pixi or any html5 renderers for the first time - its not possible to include resources through react, unless you know how react does that in that particular case and you know how loader system of the renderer works

Your attempt at adding react component also lacks "app.destroy()" which is critical here. To understand what exactly is that "app" you have to read https://github.com/pixijs/pixijs/wiki/v5-Custom-Application-GameLoop

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...