-
Notifications
You must be signed in to change notification settings - Fork 218
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
【BUG REPORT】load spine #415
Comments
That's obvious error. make a PR, change "substr" on "substring" , someone will merge it, rebuild pixi-spine and publish new version |
Alternatively: just make a polyfill on substr. This function existed before: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr |
Actually, |
I think this happens when the spine file is loaded. I installed the latest version |
pixi-spine can't recognize pixi-version @ivanpopelyshev |
Please debug this thing. Place a breakpoint there and look whether there's "version" field in json you load. |
hi,I submitted pr |
作者解决了这个问题吗 |
@kerimdragolj Its not the same issue. Please give me full reproduction. Most probably, you loaded wrong json file that doesnt have "version" field inside. |
@ivanpopelyshev yes you were correct, it was missing version, any idea why? i mean file was exported from Spine so it should be correct out of the box, containing all the needed data? After manually adding version i got rid of this error but stumbled on another one, but i guess i will just have to keep investigating these one by one... anyways thanks a lot for quick response, much appreciated! |
Which version of spine is it? |
@ivanpopelyshev SPINE PRO 4.1.08 |
Can you please make issue at https://github.com/EsotericSoftware/spine-runtimes/issues ? With description how did you get that file, how problem was solved and link to this thread? |
@ivanpopelyshev can you please check if this exported json spine looks good to you, and if you can use it https://drive.google.com/file/d/1tKBNyPF2K_5nQXMr61DXdTRA-iQN8b3w/view?usp=sharing |
Thank you! Versoin: "spine": "4.0-from-4.1.09" . That's interesting |
@ivanpopelyshev Ahh sorry about that.. i was trying to get different output by changing version on export, but overall structure is the same either way, just that 'spine' field changes.. i've reuploaded 4.1.09, you can find it here So I'm wondering is it working for you, can you load it in the pixi/spine or you receive same errors as i did |
Nevermind it was code related issue, but still have to manually add that version field on each export... |
What was the issue?? @kerimdragolj I'm running into the same thing, but I see another error with bones after adding version. |
my guess here is the loader is not implemented correctly.. will try fixing that.. |
solved with the loader used this as an example: https://codesandbox.io/s/pixi-spine-30-test-0iopd?file=/src/index.ts |
|
@badlogic Whats up with version in binary files? |
Nothing's up afaics https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-ts/spine-core/src/SkeletonBinary.ts#L77 At a minimum, we need to know the exact Spine Editor versions the binary files have been exported from. |
skeleton.zip |
@ivanpopelyshev pls review/comment/fixUsingOwnWay #468 , thanks) |
fix version detection of binary spine file #415
Is there any progress on this issue? 😭 |
I thought that one was fixed? Can you modify spine.js file directly for your project? |
here's my package versions:
still got error
It seems SpinePhaser still not work...
some other informationmy code: import 'pixi-spine';
import { Application, Assets } from 'pixi.js';
import { Spine } from 'pixi-spine';
const app: any = new Application();
document.body.appendChild(app.view);
Assets.load('/assets/mix-and-match-pro-json/mix-and-match-pro.json').then(
(resource) => {
console.log(resource);
const animation = new Spine(resource);
app.stage.addChild(animation);
// 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;
// update yourself
animation.autoUpdate = true;
}
}
); mix-and-match-pro.json using spine 4.1 |
the described issue was for binary files and it was fixed since 3.1.2, I think it is better to create a new one for this case with your details |
After upgrading Pixi.js to 7.3.2, everything works fine. Just ignore me. |
in my index.js,I use
import * as PIXI from 'pixi.js'; import { Spine } from 'pixi-spine';
to load spine。
but the console show
Uncaught TypeError: Cannot read properties of undefined (reading 'substr')
。I check the source
@pixi-spine/load-uni/lib/loader-uni.es.js
the error code is that:
function detectSpineVersion(version) { var ver3 = version.substr(0, 3); var verNum = Math.floor(+ver3 * 10 + 1e-3); if (ver3 === '3.7') { return SPINE_VERSION.VER37; } if (ver3 === '3.8') { return SPINE_VERSION.VER38; } if (ver3 === '4.0') { return SPINE_VERSION.VER40; } // try parse old versions with 3.7 if (verNum < SPINE_VERSION.VER37) { return SPINE_VERSION.VER37; } return SPINE_VERSION.UNKNOWN; }
This is my version
"pixi-spine": "^3.0.13", "pixi.js": "^6.1.3"
This is the library I use https://github.com/YangLG-7/test_pixi.git
so,how can i load a spine?Thank you for your reply
The text was updated successfully, but these errors were encountered: